Exemple #1
0
require_once _PS_INSTALL_PATH_ . 'classes/exception.php';
require_once _PS_INSTALL_PATH_ . 'classes/languages.php';
require_once _PS_INSTALL_PATH_ . 'classes/language.php';
require_once _PS_INSTALL_PATH_ . 'classes/model.php';
require_once _PS_INSTALL_PATH_ . 'classes/session.php';
require_once _PS_INSTALL_PATH_ . 'classes/sqlLoader.php';
require_once _PS_INSTALL_PATH_ . 'classes/xmlLoader.php';
require_once _PS_INSTALL_PATH_ . 'classes/simplexml.php';
@set_time_limit(0);
if (!@ini_get('date.timezone')) {
    @date_default_timezone_set('UTC');
}
// Some hosting still have magic_quotes_runtime configured
ini_set('magic_quotes_runtime', 0);
// Try to improve memory limit if it's under 32M
if (psinstall_get_memory_limit() < psinstall_get_octets('64M')) {
    ini_set('memory_limit', '64M');
}
function psinstall_get_octets($option)
{
    if (preg_match('/[0-9]+k/i', $option)) {
        return 1024 * (int) $option;
    }
    if (preg_match('/[0-9]+m/i', $option)) {
        return 1024 * 1024 * (int) $option;
    }
    if (preg_match('/[0-9]+g/i', $option)) {
        return 1024 * 1024 * 1024 * (int) $option;
    }
    return $option;
}
Exemple #2
0
// PrestaShop autoload is used to load some helpfull classes like Tools.
// Add classes used by installer bellow.
require_once _PS_CORE_DIR_ . '/config/alias.php';
require_once _PS_INSTALL_PATH_ . 'classes/exception.php';
require_once _PS_INSTALL_PATH_ . 'classes/language.php';
require_once _PS_INSTALL_PATH_ . 'classes/model.php';
require_once _PS_INSTALL_PATH_ . 'classes/session.php';
require_once _PS_INSTALL_PATH_ . 'classes/sqlLoader.php';
require_once _PS_INSTALL_PATH_ . 'classes/xmlLoader.php';
require_once _PS_INSTALL_PATH_ . 'classes/simplexml.php';
@set_time_limit(0);
if (!@ini_get('date.timezone')) {
    @date_default_timezone_set('Europe/Paris');
}
// Try to improve memory limit if it's under 64M
$current_memory_limit = psinstall_get_memory_limit();
if ($current_memory_limit > 0 && $current_memory_limit < psinstall_get_octets('64M')) {
    ini_set('memory_limit', '64M');
}
function psinstall_get_octets($option)
{
    if (preg_match('/[0-9]+k/i', $option)) {
        return 1024 * (int) $option;
    }
    if (preg_match('/[0-9]+m/i', $option)) {
        return 1024 * 1024 * (int) $option;
    }
    if (preg_match('/[0-9]+g/i', $option)) {
        return 1024 * 1024 * 1024 * (int) $option;
    }
    return $option;