function cron_catalog_import($params) { global $X3_SESSION; if (!$X3_SESSION->data['sdata']['step']) { $params['step'] = 'parse'; } $params['cron'] = true; $this->setSessionHandler($X3_SESSION->data); $this->importXLS($params); $X3_CRON = x3_cron::getInstance(); if ($this->result['dataWriteEnd']) { /*stopping chain*/ $X3_CRON->set_chain(false); } else { /*starting chain*/ $X3_CRON->set_chain(true); } }
$this->tasks[$taskid] = array('module' => $modulename, 'method' => $method, 'status' => 1); return $taskid; } function start() { if ($this->tasks) { foreach ($this->tasks as $taskid => $module_task) { if ($m = Common::module_factory($module_task['module'] . '.cron')) { if ($module_task['status'] != 3) { $method_name = key($module_task['method']); $this->tasks[$taskid]['status'] = $m->{$method_name}($module_task['method'][$method_name], $this->tasks[$taskid]['status']); } } } } } } $X3_SESSION = new x3_file_session(); $X3_CHAINCALL = new x3_chaincall('cron.php'); $X3_CRON = x3_cron::getInstance(); //--------------------- $X3_CRON->add_task('backup', array('restore_by_cron' => array('file' => 'demo.sql'))); $X3_CRON->start(); $X3_SESSION->serialize_session(); sleep(1); if ($X3_CRON->chain()) { $TDB->close(); $X3_CHAINCALL->chain(array('x3sid' => $X3_SESSION->get_session_id())); } else { $X3_SESSION->data = null; }