} else {
return $rt->getFullURL();
}
- }
+ }
return $rt;
}
}
}
/**
- * Get the last N authors
+ * Get the last N authors
* @param int $num Number of revisions to get
* @param string $revLatest The latest rev_id, selected from the master (optional)
* @return array Array of authors, duplicates not removed
'page_namespace' => $this->mTitle->getNamespace(),
'page_title' => $this->mTitle->getDBkey(),
'rev_page = page_id'
- ), $fname, $this->getSelectOptions( array(
+ ), $fname, $this->getSelectOptions( array(
'ORDER BY' => 'rev_timestamp DESC',
'LIMIT' => $num
) )
* $conds may be "*" to copy the whole table
* srcTable may be an array of tables.
*/
- function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = 'Database::insertSelect',
- $options = array() )
+ function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = 'Database::insertSelect',
+ $options = array() )
{
$destTable = $this->tableName( $destTable );
if ( is_array( $options ) ) {
}
if( is_array( $srcTable ) ) {
$srcTable = implode( ',', array_map( array( &$this, 'tableName' ), $srcTable ) );
- } else {
+ } else {
$srcTable = $this->tableName( $srcTable );
}
$sql = "INSERT $options INTO $destTable (" . implode( ',', array_keys( $varMap ) ) . ')' .
- ' SELECT ' . implode( ',', $varMap ) .
+ ' SELECT ' . implode( ',', $varMap ) .
" FROM $srcTable";
if ( $conds != '*' ) {
$sql .= ' WHERE ' . $this->makeList( $conds, LIST_AND );
}
/**
- * Read and execute SQL commands from a file.
+ * Read and execute SQL commands from a file.
* Returns true on success, error string on failure
*/
function sourceFile( $filename ) {
}
// Table prefixes
- $ins = preg_replace_callback( '/\/\*(?:\$wgDBprefix|_)\*\/([a-z_]*)/',
+ $ins = preg_replace_callback( '/\/\*(?:\$wgDBprefix|_)\*\/([a-z_]*)/',
array( &$this, 'tableNameCallback' ), $ins );
return $ins;
}
$wgLocalInterwiki = 'w';
$wgInterwikiExpiry = 10800; # Expiry time for cache of interwiki table
-/** Interwiki caching settings.
+/** Interwiki caching settings.
$wgInterwikiCache specifies path to constant database file
This cdb database is generated by dumpInterwiki from maintenance
and has such key formats:
3 - site levels
$wgInterwikiFallbackSite - if unable to resolve from cache
*/
-$wgInterwikiCache = false;
+$wgInterwikiCache = false;
$wgInterwikiScopes = 3;
$wgInterwikiFallbackSite = 'wiki';
/**
* Number of jobs to perform per request. May be less than one in which case
* jobs are performed probabalistically. If this is zero, jobs will not be done
- * during ordinary apache requests. In this case, maintenance/doJobs.php should
+ * during ordinary apache requests. In this case, maintenance/doJobs.php should
* be run periodically.
*/
$wgJobRunRate = 1;
if ( $difftext ) {
wfIncrStats( 'diff_cache_hit' );
$difftext = $this->localiseLineNumbers( $difftext );
- $difftext .= "\n<!-- diff cache key $key -->\n";
+ $difftext .= "\n<!-- diff cache key $key -->\n";
wfProfileOut( $fname );
return $difftext;
}
dl('php_wikidiff.so');
}
return $wgContLang->unsegementForDiff( wikidiff_do_diff( $otext, $ntext, 2 ) );
- }
+ }
if ( $wgExternalDiffEngine == 'wikidiff2' ) {
# Better external diff engine, the 2 may some day be dropped
* Replace line numbers with the text in the user's language
*/
function localiseLineNumbers( $text ) {
- return preg_replace_callback( '/<!--LINE (\d+)-->/',
+ return preg_replace_callback( '/<!--LINE (\d+)-->/',
array( &$this, 'localiseLineNumbersCb' ), $text );
}
/**
* Store a data item to an external store, identified by a partial URL
- * The protocol part is used to identify the class, the rest is passed to the
- * class itself as a parameter.
+ * The protocol part is used to identify the class, the rest is passed to the
+ * class itself as a parameter.
* Returns the URL of the stored data item, or false on error
*/
function insert( $url, $data ) {
function isLocal() { $this->error(); }
function isTrans() { $this->error(); }
function touchArray( $titles, $timestamp = '' ) { $this->error(); }
- function getText() { $this->error(); }
- function getPartialURL() { $this->error(); }
+ function getText() { $this->error(); }
+ function getPartialURL() { $this->error(); }
function getDBkey() { $this->error(); }
function getNamespace() { $this->error(); }
function getNsText() { $this->error(); }
function getSubjectNsText() { $this->error(); }
- function getInterwiki() { $this->error(); }
- function getFragment() { $this->error(); }
- function getDefaultNamespace() { $this->error(); }
+ function getInterwiki() { $this->error(); }
+ function getFragment() { $this->error(); }
+ function getDefaultNamespace() { $this->error(); }
function getIndexTitle() { $this->error(); }
function getPrefixedDBkey() { $this->error(); }
function getPrefixedText() { $this->error(); }
function getInternalURL() { $this->error(); }
function getEditURL() { $this->error(); }
function getEscapedText() { $this->error(); }
- function isExternal() { $this->error(); }
+ function isExternal() { $this->error(); }
function isSemiProtected() { $this->error(); }
function isProtected() { $this->error(); }
function userIsWatching() { $this->error(); }
}
$delim = !$delim;
}
- // Double the backslashes before the end of the string, because
+ // Double the backslashes before the end of the string, because
// we will soon add a quote
if ( preg_match( '/^(.*?)(\\\\+)$/', $arg, $m ) ) {
$arg = $m[1] . str_replace( '\\', '\\\\', $m[2] );
function wfUrlProtocols() {
global $wgUrlProtocols;
- // Support old-style $wgUrlProtocols strings, for backwards compatibility
+ // Support old-style $wgUrlProtocols strings, for backwards compatibility
// with LocalSettings files from 1.5
if ( is_array( $wgUrlProtocols ) ) {
$protocols = array();
function wfDoUpdates()
{
global $wgPostCommitUpdateList, $wgDeferredUpdateList;
- foreach ( $wgDeferredUpdateList as $update ) {
+ foreach ( $wgDeferredUpdateList as $update ) {
$update->doUpdate();
}
foreach ( $wgPostCommitUpdateList as $update ) {
# Set the referer to $wgTitle, even in command-line mode
# This is useful for interwiki transclusion, where the foreign
# server wants to know what the referring page is.
- # $_SERVER['REQUEST_URI'] gives a less reliable indication of the
+ # $_SERVER['REQUEST_URI'] gives a less reliable indication of the
# referring page.
if ( is_object( $wgTitle ) ) {
curl_setopt( $c, CURLOPT_REFERER, $wgTitle->getFullURL() );
class Job {
var $command,
$title,
- $params,
+ $params,
$id,
- $removeDuplicates,
+ $removeDuplicates,
$error;
/*-------------------------------------------------------------------------
*------------------------------------------------------------------------*/
/**
* Add an array of refreshLinks jobs to the queue
- * @param array $titles Array of title objects.
+ * @param array $titles Array of title objects.
* @static
*/
function queueLinksJobs( $titles ) {
$dbr =& wfGetDB( DB_SLAVE );
// Get a job from the slave
- $row = $dbr->selectRow( 'job', '*', '', $fname,
+ $row = $dbr->selectRow( 'job', '*', '', $fname,
array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 )
);
if ( !$affected ) {
// Failed, someone else beat us to it
// Try getting a random row
- $row = $dbw->selectRow( 'job', array( 'MIN(job_id) as minjob',
+ $row = $dbw->selectRow( 'job', array( 'MIN(job_id) as minjob',
'MAX(job_id) as maxjob' ), '', $fname );
if ( $row === false || is_null( $row->minjob ) || is_null( $row->maxjob ) ) {
// No jobs to get
return false;
}
// Get the random row
- $row = $dbw->selectRow( 'job', '*',
+ $row = $dbw->selectRow( 'job', '*',
array( 'job_id' => mt_rand( $row->minjob, $row->maxjob ) ), $fname );
if ( $row === false ) {
// Random job gone before we got the chance to select it
// Give up
wfProfileOut( $fname );
return false;
- }
+ }
}
// If execution got to here, there's a row in $row that has been deleted from the database
return $s;
} else {
return "{$this->command} {$this->params}";
- }
+ }
}
function getLastError() {
* Some functions to help implement an external link filter for spam control.
*
* TODO: implement the filter. Currently these are just some functions to help
- * maintenance/cleanupSpam.php remove links to a single specified domain. The
- * next thing is to implement functions for checking a given page against a big
+ * maintenance/cleanupSpam.php remove links to a single specified domain. The
+ * next thing is to implement functions for checking a given page against a big
* list of domains.
*
* Another cool thing to do would be a web interface for fast spam removal.
}
/**
- * Make a string to go after an SQL LIKE, which will match the specified
+ * Make a string to go after an SQL LIKE, which will match the specified
* string. There are several kinds of filter entry:
- * *.domain.com - Produces http://com.domain.%, matches domain.com
+ * *.domain.com - Produces http://com.domain.%, matches domain.com
* and www.domain.com
* domain.com - Produces http://com.domain./%, matches domain.com
* or domain.com/ but not www.domain.com
- * *.domain.com/x - Produces http://com.domain.%/x%, matches
+ * *.domain.com/x - Produces http://com.domain.%/x%, matches
* www.domain.com/xy
- * domain.com/x - Produces http://com.domain./x%, matches
+ * domain.com/x - Produces http://com.domain./x%, matches
* domain.com/xy but not www.domain.com/xy
*
* Asterisks in any other location are considered invalid.
$subdomains = false;
}
// No stray asterisks, that could cause confusion
- // It's not simple or efficient to handle it properly so we don't
+ // It's not simple or efficient to handle it properly so we don't
// handle it at all.
if ( strpos( $filterEntry, '*' ) !== false ) {
return false;
* @param string $text Link text
* @param string $query Optional query part
* @param string $trail Optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
+ * be included in the link text. Other characters will be appended after
* the end of the link.
*/
function makeLink( $title, $text = '', $query = '', $trail = '' ) {
* @param string $text Link text
* @param string $query Optional query part
* @param string $trail Optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
+ * be included in the link text. Other characters will be appended after
* the end of the link.
*/
function makeKnownLink( $title, $text = '', $query = '', $trail = '', $prefix = '',$aprops = '') {
* @param string $text Link text
* @param string $query Optional query part
* @param string $trail Optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
+ * be included in the link text. Other characters will be appended after
* the end of the link.
*/
function makeBrokenLink( $title, $text = '', $query = '', $trail = '' ) {
* @param string $text Link text
* @param string $query Optional query part
* @param string $trail Optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
+ * be included in the link text. Other characters will be appended after
* the end of the link.
*/
function makeStubLink( $title, $text = '', $query = '', $trail = '' ) {
}
/**
- * Make a link for a title which may or may not be in the database. If you need to
+ * Make a link for a title which may or may not be in the database. If you need to
* call this lots of times, pre-fill the link cache with a LinkBatch, otherwise each
* call to this will result in a DB query.
*
* @param string $text Link text
* @param string $query Optional query part
* @param string $trail Optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
+ * be included in the link text. Other characters will be appended after
* the end of the link.
*/
function makeLinkObj( $nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
}
/**
- * Make a link for a title which definitely exists. This is faster than makeLinkObj because
+ * Make a link for a title which definitely exists. This is faster than makeLinkObj because
* it doesn't have to do a database query. It's also valid for interwiki titles and special
* pages.
*
* @param string $text Link text
* @param string $query Optional query part
* @param string $trail Optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
+ * be included in the link text. Other characters will be appended after
* the end of the link.
*/
function makeBrokenLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
* @param string $text Link text
* @param string $query Optional query part
* @param string $trail Optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
+ * be included in the link text. Other characters will be appended after
* the end of the link.
*/
function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
$this->mDb->delete( $table, array( $fromField => $this->mId ), $fname );
if ( count( $insertions ) ) {
# The link array was constructed without FOR UPDATE, so there may be collisions
- # This may cause minor link table inconsistencies, which is better than
+ # This may cause minor link table inconsistencies, which is better than
# crippling the site with lock contention.
$this->mDb->insert( $table, $insertions, $fname, array( 'IGNORE' ) );
}
}
/**
- * Given an array of existing external links, returns those links which are not
+ * Given an array of existing external links, returns those links which are not
* in $this and thus should be deleted.
* @access private
*/
}
require_once( 'RecentChange.php' );
- RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '',
+ RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '',
$this->type, $this->action, $this->target, $this->comment, $this->params );
}
return true;
$process = proc_open("$wgTidyBin -config $wgTidyConf $wgTidyOpts$opts", $descriptorspec, $pipes);
if (is_resource($process)) {
// Theoretically, this style of communication could cause a deadlock
- // here. If the stdout buffer fills up, then writes to stdin could
+ // here. If the stdout buffer fills up, then writes to stdin could
// block. This doesn't appear to happen with tidy, because tidy only
- // writes to stdout after it's finished reading from stdin. Search
+ // writes to stdout after it's finished reading from stdin. Search
// for tidyParseStdin and tidySaveStdout in console/tidy.c
fwrite($pipes[0], $text);
fclose($pipes[0]);
/**
* Replace unusual URL escape codes with their equivalent characters
- * @param string
+ * @param string
* @return string
* @static
*/
function replaceUnusualEscapes( $url ) {
- return preg_replace_callback( '/%[0-9A-Fa-f]{2}/',
+ return preg_replace_callback( '/%[0-9A-Fa-f]{2}/',
array( 'Parser', 'replaceUnusualEscapesCallback' ), $url );
}
$fname = 'Parser::braceSubstitution';
wfProfileIn( $fname );
- # Flags
+ # Flags
$found = false; # $text has been filled
$nowiki = false; # wiki markup in $text should be escaped
$noparse = false; # Unsafe HTML tags should not be stripped, etc.
}
/**
- * Fetch the unparsed text of a template and register a reference to it.
+ * Fetch the unparsed text of a template and register a reference to it.
*/
function fetchTemplate( $title ) {
$text = false;
$canonized_headline = preg_replace( '/<.*?' . '>/','',$canonized_headline );
$tocline = trim( $canonized_headline );
# Save headline for section edit hint before it's escaped
- $headline_hint = trim( $canonized_headline );
+ $headline_hint = trim( $canonized_headline );
$canonized_headline = Sanitizer::escapeId( $tocline );
$refers[$headlineCount] = $canonized_headline;
# Signatures
$sigText = $this->getUserSig( $user );
- $text = strtr( $text, array(
+ $text = strtr( $text, array(
'~~~~~' => $d,
'~~~~' => "$sigText $d",
'~~~' => $sigText
$this->mOutput->mCacheTime = -1;
}
- /**#@+
+ /**#@+
* Callback from the Sanitizer for expanding items found in HTML attribute
* values, so they can be safely tested and escaped.
* @param string $text
$oldid = $this->mRequest->getInt( 'oldid' );
switch ( $wgRequest->getText( 'direction' ) ) {
- case 'next':
+ case 'next':
# output next revision, or nothing if there isn't one
if ( $oldid ) {
$oldid = $this->mTitle->getNextRevisionId( $oldid );
}
$oldid = $oldid ? $oldid : -1;
break;
- case 'prev':
+ case 'prev':
# output previous revision, or nothing if there isn't one
if ( ! $oldid ) {
# get the current revision so we can get the penultimate one
$sep = str_replace("_", " ", wfMsgHtml("newtalkseperator"));
$msgs = array();
foreach ($newtalks as $newtalk) {
- $msgs[] = wfElement("a",
+ $msgs[] = wfElement("a",
array('href' => $newtalk["link"]), $newtalk["wiki"]);
}
$parts = implode($sep, $msgs);
$hideliu = $wgRequest->getBool( 'hideliu', $defaults['hideliu'] );
$hidepatrolled = $wgRequest->getBool( 'hidepatrolled', $defaults['hidepatrolled'] );
$hidemyself = $wgRequest->getBool ( 'hidemyself', $defaults['hidemyself'] );
- $from = $wgRequest->getVal( 'from', $defaults['from'] );
+ $from = $wgRequest->getVal( 'from', $defaults['from'] );
# Get query parameters from path
if( $par ) {
array( 'hideliu' => 1-$options['hideliu'] ), $nondefaults);
$patrLink = makeOptionsLink( $showhide[1-$options['hidepatrolled']],
array( 'hidepatrolled' => 1-$options['hidepatrolled'] ), $nondefaults);
- $myselfLink = makeOptionsLink( $showhide[1-$options['hidemyself']],
+ $myselfLink = makeOptionsLink( $showhide[1-$options['hidemyself']],
array( 'hidemyself' => 1-$options['hidemyself'] ), $nondefaults);
$hl = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink, $patrLink, $myselfLink );
$res = $dbr->query( $sql, $fname );
$userRow = $dbr->fetchObject( $res );
$users = $userRow->total;
- }
+ }
$admins = $dbr->selectField( 'user_groups', 'COUNT(*)', array( 'ug_group' => 'sysop' ), $fname );
$numJobs = $dbr->selectField( 'job', 'COUNT(*)', '', $fname );
} else {
$wgOut->errorPage( 'uploadnologin', 'uploadnologintext' );
return;
- }
+ }
# Check blocks
if( $wgUser->isBlocked() ) {
$site = $wgInterwikiFallbackSite;
}
$value = dba_fetch("{$wgDBname}:{$key}", $db);
- if ($value=='' and $wgInterwikiScopes>=3) {
+ if ($value=='' and $wgInterwikiScopes>=3) {
/* try site-level */
$value = dba_fetch("_{$site}:{$key}", $db);
}
- if ($value=='' and $wgInterwikiScopes>=2) {
+ if ($value=='' and $wgInterwikiScopes>=2) {
/* try globals */
$value = dba_fetch("__global:{$key}", $db);
}
if ( $this->isExternal() ) {
$url = $this->getFullURL();
if ( $query ) {
- // This is currently only used for edit section links in the
- // context of interwiki transclusion. In theory we should
+ // This is currently only used for edit section links in the
+ // context of interwiki transclusion. In theory we should
// append the query to the end of any existing query string,
// but interwiki transclusion is already broken in that case.
$url .= "?$query";
continue;
}
- # If there's an initial colon after the interwiki, that also
+ # If there's an initial colon after the interwiki, that also
# resets the default namespace
if ( $t !== '' && $t[0] == ':' ) {
$this->mNamespace = NS_MAIN;
$article = $this->articleFromTitle( $title );
// Namespace might change when using redirects
- if( $action == 'view' && !$request->getVal( 'oldid' ) &&
+ if( $action == 'view' && !$request->getVal( 'oldid' ) &&
$request->getVal( 'redirect' ) != 'no' ) {
$dbr=&wfGetDB(DB_SLAVE);
foreach( $updates as $up ) {
$up->doUpdate();
}
- wfProfileOut( 'MediaWiki::doUpdates' );
+ wfProfileOut( 'MediaWiki::doUpdates' );
}
/**