/** * Build the content for this action * * @return void * @access public * @since 4/26/05 */ function execute() { if (RequestContext::value('help') || RequestContext::value('h') || RequestContext::value('?')) { throw new HelpRequestedException("This is a command line script that will populate the OAI data tables from the \nrepositories in Concerto. It takes no arguments or parameters.\n"); } $harmoni = Harmoni::instance(); $config = $harmoni->getAttachedData('OAI_CONFIG'); if (!defined('OAI_UPDATE_OUTPUT_HTML')) { define("OAI_UPDATE_OUTPUT_HTML", TRUE); } while (ob_get_level()) { ob_end_flush(); } $harvesterConfig = $config->getProperty('OAI_HARVESTER_CONFIG'); if (!isset($_SESSION['oai_table_setup_complete'])) { $dbc = Services::getService("DatabaseManager"); $tables = $dbc->getTableList($config->getProperty('OAI_DBID')); foreach ($harvesterConfig as $configArray) { $table = 'oai_' . $configArray['name']; if (!in_array($table, $tables)) { $queryString = file_get_contents(dirname(__FILE__) . "/phpoai2/doc/oai_records_mysql.sql"); $queryString = str_replace('oai_records', $table, $queryString); $query = new GenericSQLQuery(); $query->addSQLQuery(SQLUtils::parseSQLString($queryString)); $dbc->query($query, $config->getProperty('OAI_DBID')); } } $_SESSION['oai_table_setup_complete'] = true; } $i = 1; foreach ($harvesterConfig as $configArray) { $tableMessage = "Updating table oai_" . $configArray['name'] . " (table " . $i . " of " . count($harvesterConfig) . ")"; if (OAI_UPDATE_OUTPUT_HTML) { print "\n<hr/><h2>" . $tableMessage . "</h2>"; } else { print "---------------------------------------------------\n| {$tableMessage}\n---------------------------------------------------\n"; } $this->updateTable($configArray['name'], $configArray['repository_ids'], $configArray['auth_group_ids']); $i++; print "\n\n"; } }
/** * Build the content for this action * * @return void * @access public * @since 4/26/05 */ function execute() { if (!isset($_SESSION['oai_table_setup_complete'])) { $dbc = Services::getService("DatabaseManager"); $harmoni = Harmoni::instance(); $config = $harmoni->getAttachedData('OAI_CONFIG'); $tables = $dbc->getTableList($config->getProperty('OAI_DBID')); $harvesterConfig = $config->getProperty('OAI_HARVESTER_CONFIG'); foreach ($harvesterConfig as $configArray) { $table = 'oai_' . $configArray['name']; if (!in_array($table, $tables)) { $queryString = file_get_contents(dirname(__FILE__) . "/phpoai2/doc/oai_records_mysql.sql"); $queryString = str_replace('oai_records', $table, $queryString); $query = new GenericSQLQuery(); $query->addSQLQuery(SQLUtils::parseSQLString($queryString)); $dbc->query($query, $config->getProperty('OAI_DBID')); } } $_SESSION['oai_table_setup_complete'] = true; } require dirname(__FILE__) . "/phpoai2/oai2.php"; exit; }