public function dispatchLoopShutdown() { // // Force output to be sent - we need the client to have the page before // we start flushing progress bar updates // $app = AppController::getInstance(); $req = $app->getRequest(); $resp = $app->getResponse(); $resp->sendResponse(); $resp->clearContent(); // // Do reindexing // if ($req->isLoggedIn() && $req->user->canDoAction('can_do_search_reindex')) { set_time_limit(3600 * 8); $o_si = new SearchIndexer(); $o_si->reindex(null, array('showProgress' => false, 'interactiveProgressDisplay' => false, 'callback' => "caIncrementSearchReindexProgress")); } }
/** * Rebuild search indices */ public static function rebuild_search_index($po_opts = null) { require_once __CA_LIB_DIR__ . "/core/Search/SearchIndexer.php"; ini_set('memory_limit', '4000m'); set_time_limit(24 * 60 * 60 * 7); /* maximum indexing time: 7 days :-) */ $o_si = new SearchIndexer(); $va_tables = null; if ($vs_tables = (string) $po_opts->getOption('tables')) { $va_tables = preg_split("![;,]+!", $vs_tables); } $o_si->reindex($va_tables, array('showProgress' => true, 'interactiveProgressDisplay' => true)); return true; }
/** * Rebuild search indices */ public static function rebuild_search_index() { require_once __CA_LIB_DIR__ . "/core/Search/SearchIndexer.php"; ini_set('memory_limit', '4000m'); set_time_limit(24 * 60 * 60 * 7); /* maximum indexing time: 7 days :-) */ $o_si = new SearchIndexer(); $o_si->reindex(null, array('showProgress' => true, 'interactiveProgressDisplay' => true)); return true; }
#!/usr/local/bin/php <?php ini_set('memory_limit', '4000m'); set_time_limit(24 * 60 * 60 * 7); /* maximum indexing time: 7 days :-) */ if (!file_exists('./setup.php')) { die("ERROR: Can't load setup.php. Please create the file in the same directory as this script or create a symbolic link to the one in your web root.\n"); } //if (!$argv[1]) { // die("\nreindex.php: recreates search indices for specified CollectiveAccess instance.\n\nUSAGE: reindex.php 'instance_name'\nExample: ./reindex.php 'www.mycollection.org'\n"); //} if ($argv[1]) { $_SERVER['HTTP_HOST'] = $argv[1]; require_once "./setup.php"; require_once __CA_LIB_DIR__ . "/core/Search/SearchIndexer.php"; $o_si = new SearchIndexer(); print "[REINDEXING] " . __CA_APP_DISPLAY_NAME__ . "\n"; $o_si->reindex(null, array('showProgress' => true, 'interactiveProgressDisplay' => true)); } else { require_once "./setup.php"; foreach ($va_systems as $vs_host => $va_system_info) { passthru('php ./reindex.php ' . $vs_host, $vn_ret_); } }
/** * Delete all records we created for this test to avoid side effects with other tests */ public function tearDown() { $o_dm = Datamodel::load(); foreach ($this->opa_record_map as $vs_table => &$va_records) { $t_instance = $o_dm->getInstance($vs_table); foreach ($va_records as $vn_id) { if ($t_instance->load($vn_id)) { $t_instance->setMode(ACCESS_WRITE); $t_instance->delete(true, array('hard' => true)); } } // hack to get around storage loation delete weirdness (which is probably worth a separate test) if ($vs_table == 'ca_storage_locations') { $o_db = new Db(); $o_db->query("DELETE FROM ca_objects_x_storage_locations"); $o_db->query("DELETE FROM ca_storage_location_labels"); $o_db->query("DELETE FROM ca_storage_locations WHERE location_id>1 ORDER BY location_id DESC"); } $o_si = new SearchIndexer(); $o_si->reindex(array($vs_table), array('showProgress' => false, 'interactiveProgressDisplay' => false)); } }