Files
interblue.pl/modules/pshowimporter/direct_import_continue.php
2024-10-25 14:16:28 +02:00

62 lines
1.9 KiB
PHP

<?php
/**
* File from http://PrestaShow.pl
*
* DISCLAIMER
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future.
*
* @authors PrestaShow.pl <kontakt@prestashow.pl>
* @copyright 2015 PrestaShow.pl
* @license http://PrestaShow.pl/license
*/
ini_set('max_execution_time', 86400);
ini_set('display_errors', 'On');
error_reporting(E_ALL);
define('IMPORTING_NOW', true);
define('_PS_ADMIN_DIR_', true);
if (!file_exists(dirname(__FILE__) . "/direct_import_now")) {
die('import not running...');
}
require_once "./../../config/config.inc.php";
require_once "./config.php";
ini_set('display_errors', 'On');
error_reporting(E_ALL);
if (!Tools::getValue('securekey') || Tools::getValue('securekey') != _IMPORT_SECURE_KEY_) {
if (!Tools::getValue('securekey') && (!isset($argv[1]) || $argv[1] != _IMPORT_SECURE_KEY_)) {
die('direct access denied');
}
}
PShow_Import::getInstance(file_get_contents(_IMPORT_STATUS_PATH_ . "filename"));
do {
if (!file_exists(dirname(__FILE__) . "/direct_import_now") || !PShow_Import::getInstance()) {
break;
}
$actual_row = (int) Tools::file_get_contents(_IMPORT_STATUS_PATH_ . "actual_row");
$rows_to_import = PShow_Import::getInstance()->config[0]['rowsCount'] - $actual_row;
PShow_Import::getInstance()->importToDatabase();
} while (($rows_to_import - 1) > 0);
// disable maintenance mode
if ((bool) Configuration::get('pshowimporter_maintenance_mode') && PShow_Import::getInstance()->maintenance_mode_enabled) {
PShow_Log::addImportLog("disabled maintenance mode");
Configuration::updateValue('PS_SHOP_ENABLE', '1');
}
PShow_File::unlink(dirname(__FILE__) . "/direct_import_now");
array_map('PShow_File::unlink', glob(_IMPORT_STATUS_PATH_ . "*"));
header('location: direct_import.php?securekey=' . _IMPORT_SECURE_KEY_);
die('IMPORT FINISHED');