Article validation code (tab fix)
[mediawiki.git] / maintenance / updateSearchIndex.php
blob75b789e785fa2cfd00bef09ac9299e485b6d8e95
1 <?php
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
10 # -q means quiet
12 $optionsWithArgs = array( 's', 'e', 'p' );
14 require_once( 'commandLine.inc' );
15 require_once( 'updateSearchIndex.inc' );
17 if ( isset( $options['p'] ) ) {
18 $posFile = $options['p'];
19 } else {
20 $posFile = 'searchUpdate.pos';
23 if ( isset( $options['e'] ) ) {
24 $end = $options['e'];
25 } else {
26 $end = wfTimestampNow();
29 if ( isset( $options['s'] ) ) {
30 $start = $options['s'];
31 } else {
32 $start = @file_get_contents( $posFile );
33 if ( !$start ) {
34 $start = wfUnix2Timestamp( time() - 86400 );
38 if ( isset( $options['l'] ) ) {
39 $lockTime = $options['l'];
40 } else {
41 $lockTime = 20;
44 $quiet = (bool)(@$options['q']);
46 updateSearchIndex( $start, $end, $lockTime, $quiet );
48 $file = fopen( $posFile, 'w' );
49 fwrite( $file, $end );
50 fclose( $file );