} MagentoDebugger::prepareLibraries(); // XDebug if (isset($_GET['XDEBUG_SESSION_START']) || isset($_GET['XDEBUG_SESSION_STOP_NO_EXEC'])) { require_once MagentoDebugger::getDebuggerDir() . '/libs/Debugger/xdebug.php'; return; } // Debugger info if (isset($_GET['magento_debug_info']) && isset($_GET['current_version'])) { $currentVersion = MAGENTO_DEBUGGER_VERSION; $debuggedInfo = new Varien_Object(); $debuggedInfo->setVersion(MAGENTO_DEBUGGER_VERSION); if ($_GET['current_version'] != MAGENTO_DEBUGGER_VERSION) { require_once MagentoDebugger::getDebuggerDir() . '/libs/Debugger/update.php'; try { MagentoDebugger_Update::run($_GET['current_version']); $debuggedInfo->setUpdated(true); $debuggedInfo->setVersion($_GET['current_version']); } catch (Exception $e) { if (is_file(MagentoDebugger::getDebuggerVarDir() . '/required.version')) { unlink(MagentoDebugger::getDebuggerVarDir() . '/required.version'); } file_put_contents(MagentoDebugger::getDebuggerVarDir() . '/required.version', trim($_GET['current_version'])); if (is_dir(MagentoDebugger::getDebuggerVarDir() . '/required.dir')) { rmdir(MagentoDebugger::getDebuggerVarDir() . '/required.dir'); } mkdir(MagentoDebugger::getDebuggerVarDir() . '/required.dir'); $debuggedInfo->setUpdated(false); $debuggedInfo->setErrorMessage($e->getMessage()); $debuggedInfo->setErrorCode($e->getCode()); }
<?php require_once dirname(__FILE__) . '/libs/Debugger/debugger.php'; MagentoDebugger::setDebuggerDir(dirname(__FILE__)); if (!isset($argv[1])) { return; } $version = $argv[1]; require_once MagentoDebugger::getDebuggerDir() . '/libs/Debugger/update.php'; try { MagentoDebugger_Update::run($version); } catch (Exception $e) { echo "Error while updating: " . $e->getMessage . "\n"; }
public static function updateFiles($source, $dest, $isRoot = false) { if ($isRoot) { self::$_defaultDirectoryPermission = fileperms($dest); } // Clearing if (is_dir($source)) { $dirResource = opendir($dest); while ($file = readdir($dirResource)) { if ($file == "." || $file == ".." || $isRoot && in_array($file, self::$_excludeUpdateFiles)) { continue; } $sourceObject = $source . '/' . $file; if (!is_file($sourceObject) && !is_dir($sourceObject)) { $destObject = $dest . '/' . $file; MagentoDebugger::removeDirectory($destObject); } } closedir($dirResource); } // Copying if (is_dir($source)) { $dirResource = opendir($source); if (!$isRoot && !is_dir($dest)) { mkdir($dest); chmod($dest, self::$_defaultDirectoryPermission); } while ($file = readdir($dirResource)) { if ($file != "." && $file != "..") { self::updateFiles($source . "/" . $file, $dest . "/" . $file); } } closedir($dirResource); } else { $permissions = self::$_defaultDirectoryPermission; if (file_exists($dest)) { $permissions = fileperms($dest); } copy($source, $dest); if ($permissions) { chmod($dest, $permissions); } } }
<?php require_once dirname(__FILE__) . '/libs/Debugger/debugger.php'; MagentoDebugger::setDebuggerDir(dirname(__FILE__)); $targetDir = MagentoDebugger::getDebuggerDir(); require_once MagentoDebugger::getDebuggerDir() . '/libs/Debugger/update.php'; $filePermissions = fileperms(MagentoDebugger::getDebuggerVarDir() . '/required.version'); $dirPermissions = fileperms(MagentoDebugger::getDebuggerVarDir() . '/required.dir'); $owner = fileowner(MagentoDebugger::getDebuggerVarDir() . '/required.version'); $fixed = MagentoDebugger_Update::fixPermissions($targetDir, $owner, $filePermissions, $dirPermissions);