Пример #1
0
 public function __construct()
 {
     @set_time_limit(0);
     @ini_set('max_execution_time', '0');
     @ini_set('magic_quotes_runtime', '0');
     @ini_set('magic_quotes_sybase', '0');
     global $ajax, $currentIndex;
     if (!empty($ajax)) {
         $this->ajax = true;
     }
     $this->init();
     // retrocompatibility when used in module : Tab can't work,
     // but we saved the tab id in a cookie.
     if (class_exists('Tab', false)) {
         parent::__construct();
     } elseif (isset($_COOKIE['id_tab'])) {
         $this->id = $_COOKIE['id_tab'];
     }
     // Database instanciation (need to be cached because there will be at least 100k calls in the upgrade process
     if (!class_exists('Db', false)) {
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/db/Db.php';
         eval('abstract class Db extends DbCore{}');
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/db/MySQL.php';
         eval('class MySQL extends MySQLCore{}');
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/db/DbMySQLi.php';
         eval('class DbMySQLi extends DbMySQLiCore{}');
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/db/DbPDO.php';
         eval('class DbPDO extends DbPDOCore{}');
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/db/DbQuery.php';
         eval('class DbQuery extends DbQueryCore{}');
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/alias.php';
     }
     $this->db = Db::getInstance();
     // Performance settings, if your server has a low memory size, lower these values
     $perf_array = array('loopBackupFiles' => array(400, 800, 1600), 'maxBackupFileSize' => array(15728640, 31457280, 62914560), 'loopBackupDbTime' => array(6, 12, 25), 'max_written_allowed' => array(4194304, 8388608, 16777216), 'loopUpgradeFiles' => array(600, 1200, 2400), 'loopRestoreFiles' => array(400, 800, 1600), 'loopRestoreQueryTime' => array(6, 12, 25), 'loopUpgradeModulesTime' => array(6, 12, 25), 'loopRemoveSamples' => array(400, 800, 1600));
     switch ($this->getConfig('PS_AUTOUP_PERFORMANCE')) {
         case 3:
             foreach ($perf_array as $property => $values) {
                 self::${$property} = $values[2];
             }
             break;
         case 2:
             foreach ($perf_array as $property => $values) {
                 self::${$property} = $values[1];
             }
             break;
         case 1:
         default:
             foreach ($perf_array as $property => $values) {
                 self::${$property} = $values[0];
             }
     }
     $this->currentIndex = $_SERVER['SCRIPT_NAME'] . (($controller = Tools14::getValue('controller')) ? '?controller=' . $controller : '');
     if (defined('_PS_ADMIN_DIR_')) {
         $file_tab = @filemtime($this->autoupgradePath . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php');
         $file = @filemtime(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $this->autoupgradeDir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php');
         if ($file_tab < $file) {
             @copy(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $this->autoupgradeDir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php', $this->autoupgradePath . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php');
         }
     }
     if (!$this->ajax) {
         Context::getContext()->smarty->assign('display_header_javascript', true);
     }
 }
Пример #2
0
 public function __construct()
 {
     @set_time_limit(0);
     @ini_set('max_execution_time', '0');
     global $ajax;
     if (!empty($ajax)) {
         $this->ajax = true;
     }
     $this->init();
     // retrocompatibility when used in module : Tab can't work,
     // but we saved the tab id in a cookie.
     if (class_exists('Tab', false)) {
         parent::__construct();
     } elseif (isset($_COOKIE['id_tab'])) {
         $this->id = $_COOKIE['id_tab'];
     }
     // Database instanciation (need to be cached because there will be at least 100k calls in the upgrade process
     if (!class_exists('Db', false)) {
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/db/Db.php';
         eval('abstract class Db extends DbCore{}');
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/db/MySQL.php';
         eval('class MySQL extends MySQLCore{}');
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/db/DbMySQLi.php';
         eval('class DbMySQLi extends DbMySQLiCore{}');
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/db/DbPDO.php';
         eval('class DbPDO extends DbPDOCore{}');
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/db/DbQuery.php';
         eval('class DbQuery extends DbQueryCore{}');
         require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/alias.php';
     }
     $this->db = Db::getInstance();
     // Performance settings
     $perf_array = array('loopBackupFiles' => array(400, 800, 1600), 'loopBackupDbTime' => array(6, 12, 25), 'max_written_allowed' => array(4194304, 8388608, 16777216), 'loopUpgradeFiles' => array(600, 1200, 2400), 'loopRestoreFiles' => array(400, 800, 1600), 'loopRestoreQueryTime' => array(6, 12, 25), 'loopUpgradeModulesTime' => array(6, 12, 25), 'loopRemoveSamples' => array(400, 800, 1600));
     switch ($this->getConfig('PS_AUTOUP_PERFORMANCE')) {
         case 3:
             foreach ($perf_array as $property => $values) {
                 self::${$property} = $values[2];
             }
             break;
         case 2:
             foreach ($perf_array as $property => $values) {
                 self::${$property} = $values[1];
             }
             break;
         case 1:
         default:
             foreach ($perf_array as $property => $values) {
                 self::${$property} = $values[0];
             }
     }
 }
 public function __construct()
 {
     @set_time_limit(0);
     @ini_set('max_execution_time', '0');
     $this->init();
     // retrocompatibility when used in module : Tab can't work,
     // but we saved the tab id in a cookie.
     if (class_exists('Tab', false)) {
         parent::__construct();
     } else {
         $this->id = $_COOKIE['id_tab'];
     }
 }
 public function __construct()
 {
     // @todo : do this only in ajax mode and if we are allowed to use theses functions
     @set_time_limit(0);
     @ini_set('max_execution_time', '0');
     global $ajax;
     if (!empty($ajax)) {
         $this->ajax = true;
     }
     $this->init();
     // retrocompatibility when used in module : Tab can't work,
     // but we saved the tab id in a cookie.
     if (class_exists('Tab', false)) {
         parent::__construct();
     } else {
         if (isset($_COOKIE['id_tab'])) {
             $this->id = $_COOKIE['id_tab'];
         }
     }
 }