BobRay/UpgradeMODX

Error 500, incorrect snippet caching

Closed this issue · 1 comments

Error 500 when installing / upgrading UpgradedMODX (It is noticed since MODX Revo 2.6.1, UpgradeMODX 1.5.5):

[08-09-2018 10:35:46 Europe/Moscow] PHP Fatal error:
Cannot redeclare rrmdir() (previously declared in .../public_html/core/cache/includes/elements/modsnippet/51.include.cache.php:57) in .../public_html/core/cache/includes/elements/modsnippet/51.include.cache.php on line 76

Technical support advised to wrap the definition of a function in a condition to verify its existence:

if (! function_exists ('rrmdir')) {
function rrmdir ($ dir) {
    if (is_dir ($ dir)) {
        $ objects = scandir ($ dir);
        foreach ($ objects as $ object) {
            if ($ object! = "." && $ object! = "..") {
                if (filetype ($ dir. "/". $ object) == "dir") {
                    $ prefix = substr ($ object, 0, 4);
                    $ this-> rrmdir ($ dir. "/". $ object);
                } else {
                    $ prefix = substr ($ object, 0, 4);
                    if ($ prefix! = '.git' && $ prefix! = '.svn') {
                        @unlink ($ dir. "/". $ object);
                    }
                }
            }
        }
        reset ($ objects);
        $ success = @rmdir ($ dir);
    }
}
}

Thanks. This is a duplicate of #37

It's fixed in the dev. branch.