http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89047
Revision: 89047
Author: reedy
Date: 2011-05-28 17:18:50 +0000 (Sat, 28 May 2011)
Log Message:
-----------
And more documentation. Yaaaay
Modified Paths:
--------------
trunk/phase3/includes/Autopromote.php
trunk/phase3/includes/Cdb_PHP.php
trunk/phase3/includes/HistoryBlob.php
trunk/phase3/includes/ImageFunctions.php
trunk/phase3/includes/OutputHandler.php
trunk/phase3/includes/StreamFile.php
trunk/phase3/includes/ZhClient.php
trunk/phase3/includes/filerepo/FileRepoStatus.php
trunk/phase3/includes/media/IPTC.php
trunk/phase3/includes/media/Tiff.php
trunk/phase3/includes/objectcache/MultiWriteBagOStuff.php
trunk/phase3/includes/objectcache/ObjectCache.php
trunk/phase3/includes/parser/Parser.php
trunk/phase3/includes/parser/Preprocessor.php
trunk/phase3/includes/specials/SpecialListredirects.php
Modified: trunk/phase3/includes/Autopromote.php
===================================================================
--- trunk/phase3/includes/Autopromote.php 2011-05-28 17:04:13 UTC (rev
89046)
+++ trunk/phase3/includes/Autopromote.php 2011-05-28 17:18:50 UTC (rev
89047)
@@ -8,7 +8,7 @@
/**
* Get the groups for the given user based on $wgAutopromote.
*
- * @param $user The user to get the groups for
+ * @param $user User The user to get the groups for
* @return array Array of groups to promote to.
*/
public static function getAutopromoteGroups( User $user ) {
Modified: trunk/phase3/includes/Cdb_PHP.php
===================================================================
--- trunk/phase3/includes/Cdb_PHP.php 2011-05-28 17:04:13 UTC (rev 89046)
+++ trunk/phase3/includes/Cdb_PHP.php 2011-05-28 17:18:50 UTC (rev 89047)
@@ -16,6 +16,7 @@
/**
* Take a modulo of a signed integer as if it were an unsigned integer.
* $b must be less than 0x40000000 and greater than 0
+ * @return int
*/
public static function unsignedMod( $a, $b ) {
if ( $a & 0x80000000 ) {
@@ -25,9 +26,12 @@
return $a % $b;
}
}
-
+
/**
* Shift a signed integer right as if it were unsigned
+ * @param $a
+ * @param $b
+ * @return int
*/
public static function unsignedShiftRight( $a, $b ) {
if ( $b == 0 ) {
@@ -42,6 +46,9 @@
/**
* The CDB hash function.
+ *
+ * @param $s
+ * @return
*/
public static function hash( $s ) {
$h = 5381;
@@ -103,8 +110,9 @@
}
function close() {
- if( isset($this->handle) )
+ if( isset( $this->handle ) ) {
fclose( $this->handle );
+ }
unset( $this->handle );
}
@@ -117,6 +125,11 @@
}
}
+ /**
+ * @param $key
+ * @param $pos
+ * @return bool
+ */
protected function match( $key, $pos ) {
$buf = $this->read( strlen( $key ), $pos );
return $buf === $key;
@@ -126,6 +139,12 @@
$this->loop = 0;
}
+ /**
+ * @throws MWException
+ * @param $length
+ * @param $pos
+ * @return string
+ */
protected function read( $length, $pos ) {
if ( fseek( $this->handle, $pos ) == -1 ) {
// This can easily happen if the internal pointers are
incorrect
@@ -145,6 +164,8 @@
/**
* Unpack an unsigned integer and throw an exception if it needs more
than 31 bits
+ * @param $s
+ * @return
*/
protected function unpack31( $s ) {
$data = unpack( 'V', $s );
@@ -156,12 +177,18 @@
/**
* Unpack a 32-bit signed integer
+ * @param $s
+ * @return int
*/
protected function unpackSigned( $s ) {
$data = unpack( 'va/vb', $s );
return $data['a'] | ( $data['b'] << 16 );
}
+ /**
+ * @param $key
+ * @return bool
+ */
protected function findNext( $key ) {
if ( !$this->loop ) {
$u = CdbFunctions::hash( $key );
@@ -204,6 +231,10 @@
return false;
}
+ /**
+ * @param $key
+ * @return bool
+ */
protected function find( $key ) {
$this->findStart();
return $this->findNext( $key );
@@ -240,6 +271,11 @@
}
}
+ /**
+ * @param $key
+ * @param $value
+ * @return
+ */
public function set( $key, $value ) {
if ( strval( $key ) === '' ) {
// DBA cross-check hack
@@ -251,10 +287,14 @@
$this->addend( strlen( $key ), strlen( $value ),
CdbFunctions::hash( $key ) );
}
+ /**
+ * @throws MWException
+ */
public function close() {
$this->finish();
- if( isset($this->handle) )
+ if( isset($this->handle) ) {
fclose( $this->handle );
+ }
if ( wfIsWindows() && file_exists($this->realFileName) ) {
unlink( $this->realFileName );
}
@@ -264,6 +304,10 @@
unset( $this->handle );
}
+ /**
+ * @throws MWException
+ * @param $buf
+ */
protected function write( $buf ) {
$len = fwrite( $this->handle, $buf );
if ( $len !== strlen( $buf ) ) {
@@ -271,6 +315,10 @@
}
}
+ /**
+ * @throws MWException
+ * @param $len
+ */
protected function posplus( $len ) {
$newpos = $this->pos + $len;
if ( $newpos > 0x7fffffff ) {
@@ -291,6 +339,11 @@
$this->posplus( $datalen );
}
+ /**
+ * @throws MWException
+ * @param $keylen
+ * @param $datalen
+ */
protected function addbegin( $keylen, $datalen ) {
if ( $keylen > 0x7fffffff ) {
throw new MWException( __METHOD__.': key length too
long' );
Modified: trunk/phase3/includes/HistoryBlob.php
===================================================================
--- trunk/phase3/includes/HistoryBlob.php 2011-05-28 17:04:13 UTC (rev
89046)
+++ trunk/phase3/includes/HistoryBlob.php 2011-05-28 17:18:50 UTC (rev
89047)
@@ -12,6 +12,8 @@
* You must call setLocation() on the stub object before storing it to
the
* database
*
+ * @param $text string
+ *
* @return String: the key for getItem()
*/
function addItem( $text );
@@ -19,6 +21,8 @@
/**
* Get item by key, or false if the key is not present
*
+ * @param $key string
+ *
* @return String or false
*/
function getItem( $key );
@@ -30,6 +34,8 @@
* be other revisions in the same object.
*
* Default text is not required for two-part external storage URLs.
+ *
+ * @param $text string
*/
function setText( $text );
@@ -59,6 +65,10 @@
}
}
+ /**
+ * @param $text string
+ * @return string
+ */
public function addItem( $text ) {
$this->uncompress();
$hash = md5( $text );
@@ -69,6 +79,10 @@
return $hash;
}
+ /**
+ * @param $hash string
+ * @return array|bool
+ */
public function getItem( $hash ) {
$this->uncompress();
if ( array_key_exists( $hash, $this->mItems ) ) {
@@ -78,11 +92,18 @@
}
}
+ /**
+ * @param $text string
+ * @return void
+ */
public function setText( $text ) {
$this->uncompress();
$this->mDefaultHash = $this->addItem( $text );
}
+ /**
+ * @return array|bool
+ */
public function getText() {
$this->uncompress();
return $this->getItem( $this->mDefaultHash );
@@ -90,6 +111,8 @@
/**
* Remove an item
+ *
+ * @param $hash string
*/
public function removeItem( $hash ) {
$this->mSize -= strlen( $this->mItems[$hash] );
@@ -116,7 +139,9 @@
}
}
-
+ /**
+ * @return array
+ */
function __sleep() {
$this->compress();
return array( 'mVersion', 'mCompressed', 'mItems',
'mDefaultHash' );
@@ -129,6 +154,8 @@
/**
* Helper function for compression jobs
* Returns true until the object is "full" and ready to be committed
+ *
+ * @return bool
*/
public function isHappy() {
return $this->mSize < $this->mMaxSize
@@ -137,8 +164,6 @@
}
-
-
/**
* Pointer object for an item within a CGZ blob stored in the text table.
*/
@@ -183,6 +208,9 @@
return $this->mRef;
}
+ /**
+ * @return string
+ */
function getText() {
$fname = 'HistoryBlobStub::getText';
@@ -198,11 +226,11 @@
if( in_array( 'external', $flags ) ) {
$url=$row->old_text;
@list( /* $proto */
,$path)=explode('://',$url,2);
- if ($path=="") {
+ if ( $path == "" ) {
wfProfileOut( $fname );
return false;
}
-
$row->old_text=ExternalStore::fetchFromUrl($url);
+ $row->old_text =
ExternalStore::fetchFromUrl($url);
}
if( !in_array( 'object', $flags ) ) {
@@ -232,6 +260,8 @@
/**
* Get the content hash
+ *
+ * @return string
*/
function getHash() {
return $this->mHash;
@@ -265,6 +295,9 @@
$this->mCurId = $id;
}
+ /**
+ * @return string|false
+ */
function getText() {
$dbr = wfGetDB( DB_SLAVE );
$row = $dbr->selectRow( 'cur', array( 'cur_text' ), array(
'cur_id' => $this->mCurId ) );
@@ -336,6 +369,11 @@
}
}
+ /**
+ * @throws MWException
+ * @param $text string
+ * @return int
+ */
function addItem( $text ) {
if ( $this->mFrozen ) {
throw new MWException( __METHOD__.": Cannot add more
items after sleep/wakeup" );
@@ -347,18 +385,31 @@
return count( $this->mItems ) - 1;
}
+ /**
+ * @param $key string
+ * @return string
+ */
function getItem( $key ) {
return $this->mItems[$key];
}
+ /**
+ * @param $text string
+ */
function setText( $text ) {
$this->mDefaultKey = $this->addItem( $text );
}
+ /**
+ * @return string
+ */
function getText() {
return $this->getItem( $this->mDefaultKey );
}
+ /**
+ * @throws MWException
+ */
function compress() {
if ( !function_exists( 'xdiff_string_rabdiff' ) ){
throw new MWException( "Need xdiff 1.5+ support to
write DiffHistoryBlob\n" );
Modified: trunk/phase3/includes/ImageFunctions.php
===================================================================
--- trunk/phase3/includes/ImageFunctions.php 2011-05-28 17:04:13 UTC (rev
89046)
+++ trunk/phase3/includes/ImageFunctions.php 2011-05-28 17:18:50 UTC (rev
89047)
@@ -15,7 +15,7 @@
* i.e. articles where the image may occur inline.
*
* @param $name string the image name to check
- * @param $contextTitle Title: the page on which the image occurs, if known
+ * @param $contextTitle Title the page on which the image occurs, if known
* @return bool
*/
function wfIsBadImage( $name, $contextTitle = false ) {
Modified: trunk/phase3/includes/OutputHandler.php
===================================================================
--- trunk/phase3/includes/OutputHandler.php 2011-05-28 17:04:13 UTC (rev
89046)
+++ trunk/phase3/includes/OutputHandler.php 2011-05-28 17:18:50 UTC (rev
89047)
@@ -7,7 +7,9 @@
/**
* Standard output handler for use with ob_start
- *
+ *
+ * @param $s string
+ *
* @return string
*/
function wfOutputHandler( $s ) {
Modified: trunk/phase3/includes/StreamFile.php
===================================================================
--- trunk/phase3/includes/StreamFile.php 2011-05-28 17:04:13 UTC (rev
89046)
+++ trunk/phase3/includes/StreamFile.php 2011-05-28 17:18:50 UTC (rev
89047)
@@ -5,7 +5,10 @@
* @file
*/
-/** */
+/**
+ * @param $fname string
+ * @param $headers array
+ */
function wfStreamFile( $fname, $headers = array() ) {
$stat = @stat( $fname );
if ( !$stat ) {
Modified: trunk/phase3/includes/ZhClient.php
===================================================================
--- trunk/phase3/includes/ZhClient.php 2011-05-28 17:04:13 UTC (rev 89046)
+++ trunk/phase3/includes/ZhClient.php 2011-05-28 17:18:50 UTC (rev 89047)
@@ -19,6 +19,8 @@
/**
* Check if connection to zhdaemon is successful
+ *
+ * @return bool
*/
function isconnected() {
return $this->mConnected;
@@ -28,6 +30,8 @@
* Establish conncetion
*
* @access private
+ *
+ * @return bool
*/
function connect() {
wfSuppressWarnings();
Modified: trunk/phase3/includes/filerepo/FileRepoStatus.php
===================================================================
--- trunk/phase3/includes/filerepo/FileRepoStatus.php 2011-05-28 17:04:13 UTC
(rev 89046)
+++ trunk/phase3/includes/filerepo/FileRepoStatus.php 2011-05-28 17:18:50 UTC
(rev 89047)
@@ -13,6 +13,10 @@
class FileRepoStatus extends Status {
/**
* Factory function for fatal errors
+ *
+ * @param $repo FileRepo
+ *
+ * @return FileRepoStatus
*/
static function newFatal( $repo /*, parameters...*/ ) {
$params = array_slice( func_get_args(), 1 );
@@ -22,6 +26,11 @@
return $result;
}
+ /**
+ * @param $repo FileRepo
+ * @param $value
+ * @return FileRepoStatus
+ */
static function newGood( $repo = false, $value = null ) {
$result = new self( $repo );
$result->value = $value;
Modified: trunk/phase3/includes/media/IPTC.php
===================================================================
--- trunk/phase3/includes/media/IPTC.php 2011-05-28 17:04:13 UTC (rev
89046)
+++ trunk/phase3/includes/media/IPTC.php 2011-05-28 17:18:50 UTC (rev
89047)
@@ -12,7 +12,7 @@
*
* @see http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf
*
- * @param String $data app13 block from jpeg containing iptc/iim data
+ * @param $rawData String app13 block from jpeg containing iptc/iim data
* @return Array iptc metadata array
*/
static function parse( $rawData ) {
Modified: trunk/phase3/includes/media/Tiff.php
===================================================================
--- trunk/phase3/includes/media/Tiff.php 2011-05-28 17:04:13 UTC (rev
89046)
+++ trunk/phase3/includes/media/Tiff.php 2011-05-28 17:18:50 UTC (rev
89047)
@@ -16,6 +16,8 @@
/**
* Conversion to PNG for inline display can be disabled here...
* Note scaling should work with ImageMagick, but may not with GD
scaling.
+ *
+ * @return bool
*/
function canRender( $file ) {
global $wgTiffThumbnailType;
@@ -25,29 +27,42 @@
/**
* Browsers don't support TIFF inline generally...
* For inline display, we need to convert to PNG.
+ *
+ * @return bool
*/
function mustRender( $file ) {
return true;
}
+ /**
+ * @param $ext
+ * @param $mime
+ * @param null $params
+ * @return bool
+ */
function getThumbType( $ext, $mime, $params = null ) {
global $wgTiffThumbnailType;
return $wgTiffThumbnailType;
}
- function getMetadata( $image, $filename ) {
- global $wgShowEXIF;
- if ( $wgShowEXIF && file_exists( $filename ) ) {
- $exif = new Exif( $filename );
- $data = $exif->getFilteredData();
- if ( $data ) {
- $data['MEDIAWIKI_EXIF_VERSION'] =
Exif::version();
- return serialize( $data );
- } else {
- return JpegOrTiffHandler::BROKEN_FILE;
- }
- } else {
- return '';
- }
- }
+ /**
+ * @param $image
+ * @param $filename
+ * @return string
+ */
+ function getMetadata( $image, $filename ) {
+ global $wgShowEXIF;
+ if ( $wgShowEXIF && file_exists( $filename ) ) {
+ $exif = new Exif( $filename );
+ $data = $exif->getFilteredData();
+ if ( $data ) {
+ $data['MEDIAWIKI_EXIF_VERSION'] =
Exif::version();
+ return serialize( $data );
+ } else {
+ return JpegOrTiffHandler::BROKEN_FILE;
+ }
+ } else {
+ return '';
+ }
+ }
}
Modified: trunk/phase3/includes/objectcache/MultiWriteBagOStuff.php
===================================================================
--- trunk/phase3/includes/objectcache/MultiWriteBagOStuff.php 2011-05-28
17:04:13 UTC (rev 89046)
+++ trunk/phase3/includes/objectcache/MultiWriteBagOStuff.php 2011-05-28
17:18:50 UTC (rev 89047)
@@ -14,6 +14,8 @@
* - caches: This should have a numbered array of cache parameter
* structures, in the style required by $wgObjectCaches.
See
* the documentation of $wgObjectCaches for more detail.
+ *
+ * @param $params array
*/
public function __construct( $params ) {
if ( !isset( $params['caches'] ) ) {
Modified: trunk/phase3/includes/objectcache/ObjectCache.php
===================================================================
--- trunk/phase3/includes/objectcache/ObjectCache.php 2011-05-28 17:04:13 UTC
(rev 89046)
+++ trunk/phase3/includes/objectcache/ObjectCache.php 2011-05-28 17:18:50 UTC
(rev 89047)
@@ -10,6 +10,10 @@
/**
* Get a cached instance of the specified type of cache object.
+ *
+ * @param $id
+ *
+ * @return object
*/
static function getInstance( $id ) {
if ( isset( self::$instances[$id] ) ) {
@@ -44,6 +48,8 @@
/**
* Create a new cache object from parameters
+ *
+ * @param $params array
*/
static function newFromParams( $params ) {
if ( isset( $params['factory'] ) ) {
@@ -94,6 +100,10 @@
* Factory function that creates a memcached client object.
* The idea of this is that it might eventually detect and
automatically
* support the PECL extension, assuming someone can get it to compile.
+ *
+ * @param $params array
+ *
+ * @return MemcachedPhpBagOStuff
*/
static function newMemcached( $params ) {
return new MemcachedPhpBagOStuff( $params );
Modified: trunk/phase3/includes/parser/Parser.php
===================================================================
--- trunk/phase3/includes/parser/Parser.php 2011-05-28 17:04:13 UTC (rev
89046)
+++ trunk/phase3/includes/parser/Parser.php 2011-05-28 17:18:50 UTC (rev
89047)
@@ -111,6 +111,10 @@
var $mFirstCall = true;
# Initialised by initialiseVariables()
+
+ /**
+ * @var MagicWordArray
+ */
var $mVariables;
/**
@@ -169,6 +173,11 @@
var $mRevIdForTs; # The revision ID which was used to fetch the
timestamp
/**
+ * @var string
+ */
+ var $mUniqPrefix;
+
+ /**
* Constructor
*/
public function __construct( $conf = array() ) {
@@ -507,6 +516,8 @@
/**
* Get a random string
+ *
+ * @return string
*/
static public function getRandomString() {
return dechex( mt_rand( 0, 0x7fffffff ) ) . dechex( mt_rand( 0,
0x7fffffff ) );
@@ -542,6 +553,8 @@
/**
* Set the context title
+ *
+ * @param $t Title
*/
function setTitle( $t ) {
if ( !$t || $t instanceof FakeTitle ) {
@@ -630,10 +643,16 @@
return wfSetVar( $this->mOptions, $x );
}
+ /**
+ * @return int
+ */
function nextLinkID() {
return $this->mLinkID++;
}
+ /**
+ * @param $id int
+ */
function setLinkID( $id ) {
$this->mLinkID = $id;
}
@@ -689,10 +708,10 @@
* array( 'param' => 'x' ),
* '<element param="x">tag content</element>' ) )
*
- * @param $elements list of element names. Comments are always
extracted.
- * @param $text Source text string.
- * @param $matches Out parameter, Array: extracted tags
- * @param $uniq_prefix
+ * @param $elements array list of element names. Comments are always
extracted.
+ * @param $text string Source text string.
+ * @param $matches array Out parameter, Array: extracted tags
+ * @param $uniq_prefix string
* @return String: stripped text
*/
public static function extractTagsAndParams( $elements, $text,
&$matches, $uniq_prefix = '' ) {
@@ -759,6 +778,8 @@
/**
* Get a list of strippable XML-like elements
+ *
+ * @return array
*/
function getStripList() {
return $this->mStripList;
@@ -960,6 +981,9 @@
* is repeated twice.
*
* @private
+ * @param $cell
+ * @param $tagName
+ * @return array
*/
function getCellAttr ( $cell, $tagName ) {
$attributes = null;
@@ -1176,6 +1200,11 @@
return $text;
}
+ /**
+ * @throws MWException
+ * @param $m array
+ * @return HTML|string
+ */
function magicLinkCallback( $m ) {
if ( isset( $m[1] ) && $m[1] !== '' ) {
# Skip anchor
Modified: trunk/phase3/includes/parser/Preprocessor.php
===================================================================
--- trunk/phase3/includes/parser/Preprocessor.php 2011-05-28 17:04:13 UTC
(rev 89046)
+++ trunk/phase3/includes/parser/Preprocessor.php 2011-05-28 17:18:50 UTC
(rev 89047)
@@ -22,6 +22,8 @@
/**
* Create a new custom frame for programmatic use of parameter
replacement as used in some extensions
*
+ * @param $args array
+ *
* @return PPFrame
*/
function newCustomFrame( $args );
@@ -51,6 +53,8 @@
/**
* Create a child frame
+ *
+ * @return PPFrame
*/
function newChild( $args = false, $title = false );
Modified: trunk/phase3/includes/specials/SpecialListredirects.php
===================================================================
--- trunk/phase3/includes/specials/SpecialListredirects.php 2011-05-28
17:04:13 UTC (rev 89046)
+++ trunk/phase3/includes/specials/SpecialListredirects.php 2011-05-28
17:18:50 UTC (rev 89047)
@@ -65,6 +65,7 @@
* Cache page existence for performance
*
* @param $db DatabaseBase
+ * @param $res ResultWrapper
*/
function preprocessResults( $db, $res ) {
$batch = new LinkBatch;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs