1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-21 07:07:05 +00:00

when modifying php.ini, use ; as the comment char not # because php emits horrid deprecation warnings otherwise

This commit is contained in:
Joshua Tauberer 2014-08-15 18:29:05 -04:00
parent d03bc0cefa
commit a10b828d5c
2 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,4 @@
#!/bin/bash
# Owncloud
##########################
@ -73,7 +74,8 @@ mkdir -p $STORAGE_ROOT/owncloud
chown -R www-data.www-data $STORAGE_ROOT/owncloud /usr/local/lib/owncloud
# Set PHP FPM values to support large file uploads
tools/editconf.py /etc/php5/fpm/php.ini \
# (semicolon is the comment character in this file, hashes produce deprecation warnings)
tools/editconf.py /etc/php5/fpm/php.ini -c ';' \
upload_max_filesize=16G \
post_max_size=16G \
output_buffering=16384 \

View File

@ -33,6 +33,7 @@ settings = sys.argv[2:]
delimiter = "="
delimiter_re = r"\s*=\s*"
comment_char = "#"
folded_lines = False
testing = False
while settings[0][0] == "-" and settings[0] != "--":
@ -42,7 +43,11 @@ while settings[0][0] == "-" and settings[0] != "--":
delimiter = " "
delimiter_re = r"\s+"
elif opt == "-w":
# Line folding is possible in this file.
folded_lines = True
elif opt == "-c":
# Specifies a different comment character.
comment_char = settings.pop(0)
elif opt == "-t":
testing = True
else:
@ -60,7 +65,7 @@ while len(input_lines) > 0:
# If this configuration file uses folded lines, append any folded lines
# into our input buffer.
if folded_lines and line[0] not in ("#", " ", ""):
if folded_lines and line[0] not in (comment_char, " ", ""):
while len(input_lines) > 0 and input_lines[0][0] in " \t":
line += input_lines.pop(0)
@ -68,7 +73,11 @@ while len(input_lines) > 0:
for i in range(len(settings)):
# Check that this line contain this setting from the command-line arguments.
name, val = settings[i].split("=", 1)
m = re.match("(\s*)(#\s*)?" + re.escape(name) + delimiter_re + "(.*?)\s*$", line, re.S)
m = re.match(
"(\s*)"
+ "(" + re.escape(comment_char) + "\s*)?"
+ re.escape(name) + delimiter_re + "(.*?)\s*$",
line, re.S)
if not m: continue
indent, is_comment, existing_val = m.groups()
@ -83,7 +92,7 @@ while len(input_lines) > 0:
# comment-out the existing line (also comment any folded lines)
if is_comment is None:
buf += "#" + line.rstrip().replace("\n", "\n#") + "\n"
buf += comment_char + line.rstrip().replace("\n", "\n" + comment_char) + "\n"
else:
# the line is already commented, pass it through
buf += line