-
Notifications
You must be signed in to change notification settings - Fork 7
Description
The cache clearing command currently attempts to use a shortcut to move the sCompileDir out of the way for OXID to immediately create a new one:
Respective function snippet:
oxrun/src/Oxrun/Command/Cache/ClearCommand.php
Lines 96 to 103 in 2c6f837
| protected function unixFastClear($compileDir) | |
| { | |
| $compileDir = escapeshellarg($compileDir); | |
| // Fast Process: Move folder and create new folder | |
| passthru("mv ${compileDir} ${compileDir}_old && mkdir -p ${compileDir}/smarty"); | |
| // Low Process delete folder on slow HD | |
| passthru("rm -Rf ${compileDir}_old"); | |
| } |
If the shortcut is not used then instead PHP globbing is used:
oxrun/src/Oxrun/Command/Cache/ClearCommand.php
Lines 81 to 90 in 2c6f837
| foreach (glob($compileDir . DIRECTORY_SEPARATOR . '*') as $filename) { | |
| if (!is_dir($filename)) { | |
| unlink($filename); | |
| } | |
| } | |
| foreach (glob($compileDir . DIRECTORY_SEPARATOR . 'smarty' . DIRECTORY_SEPARATOR . '*') as $filename) { | |
| if (!is_dir($filename)) { | |
| unlink($filename); | |
| } | |
| } |
PHP globbing does not match dotfiles such as .htaccess, which is a file placed by the OXID eShop installation itself to prevent public access to files inside this directory. Moving the directory itself out of the way and then deleting it will cause the .htaccess file to be deleted though.
Moving the directory is also problematic in setups where the sCompileDir is a mount point such as in Docker environments where this directory is a volume.