array(), 'stored' => array(), 'instFile' => array() ); /** * Check the root path and in case there are installer files without hashes rename them. * * @return void */ public static function renameInstallersPhpFiles() { $pathsTocheck = array( DupLiteSnapLibIOU::safePathTrailingslashit(ABSPATH), DupLiteSnapLibIOU::safePathTrailingslashit(DupLiteSnapLibUtilWp::getHomePath()), DupLiteSnapLibIOU::safePathTrailingslashit(WP_CONTENT_DIR) ); $pathsTocheck = array_unique($pathsTocheck); $filesToCheck = array(); foreach ($pathsTocheck as $cFolder) { if ( !is_dir($cFolder) || !is_writable($cFolder) // rename permissions ) { continue; } $cFile = $cFolder . 'installer.php'; if ( !is_file($cFile) || !DupLiteSnapLibIOU::chmod($cFile, 'u+rw') || !is_readable($cFile) ) { continue; } $filesToCheck[] = $cFile; } $installerTplCheck = '/class DUPX_Bootstrap.+const\s+ARCHIVE_FILENAME\s*=\s*[\'"](.+?)[\'"]\s*;.*const\s+PACKAGE_HASH\s*=\s*[\'"](.+?)[\'"];/s'; foreach ($filesToCheck as $file) { $fileName = basename($file); if (($content = @file_get_contents($file, false, null, 0, 5000)) === false) { continue; } $matches = null; if (preg_match($installerTplCheck, $content, $matches) !== 1) { continue; } $archiveName = $matches[1]; $hash = $matches[2]; $matches = null; if (preg_match(self::ARCHIVE_REGEX_PATTERN, $archiveName, $matches) !== 1) { if (DupLiteSnapLibIOU::unlink($file)) { self::$migrationCleanupReport['instFile'][] = "