Go to the documentation of this file.
31 require_once __DIR__ .
'/Maintenance.php';
41 parent::__construct();
42 $this->mDescription =
"Script for periodic off-peak updating of the search index";
43 $this->
addOption(
's',
'starting timestamp',
false,
true );
44 $this->
addOption(
'e',
'Ending timestamp',
false,
true );
45 $this->
addOption(
'p',
'File for saving/loading timestamps, searchUpdate.WIKI_ID.pos by default',
false,
true );
46 $this->
addOption(
'l',
'How long the searchindex and revision tables will be locked for',
false,
true );
54 $posFile = $this->
getOption(
'p',
'searchUpdate.' . wfWikiId() .
'.pos' );
58 } elseif ( is_readable(
'searchUpdate.pos' ) ) {
59 # B/c to the old position file name which was hardcoded
60 # We can safely delete the file when we're done though.
61 $start = file_get_contents(
'searchUpdate.pos' );
62 unlink(
'searchUpdate.pos' );
63 } elseif ( is_readable( $posFile ) ) {
64 $start = file_get_contents( $posFile );
71 if ( is_writable( dirname( realpath( $posFile ) ) ) ) {
72 $file = fopen( $posFile,
'w' );
73 if (
$file !==
false ) {
74 fwrite(
$file, $end );
77 $this->
error(
"*** Couldn't write to the $posFile!\n" );
80 $this->
error(
"*** Couldn't write to the $posFile!\n" );
85 global $wgDisableSearchUpdate;
87 $wgDisableSearchUpdate =
false;
90 $recentchanges = $dbw->tableName(
'recentchanges' );
92 $this->
output(
"Updating searchindex between $start and $end\n" );
94 # Select entries from recentchanges which are on top and between the specified times
95 $start = $dbw->timestamp( $start );
96 $end = $dbw->timestamp( $end );
98 $page = $dbw->tableName(
'page' );
99 $sql =
"SELECT rc_cur_id FROM $recentchanges
100 JOIN $page ON rc_cur_id=page_id AND rc_this_oldid=page_latest
101 WHERE rc_type != " .
RC_LOG .
" AND rc_timestamp BETWEEN '$start' AND '$end'";
102 $res = $dbw->query( $sql, __METHOD__ );
106 $this->
output(
"Done\n" );
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
searchIndexUpdateCallback( $dbw, $row)
addOption( $name, $description, $required=false, $withArg=false, $shortName=false)
Add a parameter to the script.
require_once RUN_MAINTENANCE_IF_MAIN
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
updateSearchIndex( $maxLockTime, $callback, $dbw, $results)
Perform a search index update with locking.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
execute()
Do the actual work.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
updateSearchIndexForPage( $dbw, $pageId)
Update the searchindex table for a given pageid.
if(PHP_SAPI !='cli') $file
getOption( $name, $default=null)
Get an option, or return the default.
doUpdateSearchIndex( $start, $end, $maxLockTime)
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
__construct()
Default constructor.
hasOption( $name)
Checks to see if a particular param exists.
Maintenance script for periodic off-peak updating of the search index.