If you need the Magento permission setting and cache cleanup instance code in the PHP script, refer to the. PHP instance code as follows :? Php # set file 644, directory 755functionn... PHP script to implement Magento permission settings and cache cleanup instance code. if you need code, refer to. PHP instance code as follows:
IsDir () chmod ($ path, $ dirModes); else if (is_file ($ path) chmod ($ path, $ fileModes );}} # clear the function cleandir ($ dir) {if ($ handle = opendir ($ dir) {while (false! ==( $ File = readdir ($ handle) {if ($ file! = '.' & $ File! = '.. '& Is_file ($ dir. '/'. $ file) {if (unlink ($ dir. '/'. $ file) {} else {echo $ dir. '/'. $ file. '(file) NOT deleted!
';}} Else if ($ file! = '.' & $ File! = '.. '& Is_dir ($ dir. '/'. $ file) {cleandir ($ dir. '/'. $ file); if (rmdir ($ dir. '/'. $ file) {} else {echo $ dir. '/'. $ file. '(directory) NOT deleted!
';}}} Closedir ($ handle) ;}## determine whether the directory is empty function isDirEmpty ($ dir) {return ($ files = @ scandir ($ dir )) & count ($ files) <= 2);} echo "------------------------- cleanup start -------------------------
"; $ Start = (float) array_sum (explode ('', microtime (); echo"
* ************* Setting permissions ***************
"; Echo" Setting all folder permissions to 755
"; Echo" Setting all file permissions to 644
"; AllDirChmod (". "); echo" Setting pear permissions to 550
"; Chmod (" pear ", 550); echo"
* ***************** Clearing cache ******************
"; If (file_exists (" var/cache ") {echo" Clearing var/cache
"; Cleandir (" var/cache ");} if (file_exists (" var/session ") {echo" Clearing var/session
"; Cleandir (" var/session ");} if (file_exists (" var/minifycache ") {echo" Clearing var/minifycache
"; Cleandir (" var/minifycache ");} if (file_exists (" downloader/pearlib/cache ") {echo" Clearing downloader/pearlib/cache
"; Cleandir (" downloader/pearlib/cache ");} if (file_exists (" downloader/pearlib/download ") {echo" Clearing downloader/pearlib/download
"; Cleandir (" downloader/pearlib/download ");} if (file_exists (" downloader/pearlib/pear. ini ") {echo" Removing downloader/pearlib/pear. ini
"; Unlink (" downloader/pearlib/pear. ini ");} echo"
* ************* Checking for extensions ***********
"; If (! IsDirEmpty ("app/code/local/") {echo "-= WARNING =-Overrides or extensions exist in the app/code/local folder
";} If (! IsDirEmpty ("app/code/community/") {echo "-= WARNING =-Overrides or extensions exist in the app/code/community folder
";}$ End = (float) array_sum (explode ('', microtime (); echo"
----------------- Cleanup completed in: ". sprintf (" %. 4f ", ($ end-$ start)." seconds ------------------
";
Article address:
Reprint at will ^ please include the address of this article!