fix wo clean
This commit is contained in:
@@ -74,19 +74,18 @@ class WOCleanController(CementBaseController):
|
|||||||
def clean_opcache(self):
|
def clean_opcache(self):
|
||||||
if (os.path.exists('/usr/sbin/nginx') and
|
if (os.path.exists('/usr/sbin/nginx') and
|
||||||
os.path.exists(
|
os.path.exists(
|
||||||
'/var/www/22222/htdocs/cache/opcache/opgui.php')):
|
'/var/www/22222/htdocs/cache/opcache/php72.php')):
|
||||||
try:
|
try:
|
||||||
Log.info(self, "Cleaning opcache")
|
Log.info(self, "Cleaning opcache")
|
||||||
payload = {'RESET': '1'}
|
|
||||||
opgui = requests.get(
|
opgui = requests.get(
|
||||||
"http://127.0.0.1/cache/opcache/ocp.php", params=payload)
|
"http://127.0.0.1/cache/opcache/php72.php")
|
||||||
if opgui.status_code != '200' or opgui.status_code != '302':
|
if opgui.status_code != '200' or opgui.status_code != '302':
|
||||||
Log.warn(self, 'Cleaning opcache failed')
|
Log.warn(self, 'Cleaning opcache failed')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
Log.debug(self, "Unable hit url, "
|
Log.debug(self, "Unable hit url, "
|
||||||
" http://127.0.0.1/cache/opcache/"
|
" http://127.0.0.1/cache/opcache/"
|
||||||
"opgui.php?reset=1,"
|
"php72.php,"
|
||||||
" please check you have admin tools installed")
|
" please check you have admin tools installed")
|
||||||
Log.debug(self, "please check you have admin tools installed,"
|
Log.debug(self, "please check you have admin tools installed,"
|
||||||
" or install them with `wo stack install --admin`")
|
" or install them with `wo stack install --admin`")
|
||||||
|
|||||||
@@ -606,6 +606,16 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
encoding='utf-8', mode='w') as myfile:
|
encoding='utf-8', mode='w') as myfile:
|
||||||
myfile.write("<?php\nphpinfo();\n?>")
|
myfile.write("<?php\nphpinfo();\n?>")
|
||||||
|
|
||||||
|
# write opcache clean for php72
|
||||||
|
if not os.path.exists('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot)):
|
||||||
|
os.makedirs('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot))
|
||||||
|
WOFileUtils.textwrite(
|
||||||
|
self, '{0}22222/htdocs/cache/opcache/php72.php'
|
||||||
|
.format(ngxroot),
|
||||||
|
'<?php opcache_reset(); ?>')
|
||||||
|
|
||||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||||
.format(ngxroot),
|
.format(ngxroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
@@ -743,6 +753,16 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
encoding='utf-8', mode='w') as myfile:
|
encoding='utf-8', mode='w') as myfile:
|
||||||
myfile.write("<?php\nphpinfo();\n?>")
|
myfile.write("<?php\nphpinfo();\n?>")
|
||||||
|
|
||||||
|
# write opcache clean for php73
|
||||||
|
if not os.path.exists('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot)):
|
||||||
|
os.makedirs('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot))
|
||||||
|
WOFileUtils.textwrite(
|
||||||
|
self, '{0}22222/htdocs/cache/opcache/php73.php'
|
||||||
|
.format(ngxroot),
|
||||||
|
'<?php opcache_reset(); ?>')
|
||||||
|
|
||||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||||
.format(ngxroot),
|
.format(ngxroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
@@ -879,6 +899,16 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
self, "{0}22222/htdocs/php/info.php"
|
self, "{0}22222/htdocs/php/info.php"
|
||||||
.format(ngxroot), "<?php\nphpinfo();\n?>")
|
.format(ngxroot), "<?php\nphpinfo();\n?>")
|
||||||
|
|
||||||
|
# write opcache clean for php74
|
||||||
|
if not os.path.exists('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot)):
|
||||||
|
os.makedirs('{0}22222/htdocs/cache/opcache'
|
||||||
|
.format(ngxroot))
|
||||||
|
WOFileUtils.textwrite(
|
||||||
|
self, '{0}22222/htdocs/cache/opcache/php74.php'
|
||||||
|
.format(ngxroot),
|
||||||
|
'<?php opcache_reset(); ?>')
|
||||||
|
|
||||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||||
.format(ngxroot),
|
.format(ngxroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
|
|||||||
@@ -28,12 +28,26 @@ server {
|
|||||||
log_not_found off;
|
log_not_found off;
|
||||||
}
|
}
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /cache/opcache/opgui.php$is_args$args;
|
try_files $uri $uri/ /index.php$is_args$args;
|
||||||
}
|
}
|
||||||
location ~ \.php$ {
|
location /cache/opcache/php72.php {
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_pass phpstatus;
|
fastcgi_pass php72;
|
||||||
|
access_log off;
|
||||||
|
log_not_found off;
|
||||||
|
}
|
||||||
|
location /cache/opcache/php73.php {
|
||||||
|
try_files $uri =404;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass php73;
|
||||||
|
access_log off;
|
||||||
|
log_not_found off;
|
||||||
|
}
|
||||||
|
location /cache/opcache/php74.php {
|
||||||
|
try_files $uri =404;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass php74;
|
||||||
access_log off;
|
access_log off;
|
||||||
log_not_found off;
|
log_not_found off;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user