http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88543
Revision: 88543
Author: reedy
Date: 2011-05-21 20:06:57 +0000 (Sat, 21 May 2011)
Log Message:
-----------
More documentation updates and additions
Getting bored of this tonight now I think...
Modified Paths:
--------------
trunk/phase3/includes/Article.php
trunk/phase3/includes/ProtectionForm.php
trunk/phase3/includes/Sanitizer.php
trunk/phase3/includes/SiteConfiguration.php
trunk/phase3/includes/SiteStats.php
trunk/phase3/includes/Status.php
trunk/phase3/includes/StreamFile.php
Modified: trunk/phase3/includes/Article.php
===================================================================
--- trunk/phase3/includes/Article.php 2011-05-21 19:55:13 UTC (rev 88542)
+++ trunk/phase3/includes/Article.php 2011-05-21 20:06:57 UTC (rev 88543)
@@ -110,7 +110,7 @@
*
* 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() ) {
Modified: trunk/phase3/includes/ProtectionForm.php
===================================================================
--- trunk/phase3/includes/ProtectionForm.php 2011-05-21 19:55:13 UTC (rev
88542)
+++ trunk/phase3/includes/ProtectionForm.php 2011-05-21 20:06:57 UTC (rev
88543)
@@ -147,7 +147,9 @@
/**
* 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' ) {
Modified: trunk/phase3/includes/Sanitizer.php
===================================================================
--- trunk/phase3/includes/Sanitizer.php 2011-05-21 19:55:13 UTC (rev 88542)
+++ trunk/phase3/includes/Sanitizer.php 2011-05-21 20:06:57 UTC (rev 88543)
@@ -792,6 +792,10 @@
return $value;
}
+ /**
+ * @param $matches array
+ * @return String
+ */
static function cssDecodeCallback( $matches ) {
if ( $matches[1] !== '' ) {
// Line continuation
@@ -1093,6 +1097,10 @@
Sanitizer::normalizeCharReferences( $text ) ) );
}
+ /**
+ * @param $text string
+ * @return mixed
+ */
private static function normalizeWhitespace( $text ) {
return preg_replace(
'/\r\n|[\x20\x0d\x0a\x09]/',
@@ -1176,6 +1184,10 @@
}
}
+ /**
+ * @param $codepoint
+ * @return null|string
+ */
static function decCharReference( $codepoint ) {
$point = intval( $codepoint );
if( Sanitizer::validateCodepoint( $point ) ) {
@@ -1185,6 +1197,10 @@
}
}
+ /**
+ * @param $codepoint
+ * @return null|string
+ */
static function hexCharReference( $codepoint ) {
$point = hexdec( $codepoint );
if( Sanitizer::validateCodepoint( $point ) ) {
@@ -1523,6 +1539,10 @@
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().
@@ -1566,6 +1586,10 @@
}
}
+ /**
+ * @param $matches array
+ * @return string
+ */
static function cleanUrlCallback( $matches ) {
return urlencode( $matches[0] );
}
Modified: trunk/phase3/includes/SiteConfiguration.php
===================================================================
--- trunk/phase3/includes/SiteConfiguration.php 2011-05-21 19:55:13 UTC (rev
88542)
+++ trunk/phase3/includes/SiteConfiguration.php 2011-05-21 20:06:57 UTC (rev
88543)
@@ -149,6 +149,11 @@
/**
* 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 ) ) {
@@ -204,7 +209,11 @@
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;
}
@@ -242,6 +251,11 @@
$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 ) ) {
@@ -288,8 +302,9 @@
'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
@@ -339,6 +354,8 @@
/**
* Work out the site and language name from a database name
* @param $db
+ *
+ * @return array
*/
public function siteFromDB( $db ) {
// Allow override
@@ -377,10 +394,14 @@
* 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 );
@@ -395,7 +416,7 @@
return $out;
}
-
+
public function loadFullData() {
if ($this->fullLoadCallback && !$this->fullLoadDone) {
call_user_func( $this->fullLoadCallback, $this );
Modified: trunk/phase3/includes/SiteStats.php
===================================================================
--- trunk/phase3/includes/SiteStats.php 2011-05-21 19:55:13 UTC (rev 88542)
+++ trunk/phase3/includes/SiteStats.php 2011-05-21 20:06:57 UTC (rev 88543)
@@ -13,6 +13,9 @@
self::load( true );
}
+ /**
+ * @param $recache bool
+ */
static function load( $recache = false ) {
if ( self::$loaded && !$recache ) {
return;
@@ -32,6 +35,9 @@
self::$loaded = true;
}
+ /**
+ * @return Bool|ResultWrapper
+ */
static function loadAndLazyInit() {
wfDebug( __METHOD__ . ": reading site_stats from slave\n" );
$row = self::doLoad( wfGetDB( DB_SLAVE ) );
@@ -60,40 +66,65 @@
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;
@@ -124,6 +155,9 @@
return self::$groupMemberCounts[$group];
}
+ /**
+ * @return int
+ */
static function jobs() {
if ( !isset( self::$jobs ) ) {
$dbr = wfGetDB( DB_SLAVE );
@@ -136,6 +170,11 @@
return self::$jobs;
}
+ /**
+ * @param $ns int
+ *
+ * @return int
+ */
static function pagesInNs( $ns ) {
wfProfileIn( __METHOD__ );
if( !isset( self::$pageCount[$ns] ) ) {
@@ -151,7 +190,13 @@
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
@@ -174,7 +219,6 @@
}
}
-
/**
*
*/
@@ -190,6 +234,11 @@
$this->mUsers = $users;
}
+ /**
+ * @param $sql
+ * @param $field
+ * @param $delta
+ */
function appendUpdate( &$sql, $field, $delta ) {
if ( $delta ) {
if ( $sql ) {
@@ -225,6 +274,10 @@
}
}
+ /**
+ * @param $dbw DatabaseBase
+ * @return bool|mixed
+ */
public static function cacheUpdate( $dbw ) {
global $wgActiveUserDays;
$dbr = wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow' )
);
Modified: trunk/phase3/includes/Status.php
===================================================================
--- trunk/phase3/includes/Status.php 2011-05-21 19:55:13 UTC (rev 88542)
+++ trunk/phase3/includes/Status.php 2011-05-21 20:06:57 UTC (rev 88543)
@@ -127,6 +127,10 @@
$this->cleanCallback = false;
}
+ /**
+ * @param $params array
+ * @return array
+ */
protected function cleanParams( $params ) {
if ( !$this->cleanCallback ) {
return $params;
@@ -138,6 +142,10 @@
return $cleanParams;
}
+ /**
+ * @param $item
+ * @return string
+ */
protected function getItemXML( $item ) {
$params = $this->cleanParams( $item['params'] );
$xml = "<{$item['type']}>\n" .
@@ -152,6 +160,7 @@
/**
* Get the error list as XML
+ * @return string
*/
function getXML() {
$xml = "<errors>\n";
@@ -324,6 +333,8 @@
* 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;
Modified: trunk/phase3/includes/StreamFile.php
===================================================================
--- trunk/phase3/includes/StreamFile.php 2011-05-21 19:55:13 UTC (rev
88542)
+++ trunk/phase3/includes/StreamFile.php 2011-05-21 20:06:57 UTC (rev
88543)
@@ -63,7 +63,11 @@
readfile( $fname );
}
-/** */
+/**
+ * @param $filename string
+ * @param $safe bool
+ * @return null|string
+ */
function wfGetType( $filename, $safe = true ) {
global $wgTrivialMimeDetection;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs