diff options
| author | Sean Lee <seannerd@users.sourceforge.net> | 2006-02-20 04:56:08 +0000 |
|---|---|---|
| committer | Sean Lee <seannerd@users.sourceforge.net> | 2006-02-20 04:56:08 +0000 |
| commit | 37647b42396d5b336c181d3e484abc236ba730c6 (patch) | |
| tree | 256271d4b7963bb1320c4f4f1ad5a915a7d98c3f /cmd_line_reindex.php | |
| parent | 7e3b1627bc402f5c350bd59c0569c7d4d9ef1ec3 (diff) | |
| download | search-37647b42396d5b336c181d3e484abc236ba730c6.tar.gz search-37647b42396d5b336c181d3e484abc236ba730c6.tar.bz2 search-37647b42396d5b336c181d3e484abc236ba730c6.zip | |
Merge recent changes to HEAD
Diffstat (limited to 'cmd_line_reindex.php')
| -rw-r--r-- | cmd_line_reindex.php | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/cmd_line_reindex.php b/cmd_line_reindex.php index bf7b9d0..800ddf2 100644 --- a/cmd_line_reindex.php +++ b/cmd_line_reindex.php @@ -48,35 +48,39 @@ require_once( SEARCH_PKG_PATH.'refresh_functions.php'); $whatToIndex = "pages"; $unindexedOnly = false; $silent = false; -if ($argc > 1) { - for ($i = 1; $i < $argc; $i++) { - $arg = strtolower($argv[$i]); - switch ($arg) { - case "silent" : - $silent = true; - break; - case "unindexedonly" : - $unindexedOnly = true; // only index content that hasn't been indexed yet - break; - default : - $whatToIndex = $arg; - break; +if (isset($argc)) { // we are running from the command line. + if ($argc > 1) { + for ($i = 1; $i < $argc; $i++) { + $arg = strtolower($argv[$i]); + switch ($arg) { + case "silent" : + $silent = true; + break; + case "unindexedonly" : + $unindexedOnly = true; // only index content that hasn't been indexed yet + break; + default : + $whatToIndex = $arg; + break; + } } + $time_start = microtime_float(); + if (!$silent) echo "\nBeginning Reindex of $whatToIndex ...\n"; + if (!$silent && $unindexedOnly) echo "Warning: unindexed only flag set. Will break MySQL 3.x because of sub-selects\n"; + $count = rebuild_index($whatToIndex, $unindexedOnly); + $time_end = microtime_float(); + $time = number_format($time_end - $time_start, 4); + if (!$silent) echo "Index rebuild complete.\n"; + if (!$silent) echo "Attempted to index $count pieces of content\n"; + if (!$silent) echo "(Note: Some content may not be indexable. This is normal)\n"; + if (!$silent) echo "Execution time: $time seconds\n"; + die(); } +} else { + // Don't allow this to be run from the web. + header("location: ../index.php" ); } -$time_start = microtime_float(); -if (!$silent) echo "\nBeginning Reindex of $whatToIndex ...\n"; -if (!$silent && $unindexedOnly) echo "Warning: unindexed only flag set. Will break MySQL 3.x because of sub-selects\n"; -$count = rebuild_index($whatToIndex, $unindexedOnly); -$time_end = microtime_float(); -$time = number_format($time_end - $time_start, 4); -if (!$silent) echo "Index rebuild complete.\n"; -if (!$silent) echo "Attempted to index $count pieces of content\n"; -if (!$silent) echo "(Note: Some content may not be indexable. This is normal)\n"; -if (!$silent) echo "Execution time: $time seconds\n"; -die(); - function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); |
