3 * Script for periodic off-peak updating of the search index
5 * Usage: php updateSearchIndex.php [-s START] [-e END] [-p POSFILE] [-l LOCKTIME] [-q]
6 * Where START is the starting timestamp
7 * END is the ending timestamp
8 * POSFILE is a file to load timestamps from and save them to, searchUpdate.pos by default
9 * LOCKTIME is how long the searchindex and cur tables will be locked for
13 * @ingroup Maintenance
17 $optionsWithArgs = array( 's', 'e', 'p' );
19 require_once( 'commandLine.inc' );
20 require_once( 'updateSearchIndex.inc' );
22 if ( isset( $options['p'] ) ) {
23 $posFile = $options['p'];
25 $posFile = 'searchUpdate.pos';
28 if ( isset( $options['e'] ) ) {
31 $end = wfTimestampNow();
34 if ( isset( $options['s'] ) ) {
35 $start = $options['s'];
37 $start = @file_get_contents
( $posFile );
39 $start = wfTimestamp( TS_MW
, time() - 86400 );
43 if ( isset( $options['l'] ) ) {
44 $lockTime = $options['l'];
49 $quiet = (bool)(@$options['q']);
51 updateSearchIndex( $start, $end, $lockTime, $quiet );
53 $file = fopen( $posFile, 'w' );
54 fwrite( $file, $end );