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

4
ee/core/fileutils.py

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

Loading…
Cancel
Save