Getting bored of this tonight now I think...
*
* The target will be fetched from the redirect table if possible.
* If this page doesn't have an entry there, call insertRedirect()
- * @return mixed Title object, or null if this page is not a redirect
+ * @return Title|mixed object, or null if this page is not a redirect
*/
public function getRedirectTarget() {
if ( !$this->mTitle->isRedirect() ) {
/**
* Get the expiry time for a given action, by combining the relevant inputs.
*
- * @return 14-char timestamp or "infinity", or false if the input was invalid
+ * @param $action string
+ *
+ * @return string 14-char timestamp or "infinity", or false if the input was invalid
*/
function getExpiry( $action ) {
if ( $this->mExpirySelection[$action] == 'existing' ) {
return $value;
}
+ /**
+ * @param $matches array
+ * @return String
+ */
static function cssDecodeCallback( $matches ) {
if ( $matches[1] !== '' ) {
// Line continuation
Sanitizer::normalizeCharReferences( $text ) ) );
}
+ /**
+ * @param $text string
+ * @return mixed
+ */
private static function normalizeWhitespace( $text ) {
return preg_replace(
'/\r\n|[\x20\x0d\x0a\x09]/',
}
}
+ /**
+ * @param $codepoint
+ * @return null|string
+ */
static function decCharReference( $codepoint ) {
$point = intval( $codepoint );
if( Sanitizer::validateCodepoint( $point ) ) {
}
}
+ /**
+ * @param $codepoint
+ * @return null|string
+ */
static function hexCharReference( $codepoint ) {
$point = hexdec( $codepoint );
if( Sanitizer::validateCodepoint( $point ) ) {
return $out;
}
+ /**
+ * @param $url string
+ * @return mixed|string
+ */
static function cleanUrl( $url ) {
# Normalize any HTML entities in input. They will be
# re-escaped by makeExternalLink().
}
}
+ /**
+ * @param $matches array
+ * @return string
+ */
static function cleanUrlCallback( $matches ) {
return urlencode( $matches[0] );
}
/**
* Type-safe string replace; won't do replacements on non-strings
* private?
+ *
+ * @param $from
+ * @param $to
+ * @param $in
+ * @return string
*/
function doReplace( $from, $to, $in ) {
if( is_string( $in ) ) {
return (bool)($this->get( $setting, $wiki, $suffix, array(), $wikiTags ) );
}
- /** Retrieves an array of local databases */
+ /**
+ * Retrieves an array of local databases
+ *
+ * @return array
+ */
function &getLocalDatabases() {
return $this->wikis;
}
$this->extractGlobalSetting( $setting, $wiki, $params );
}
+ /**
+ * @param $setting string
+ * @param $wiki string
+ * @param $params array
+ */
public function extractGlobalSetting( $setting, $wiki, $params ) {
$value = $this->getSetting( $setting, $wiki, $params );
if ( !is_null( $value ) ) {
'params' => array(),
);
- if( !is_callable( $this->siteParamsCallback ) )
+ if( !is_callable( $this->siteParamsCallback ) ) {
return $default;
+ }
$ret = call_user_func_array( $this->siteParamsCallback, array( $this, $wiki ) );
# Validate the returned value
/**
* Work out the site and language name from a database name
* @param $db
+ *
+ * @return array
*/
public function siteFromDB( $db ) {
// Allow override
* On encountering duplicate keys, merge the two, but ONLY if they're arrays.
* PHP's array_merge_recursive() merges ANY duplicate values into arrays,
* which is not fun
+ *
+ * @param $array1 array
+ *
+ * @return array
*/
static function arrayMerge( $array1/* ... */ ) {
$out = $array1;
- for( $i=1; $i < func_num_args(); $i++ ) {
+ for( $i = 1; $i < func_num_args(); $i++ ) {
foreach( func_get_arg( $i ) as $key => $value ) {
if ( isset($out[$key]) && is_array($out[$key]) && is_array($value) ) {
$out[$key] = self::arrayMerge( $out[$key], $value );
return $out;
}
-
+
public function loadFullData() {
if ($this->fullLoadCallback && !$this->fullLoadDone) {
call_user_func( $this->fullLoadCallback, $this );
self::load( true );
}
+ /**
+ * @param $recache bool
+ */
static function load( $recache = false ) {
if ( self::$loaded && !$recache ) {
return;
self::$loaded = true;
}
+ /**
+ * @return Bool|ResultWrapper
+ */
static function loadAndLazyInit() {
wfDebug( __METHOD__ . ": reading site_stats from slave\n" );
$row = self::doLoad( wfGetDB( DB_SLAVE ) );
return $row;
}
+ /**
+ * @param $db DatabaseBase
+ * @return Bool|ResultWrapper
+ */
static function doLoad( $db ) {
return $db->selectRow( 'site_stats', '*', false, __METHOD__ );
}
+ /**
+ * @return int
+ */
static function views() {
self::load();
return self::$row->ss_total_views;
}
+ /**
+ * @return int
+ */
static function edits() {
self::load();
return self::$row->ss_total_edits;
}
+ /**
+ * @return int
+ */
static function articles() {
self::load();
return self::$row->ss_good_articles;
}
+ /**
+ * @return int
+ */
static function pages() {
self::load();
return self::$row->ss_total_pages;
}
+ /**
+ * @return int
+ */
static function users() {
self::load();
return self::$row->ss_users;
}
+ /**
+ * @return int
+ */
static function activeUsers() {
self::load();
return self::$row->ss_active_users;
}
+ /**
+ * @return int
+ */
static function images() {
self::load();
return self::$row->ss_images;
return self::$groupMemberCounts[$group];
}
+ /**
+ * @return int
+ */
static function jobs() {
if ( !isset( self::$jobs ) ) {
$dbr = wfGetDB( DB_SLAVE );
return self::$jobs;
}
+ /**
+ * @param $ns int
+ *
+ * @return int
+ */
static function pagesInNs( $ns ) {
wfProfileIn( __METHOD__ );
if( !isset( self::$pageCount[$ns] ) ) {
return $pageCount[$ns];
}
- /** Is the provided row of site stats sane, or should it be regenerated? */
+ /**
+ * Is the provided row of site stats sane, or should it be regenerated?
+ *
+ * @param $row
+ *
+ * @return bool
+ */
private static function isSane( $row ) {
if(
$row === false
}
}
-
/**
*
*/
$this->mUsers = $users;
}
+ /**
+ * @param $sql
+ * @param $field
+ * @param $delta
+ */
function appendUpdate( &$sql, $field, $delta ) {
if ( $delta ) {
if ( $sql ) {
}
}
+ /**
+ * @param $dbw DatabaseBase
+ * @return bool|mixed
+ */
public static function cacheUpdate( $dbw ) {
global $wgActiveUserDays;
$dbr = wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow' ) );
$this->cleanCallback = false;
}
+ /**
+ * @param $params array
+ * @return array
+ */
protected function cleanParams( $params ) {
if ( !$this->cleanCallback ) {
return $params;
return $cleanParams;
}
+ /**
+ * @param $item
+ * @return string
+ */
protected function getItemXML( $item ) {
$params = $this->cleanParams( $item['params'] );
$xml = "<{$item['type']}>\n" .
/**
* Get the error list as XML
+ * @return string
*/
function getXML() {
$xml = "<errors>\n";
* destination message, but keep the same parameters as in the original error.
*
* Return true if the replacement was done, false otherwise.
+ *
+ * @return bool
*/
function replaceMessage( $source, $dest ) {
$replaced = false;
readfile( $fname );
}
-/** */
+/**
+ * @param $filename string
+ * @param $safe bool
+ * @return null|string
+ */
function wfGetType( $filename, $safe = true ) {
global $wgTrivialMimeDetection;