/** * Run script: Search for SUPEE-6788 affected files, auto-patch if needed. * * @return void */ public function run() { $dryRun = null; if (isset($this->_args['analyze'])) { $dryRun = true; } elseif (isset($this->_args['fix'])) { $dryRun = false; } if (!is_null($dryRun)) { static::log('-------------------------------------------------------------------'); static::log('---- SUPEE-6788 Developer Toolbox by ParadoxLabs ------------------'); static::log(' https://github.com/rhoerr/supee-6788-toolbox'); static::log(' Time: ' . date('c')); if (isset($this->_args['loadWhitelists'])) { static::log('---- Loading whitelists -------------------------------------------'); $this->_loadWhitelistsFromFile(); } $this->_findModules(); static::log('---- Searching config for bad routers -----------------------------'); $configAffectedModules = $this->_fixBadAdminhtmlRouter($dryRun); static::log('---- Moving controllers for bad routers to avoid conflicts --------'); $this->_moveAdminControllers($configAffectedModules, $dryRun); static::log('---- Searching files for bad routes -------------------------------'); $this->_fixBadAdminRoutes($dryRun); static::log('---- Searching for whitelist problems -----------------------------'); $whitelist = new TemplateVars(); $whitelist->execute(); sort($this->_modifiedFiles); static::log('---- Summary ------------------------------------------------------'); static::log(sprintf("Affected Modules:\n %s", implode("\n ", $configAffectedModules))); static::log(sprintf("Replace Patterns: %s", print_r($this->_fileReplacePatterns, 1))); static::log(sprintf("Corrected Files:\n %s", implode("\n ", $this->_modifiedFiles))); static::log(sprintf("Errors:\n %s", implode("\n ", static::$_errors))); static::log('See var/log/fixSUPEE6788.log for a record of all results.'); if (isset($this->_args['recordAffected'])) { file_put_contents(Mage::getBaseDir('var') . DS . 'log' . DS . 'fixSUPEE6788-modules.log', implode("\n", $configAffectedModules)); static::log('Wrote affected modules to var/log/fixSUPEE6788-modules.log'); file_put_contents(Mage::getBaseDir('var') . DS . 'log' . DS . 'fixSUPEE6788-files.log', implode("\n", $this->_modifiedFiles)); static::log('Wrote affected files to var/log/fixSUPEE6788-files.log'); } } else { echo $this->usageHelp(); } }
/** * Run script: Search for SUPEE-6788 affected files, auto-patch if needed. * * @return void */ public function run() { $dryRun = null; if (isset($this->_args['analyze'])) { $dryRun = true; } elseif (isset($this->_args['fix'])) { $dryRun = false; } if (!is_null($dryRun)) { static::log('-------------------------------------------------------------------'); static::log('---- SUPEE-6788 Developer Toolbox by ParadoxLabs ------------------'); static::log(' https://github.com/rhoerr/supee-6788-toolbox'); static::log(' Time: ' . date('c')); static::log('---- Loading whitelists -------------------------------------------'); $this->_loadWhitelistsFromFile(); $this->_findModules(); /** * Due to limited automated success this method is disabled * It is preferred to action this manually, as an interim solution * admin protection should be enabled for custom admin routes * * See https://www.sonassi.com/help/magestack/protecting-magento-admin-downloader */ $oldDryRun = $dryRun; $dryRun = true; static::log('---- Searching config for bad routers -----------------------------'); $configAffectedModules = $this->_fixBadAdminhtmlRouter($dryRun); static::log('---- Moving controllers for bad routers to avoid conflicts --------'); $this->_moveAdminControllers($configAffectedModules, $dryRun); static::log('---- Searching files for bad routes -------------------------------'); $this->_fixBadAdminRoutes($dryRun); // Restore dry run parameter $dryRun = $oldDryRun; static::log('---- Searching for whitelist problems -----------------------------'); $whitelist = new TemplateVars(); $whitelist->execute($dryRun); sort($this->_modifiedFiles); static::log('---- Summary ------------------------------------------------------'); static::log(sprintf("Affected Modules:\n %s", implode("\n ", $configAffectedModules))); static::log(sprintf("Affected Files:\n %s", implode("\n ", $this->_modifiedFiles))); static::log(sprintf("Issues:\n %s", implode("\n ", static::$_errors))); static::log('See var/log/fixSUPEE6788.log for a record of all results.'); if (isset($this->_args['recordAffected'])) { file_put_contents(Mage::getBaseDir('var') . DS . 'log' . DS . 'fixSUPEE6788-modules.log', implode("\n", $configAffectedModules)); static::log('Wrote affected modules to var/log/fixSUPEE6788-modules.log'); file_put_contents(Mage::getBaseDir('var') . DS . 'log' . DS . 'fixSUPEE6788-files.log', implode("\n", $this->_modifiedFiles)); static::log('Wrote affected files to var/log/fixSUPEE6788-files.log'); } } elseif (!is_null($this->_args['fixWhitelists'])) { static::log('-------------------------------------------------------------------'); static::log('---- SUPEE-6788 Developer Toolbox by ParadoxLabs ------------------'); static::log(' https://github.com/rhoerr/supee-6788-toolbox'); static::log(' Time: ' . date('c')); static::log('---- Searching for whitelist problems -----------------------------'); $whitelist = new TemplateVars(); $whitelist->execute(false); } else { echo $this->usageHelp(); } }