Ejemplo n.º 1
1
 /**
  * Module installation.
  *
  * @return bool Success of the operation.
  */
 public function install()
 {
     HotfixClassesLoader::loadClasses(array('Settings', 'Installation', 'Patches'));
     $installation = new HotfixInstallation();
     $success = parent::install();
     $success = $success && $installation->installTables();
     $success = $success && $installation->createFolder($this->settings->get('paths/backup'));
     $success = $success && $installation->createFolder($this->settings->get('paths/patches'));
     $success = $success && Configuration::updateValue('SECURITYPATCH_EXEC_RESULT', 1);
     if ($success) {
         if ($this->checkExec()) {
             $settings = new HotfixSettings(include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'settings' . DIRECTORY_SEPARATOR . 'settings.php');
             $patches = new HotfixPatches($settings);
             $patches->refreshPatchesList();
             while ($patches->getTotalPatchesToDo() > 0) {
                 $currentPatch = $patches->getFirstPatchToDo();
                 $success = $success && $patches->installPatch($currentPatch);
             }
         }
         if ($success) {
             if (_PS_VERSION_ == '1.4.11.0') {
                 Tools::redirectAdmin('index.php?tab=AdminModules&configure=' . $this->name . '&token=' . Tools::getValue('token'));
             } else {
                 Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminModules') . '&configure=' . $this->name);
             }
         }
     }
     return $success;
 }