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

64 lines
1.8 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
*/
// not finished
die('no_access');
ini_set('max_execution_time', 86400);
ini_set('display_errors', 'On');
error_reporting(E_ALL);
define('IMPORTING_NOW', true);
define('_PS_ADMIN_DIR_', true);
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"));
$ajax_import_file = _IMPORT_STATUS_PATH_ . "ajax_import";
if (PShow_Import::getInstance()) {
$ajax_import_id = uniqid();
file_put_contents($ajax_import_file, $ajax_import_id);
}
do {
if (!file_exists($ajax_import_file) || !PShow_Import::getInstance() || file_get_contents($ajax_import_file) != $ajax_import_id) {
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');
}
die('IMPORT FINISHED');