Use Doxygen @addtogroup instead of phpdoc @package && @subpackage
[lhc/web/wiklou.git] / maintenance / updateSearchIndex.php
1 <?php
2 /**
3 * Script for periodic off-peak updating of the search index
4 *
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
11 *
12 * @addtogroup Maintenance
13 */
14
15 /** */
16 $optionsWithArgs = array( 's', 'e', 'p' );
17
18 require_once( 'commandLine.inc' );
19 require_once( 'updateSearchIndex.inc' );
20
21 if ( isset( $options['p'] ) ) {
22 $posFile = $options['p'];
23 } else {
24 $posFile = 'searchUpdate.pos';
25 }
26
27 if ( isset( $options['e'] ) ) {
28 $end = $options['e'];
29 } else {
30 $end = wfTimestampNow();
31 }
32
33 if ( isset( $options['s'] ) ) {
34 $start = $options['s'];
35 } else {
36 $start = @file_get_contents( $posFile );
37 if ( !$start ) {
38 $start = wfTimestamp( TS_MW, time() - 86400 );
39 }
40 }
41
42 if ( isset( $options['l'] ) ) {
43 $lockTime = $options['l'];
44 } else {
45 $lockTime = 20;
46 }
47
48 $quiet = (bool)(@$options['q']);
49
50 updateSearchIndex( $start, $end, $lockTime, $quiet );
51
52 $file = fopen( $posFile, 'w' );
53 fwrite( $file, $end );
54 fclose( $file );
55
56 ?>