Skip to content

Commit

Permalink
Merge pull request #509 from mesa57/develop
Browse files Browse the repository at this point in the history
Fix for --clear-cache php 5.6
  • Loading branch information
mesa57 committed Apr 5, 2020
2 parents bf7d95d + 2197343 commit 34b57fe
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions bin/upgrade-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

function delete_files($target)
{
$scan_result = scandir($target);
if (!is_link($target) && is_dir($target) && ($scan_result != false)) {
// it's a directory; recursively delete everything in it

$files = array_diff(scandir($target), ['.', '..']);
foreach ($files as $file) {
delete_files("$target/$file");
if (!is_link($target) && is_dir($target)) {
$scan_result = scandir($target);
if ($scan_result) {
// it's a directory; recursively delete everything in it
$files = array_diff(scandir($target), ['.', '..']);
foreach ($files as $file) {
delete_files("$target/$file");
}
}
rmdir($target);
} else {
Expand Down Expand Up @@ -226,8 +227,8 @@ function delete_files($target)

/* delete cache folder and re-create. */
$cachePath = $settings->get('cache_path');
delete_files(str_replace('\\', '/', dirname(__FILE__, 2).'/'.substr($cachePath, 2)));
$dir = str_replace('\\', '/', dirname(__FILE__, 2).'/'.substr($cachePath, 2));
delete_files(str_replace('\\', '/', realpath(__DIR__.'/..').'/'.substr($cachePath, 2)));
$dir = str_replace('\\', '/', realpath(__DIR__.'/..').'/'.substr($cachePath, 2));
$oldmask = umask(0);
mkdir($dir, 0777, true);
$oldmask = umask(0);
Expand Down

0 comments on commit 34b57fe

Please sign in to comment.