1# -*- coding: utf-8 -*- 2# 3# Copyright (C) 2015-2021 Edgewall Software 4# All rights reserved. 5# 6# This software is licensed as described in the file COPYING, which 7# you should have received as part of this distribution. The terms 8# are also available at https://trac.edgewall.org/wiki/TracLicense. 9# 10# This software consists of voluntary contributions made by many 11# individuals. For the exact contribution history, see the revision 12# history and logs, available at https://trac.edgewall.org/log/. 13 14import os 15 16from trac.util import backup_config_file 17 18 19def do_upgrade(env, version, cursor): 20 """Change [authz_policy] authz_file to be relative to the `conf` 21 directory. 22 """ 23 authz_file = env.config.get('authz_policy', 'authz_file') 24 if authz_file and not os.path.isabs(authz_file): 25 parts = os.path.split(authz_file) 26 if len(parts) == 2 and parts[0] == 'conf': 27 env.config.set('authz_policy', 'authz_file', parts[1]) 28 backup_config_file(env, '.db36.bak') 29 env.config.save() 30