/** * displayConf * * @return void */ public function displayConf() { if (!$this->standalone) { if (version_compare(_PS_VERSION_, '1.4.5.0', '<') and false) { $this->_errors[] = Tools::displayError('This class depends of several files modified in 1.4.5.0 version and should not be used in an older version'); } } parent::displayConf(); }
public function postProcess() { $this->_setFields(); // set default configuration to default channel & dafault configuration for backup and upgrade // (can be modified in expert mode) $config = $this->getConfig('channel'); if ($config === false) { $config = array(); $config['channel'] = Upgrader::DEFAULT_CHANNEL; $this->writeConfig($config); if (class_exists('Configuration', false)) { Configuration::updateValue('PS_UPGRADE_CHANNEL', $config['channel']); } $this->writeConfig(array('PS_AUTOUP_PERFORMANCE' => '1', 'PS_AUTOUP_CUSTOM_MOD_DESACT' => '1', 'PS_AUTOUP_UPDATE_DEFAULT_THEME' => '1', 'PS_AUTOUP_CHANGE_DEFAULT_THEME' => '0', 'PS_AUTOUP_KEEP_MAILS' => '0', 'PS_AUTOUP_BACKUP' => '1', 'PS_AUTOUP_KEEP_IMAGES' => '0')); } if (Tools14::isSubmit('putUnderMaintenance')) { foreach (Shop::getCompleteListOfShopsID() as $id_shop) { Configuration::updateValue('PS_SHOP_ENABLE', 0, false, null, (int) $id_shop); } Configuration::updateGlobalValue('PS_SHOP_ENABLE', 0); } if (Tools14::isSubmit('customSubmitAutoUpgrade')) { $config_keys = array_keys(array_merge($this->_fieldsUpgradeOptions, $this->_fieldsBackupOptions)); $config = array(); foreach ($config_keys as $key) { if (isset($_POST[$key])) { $config[$key] = $_POST[$key]; } } $res = $this->writeConfig($config); if ($res) { Tools14::redirectAdmin($this->currentIndex . '&conf=6&token=' . Tools14::getValue('token')); } } if (Tools14::isSubmit('deletebackup')) { $res = false; $name = Tools14::getValue('name'); $filelist = scandir($this->backupPath); foreach ($filelist as $filename) { // the following will match file or dir related to the selected backup if (!empty($filename) && $filename[0] != '.' && $filename != 'index.php' && $filename != '.htaccess' && preg_match('#^(auto-backupfiles_|)' . preg_quote($name) . '(\\.zip|)$#', $filename, $matches)) { if (is_file($this->backupPath . DIRECTORY_SEPARATOR . $filename)) { $res &= unlink($this->backupPath . DIRECTORY_SEPARATOR . $filename); } elseif (!empty($name) && is_dir($this->backupPath . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR)) { $res = self::deleteDirectory($this->backupPath . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR); } } } if ($res) { Tools14::redirectAdmin($this->currentIndex . '&conf=1&token=' . Tools14::getValue('token')); } else { $this->_errors[] = sprintf($this->l('Error when trying to delete backups %s'), $name); } } parent::postProcess(); }
protected function l($string, $class = 'AdminTab', $addslashes = FALSE, $htmlentities = TRUE) { if (version_compare(_PS_VERSION_, '1.4.3.0', '<')) { // need to be called in order to populate $classInModule return self::findTranslation('autoupgrade', $string, 'AdminSelfUpgrade'); } else { return parent::l($string, $class, $addslashes, $htmlentities); } }