fix office when upgrade

This commit is contained in:
sniper-py 2020-04-15 17:40:56 +08:00
parent 435060afda
commit 66982ada52
3 changed files with 31 additions and 2 deletions

View file

@ -35,7 +35,7 @@ RUN pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 \
sqlalchemy django-pylibmc django-simple-captcha && \
rm -r /root/.cache/pip
RUN pip3 install --timeout=3600 psd-tools boto oss2 pycryptodome twilio python-ldap configparser && \
RUN pip3 install --timeout=3600 boto oss2 pycryptodome twilio python-ldap configparser && \
rm -r /root/.cache/pip

View file

@ -125,7 +125,7 @@ def init_seafile_server():
'MYSQL_USER': 'seafile',
'MYSQL_USER_PASSWD': str(uuid.uuid4()),
'MYSQL_USER_HOST': '%.%.%.%',
'MYSQL_HOST': get_conf('DB_HOST','127.0.0.1'),
'MYSQL_HOST': get_conf('DB_HOST','127.0.0.1'),
# Default MariaDB root user has empty password and can only connect from localhost.
'MYSQL_ROOT_PASSWD': get_conf('DB_ROOT_PASSWD', ''),
}

View file

@ -119,6 +119,33 @@ def fix_ccent_conf():
print('Fix ccnet conf success')
print('')
def fix_office_config():
seafevents_conf_path = '/shared/seafile/conf/seafevents.conf'
seahub_conf_path = '/shared/seafile/conf/seahub_settings.py'
if exists(seafevents_conf_path):
with open(seafevents_conf_path, 'r') as fp:
fp_lines = fp.readlines()
if '[OFFICE CONVERTER]\n' in fp_lines and 'port = 6000\n' not in fp_lines:
insert_index = fp_lines.index('[OFFICE CONVERTER]\n') + 1
insert_lines = ['host = 127.0.0.1\n', 'port = 6000\n']
for line in insert_lines:
fp_lines.insert(insert_index, line)
with open(seafevents_conf_path, 'w') as fp:
fp.writelines(fp_lines)
with open(seahub_conf_path, 'r') as fp:
fp_lines = fp.readlines()
if "OFFICE_CONVERTOR_ROOT = 'http://127.0.0.1:6000/'\n" not in fp_lines:
fp_lines.append("OFFICE_CONVERTOR_ROOT = 'http://127.0.0.1:6000/'\n")
with open(seahub_conf_path, 'w') as fp:
fp.writelines(fp_lines)
print('')
print('Fix office config success')
print('')
def check_upgrade():
fix_custom_dir()
fix_ccent_conf()
@ -141,6 +168,8 @@ def check_upgrade():
new_version = parse_upgrade_script_version(script)[1] + '.0'
run_script_and_update_version_stamp(script, new_version)
fix_office_config()
update_version_stamp(current_version)
def main():