Skip to content

Commit 4e00aa3

Browse files
author
gau1991
committed
Merge branch 'python'
2 parents 6b04472 + 022bf7e commit 4e00aa3

File tree

2 files changed

+74
-10
lines changed

2 files changed

+74
-10
lines changed

ee/cli/plugins/log.py

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from ee.core.logging import Log
66
from ee.cli.plugins.site_functions import logwatch
77
from ee.core.variables import EEVariables
8+
from ee.core.fileutils import EEFileUtils
9+
from ee.core.shellexec import EEShellExec
810
import os
911
import glob
1012

@@ -24,27 +26,55 @@ class Meta:
2426
(['--all'],
2527
dict(help='Show All logs file', action='store_true')),
2628
(['--nginx'],
27-
dict(help='Show Nginx logs file', action='store_true')),
29+
dict(help='Show Nginx Error logs file', action='store_true')),
2830
(['--php'],
29-
dict(help='Show PHP logs file', action='store_true')),
31+
dict(help='Show PHP Error logs file', action='store_true')),
32+
(['--fpm'],
33+
dict(help='Show PHP5-fpm slow logs file',
34+
action='store_true')),
3035
(['--mysql'],
3136
dict(help='Show MySQL logs file', action='store_true')),
37+
(['--wp'],
38+
dict(help='Show Site specific WordPress logs file',
39+
action='store_true')),
40+
(['--access'],
41+
dict(help='Show Nginx access log file',
42+
action='store_true')),
43+
(['site_name'],
44+
dict(help='Website Name', nargs='?', default=None))
3245
]
3346

3447
@expose(hide=True)
3548
def default(self):
3649
"""Default function of debug"""
3750
self.msg = []
3851

39-
if ((not self.app.pargs.nginx) and (not self.app.pargs.php)
40-
and (not self.app.pargs.mysql)):
52+
if self.app.pargs.php:
53+
self.app.pargs.nginx = True
54+
55+
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
56+
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
57+
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)):
58+
self.app.pargs.nginx = True
59+
self.app.pargs.fpm = True
60+
self.app.pargs.mysql = True
61+
self.app.pargs.access = True
62+
63+
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
64+
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
65+
and (not self.app.pargs.wp) and (self.app.pargs.site_name)):
4166
self.app.pargs.nginx = True
42-
self.app.pargs.php = True
67+
self.app.pargs.wp = True
68+
self.app.pargs.access = True
4369
self.app.pargs.mysql = True
4470

45-
if self.app.pargs.nginx:
71+
if self.app.pargs.nginx and (not self.app.pargs.site_name):
4672
self.msg = self.msg + ["/var/log/nginx/*error.log"]
47-
if self.app.pargs.php:
73+
74+
if self.app.pargs.access and (not self.app.pargs.site_name):
75+
self.msg = self.msg + ["/var/log/nginx/*access.log"]
76+
77+
if self.app.pargs.fpm:
4878
open('/var/log/php5/slow.log', 'a').close()
4979
open('/var/log/php5/fpm.log', 'a').close()
5080
self.msg = self.msg + ['/var/log/php5/slow.log',
@@ -62,6 +92,40 @@ def default(self):
6292
Log.warn(self, "Remote MySQL found, EasyEngine is not able to"
6393
"show MySQL log file")
6494

95+
if self.app.pargs.site_name:
96+
if self.app.pargs.access:
97+
self.msg = self.msg + ["{0}/{1}/logs/access.log"
98+
.format(EEVariables.ee_webroot,
99+
self.app.pargs.site_name)]
100+
if self.app.pargs.nginx:
101+
self.msg = self.msg + ["{0}/{1}/logs/error.log"
102+
.format(EEVariables.ee_webroot,
103+
self.app.pargs.site_name)]
104+
if self.app.pargs.wp:
105+
webroot = "{0}{1}".format(EEVariables.ee_webroot,
106+
self.app.pargs.site_name)
107+
if not os.path.isfile('{0}/logs/debug.log'
108+
.format(webroot)):
109+
if not os.path.isfile('{0}/htdocs/wp-content/debug.log'
110+
.format(webroot)):
111+
open("{0}/htdocs/wp-content/debug.log".format(webroot),
112+
encoding='utf-8', mode='a').close()
113+
EEShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/wp-"
114+
"content/debug.log"
115+
"".format(webroot,
116+
EEVariables.ee_php_user)
117+
)
118+
119+
# create symbolic link for debug log
120+
EEFileUtils.create_symlink(self, ["{0}/htdocs/wp-content/"
121+
"debug.log"
122+
.format(webroot),
123+
'{0}/logs/debug.log'
124+
.format(webroot)])
125+
126+
self.msg = self.msg + ["{0}/{1}/logs/debug.log"
127+
.format(EEVariables.ee_webroot,
128+
self.app.pargs.site_name)]
65129
watch_list = []
66130
for w_list in self.msg:
67131
watch_list = watch_list + glob.glob(w_list)

ee/cli/plugins/stack_migrate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ def migrate_mariadb(self):
7575
log=False)
7676

7777
# Install MariaDB
78-
apt_packages = EEVariables.ee_mysql
78+
apt_packages = EEVariables.ee_mysql + ["php5-mysql"]
7979
Log.info(self, "Updating apt-cache, please wait ...")
8080
EEAptGet.update(self)
8181
Log.info(self, "Installing MariaDB, please wait ...")
82-
EEAptGet.remove(self, ["libmysqlclient18"])
83-
EEAptGet.install(self, apt_packages)
82+
EEAptGet.remove(self, ["mysql-common", "libmysqlclient18"])
8483
EEAptGet.auto_remove(self)
84+
EEAptGet.install(self, apt_packages)
8585

8686
@expose(hide=True)
8787
def default(self):

0 commit comments

Comments
 (0)