function run() { $logger = DevblocksPlatform::getConsoleLog(); $logger->info("[Message Import] Starting Import Task"); // System wide default should be fine will revisit if needed // @ini_set('memory_limit','128M'); $db = DevblocksPlatform::getDatabaseService(); // Give plugins a chance to run import $eventMgr = DevblocksPlatform::getEventService(); $eventMgr->trigger(new Model_DevblocksEvent('cron.import', array())); $import_sources = DAO_ImportSource::getAll(); foreach ($import_sources as $import_source_id => $import_source) { $logger->info('[Message Import] Now Processing ' . $import_source->name . ' Importer Number: ' . $import_source->id); switch ($import_source->type) { case 0: $logger->info("[IXO Importer] Importer started"); self::importCombined($import_source); break; case 1: $logger->info("[ComMon Importer] Importer started"); self::importCombined($import_source); break; case 2: $logger->info("[PI Importer] Importer started"); self::importCombined($import_source); break; default: break; } } self::importAccountReProcess(); self::importInQueueReProcess(); $logger->info('[Message Import] finished.'); }
function saveImportPeekAction() { $translate = DevblocksPlatform::getTranslationService(); @($id = DevblocksPlatform::importGPC($_POST['id'], 'integer')); @($view_id = DevblocksPlatform::importGPC($_POST['view_id'], 'string')); @($delete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0)); @($disabled = DevblocksPlatform::importGPC($_POST['imports_is_disabled'], 'integer', 0)); @($import_name = DevblocksPlatform::importGPC($_POST['import_name'], 'string', "")); @($import_type = DevblocksPlatform::importGPC($_POST['import_type'], 'integer', 0)); @($import_path = DevblocksPlatform::importGPC($_POST['import_path'], 'string', "")); $fields = array(DAO_ImportSource::NAME => $import_name, DAO_ImportSource::PATH => $import_path, DAO_ImportSource::TYPE => $import_type, DAO_ImportSource::IS_DISABLED => $disabled); if ($id == 0) { // Create New Import $id = $status = DAO_ImportSource::create($fields); } else { // Update Existing Import $status = DAO_ImportSource::update($id, $fields); } if (!empty($view_id)) { $view = Feg_AbstractViewLoader::getView($view_id); $view->render(); } //DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup','workers'))); }
function doBulkUpdate($filter, $do, $ids = array()) { @set_time_limit(0); $change_fields = array(); $custom_fields = array(); // Make sure we have actions if (empty($do)) { return; } // Make sure we have checked items if we want a checked list if (0 == strcasecmp($filter, "checks") && empty($ids)) { return; } if (is_array($do)) { foreach ($do as $k => $v) { switch ($k) { // [TODO] Used for bulk update //$change_fields[DAO_ImportSource::ID] = intval($v); //$change_fields[DAO_ImportSource::NAME] = intval($v); //$change_fields[DAO_ImportSource::PATH] = intval($v); //$change_fields[DAO_ImportSource::TYPE] = intval($v); //$change_fields[DAO_ImportSource::IS_DISABLED] = intval($v); // [TODO] Implement actions case 'example': //$change_fields[DAO_ImportSource::EXAMPLE] = 'some value'; break; default: break; } } } $pg = 0; if (empty($ids)) { do { list($objects, $null) = DAO_ImportSource::search($this->params, 100, $pg++, SearchFields_ImportSource::ID, true, false); $ids = array_merge($ids, array_keys($objects)); } while (!empty($objects)); } $batch_total = count($ids); for ($x = 0; $x <= $batch_total; $x += 100) { $batch_ids = array_slice($ids, $x, 100); DAO_ImportSource::update($batch_ids, $change_fields); unset($batch_ids); } unset($ids); }
function showTab() { $translate = DevblocksPlatform::getTranslationService(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->cache_lifetime = "0"; @($customer_id = DevblocksPlatform::importGPC($_REQUEST['customer_id'], 'integer', 0)); $tpl->assign('customer_id', $customer_id); $core_tpl = $this->_TPL_PATH; $tpl->assign('core_tpl', $core_tpl); @($customer = DAO_CustomerAccount::get($customer_id)); if (empty($customer)) { echo "<H1>" . $translate->_('customer.display.invalid_customer') . "</H1>"; return; } $tpl->assign('customer', $customer); @($import_source = DAO_ImportSource::getAll()); $tpl->assign('import_source', $import_source); $tpl->display('file:' . $this->_TPL_PATH . 'customer/tabs/property/index.tpl'); }