Browse Source

added urllib in clean_opcache

bugfixes
shital.rtcamp 10 years ago
parent
commit
48eb14dc29
  1. 24
      ee/cli/plugins/clean.py
  2. 4
      ee/core/fileutils.py

24
ee/cli/plugins/clean.py

@ -4,6 +4,7 @@ from ee.core.services import EEService
from cement.core.controller import CementBaseController, expose from cement.core.controller import CementBaseController, expose
from cement.core import handler, hook from cement.core import handler, hook
import os import os
import urllib.request
def clean_plugin_hook(app): def clean_plugin_hook(app):
@ -51,29 +52,30 @@ class EECleanController(CementBaseController):
print("in memcache..") print("in memcache..")
pkg = EEAptGet() pkg = EEAptGet()
if(pkg.is_installed("memcached")): if(pkg.is_installed("memcached")):
print("memcache is installed...") self.app.log.info("memcache is installed...")
EEService.restart_service(self, "memcached") EEService.restart_service(self, "memcached")
print("Cleaning memcache..") self.app.log.info("Cleaning memcache..")
else: else:
print("memcache is not installed..") self.app.log.info("memcache is not installed..")
@expose(hide=True) @expose(hide=True)
def clean_fastcgi(self): def clean_fastcgi(self):
if(os.path.isdir("/var/run/nginx-cache")): if(os.path.isdir("/var/run/nginx-cache")):
print("Cleaning fastcgi...") self.app.log.info("Cleaning fastcgi...")
EEShellExec.cmd_exec(self, "rm -rf /var/run/nginx-cache/*") EEShellExec.cmd_exec(self, "rm -rf /var/run/nginx-cache/*")
else: else:
print("Error occur while Cleaning fastcgi..") self.app.log.info("Error occur while Cleaning fastcgi..")
@expose(hide=True) @expose(hide=True)
def clean_opcache(self): def clean_opcache(self):
#try:
try: try:
print("Cleaning opcache.... ") self.app.log.info("Cleaning opcache.... ")
EEShellExec.cmd_exec(self, "wget --no-check-certificate --spider" wp = urllib.request.urlopen(" https://127.0.0.1:22222/cache"
" -q https://127.0.0.1:22222/cache/opcache" "/opcache/opgui.php?page=reset").read()
"/opgui.php?page=reset") except Exception as e:
except OSError: self.app.log.info("Unable to clean opacache\n {0}{1}"
print("Unable to clean opache..") .format(e.errno, e.strerror))
def load(app): def load(app):

4
ee/core/fileutils.py

@ -15,15 +15,13 @@ class EEFileUtils():
def remove(self, filelist): def remove(self, filelist):
for file in filelist: for file in filelist:
if os.path.isfile(file): if os.path.isfile(file):
self.app.log.debug('Removing file')
self.app.log.info("Removing "+os.path.basename(file)+" ...") self.app.log.info("Removing "+os.path.basename(file)+" ...")
os.remove(file) os.remove(file)
self.app.log.debug('file Removed') self.app.log.debug('file Removed')
self.app.log.info("Done") self.app.log.info("Done")
if os.path.isdir(file): if os.path.isdir(file):
try: try:
self.app.log.debug('Removing file') print("Removing "+os.path.basename(file)+"...")
print("Removing "+os.path.basename(file)+" ...")
shutil.rmtree(file) shutil.rmtree(file)
self.app.log.info("Done") self.app.log.info("Done")
except shutil.Error as e: except shutil.Error as e:

Loading…
Cancel
Save