// ########## // #################################################### // ########## // ##### Scheduled imports // ########## // First fetch all scheduled imports to be processed $currentTimestamp = time(); $conds = array('is_active' => 1, 'next' => array('<=', $currentTimestamp)); $aScheduledImports = SQLIScheduledImport::fetchList(0, null, $conds); // Then create a pending SQLIImportItem for each scheduled import if (count($aScheduledImports) > 0) { $cli->output('Now handling scheduled imports'); $aImportItems = array(); foreach ($aScheduledImports as $scheduledImport) { // Create pending import $aImportItems[] = SQLIImportItem::fromScheduledImport($scheduledImport); } $importFactory = SQLIImportFactory::instance(); $importFactory->setScheduledImports($aScheduledImports); $importFactory->runImport($aImportItems); $importFactory->cleanup(); unset($aImportItems, $aScheduledImports); } // ########## // ##### End Scheduled imports // ########## $cli->output('Import is over :)'); $memoryMax = memory_get_peak_usage(); // Result is in bytes $memoryMax = round($memoryMax / 1024 / 1024, 2); // Convert in Megabytes