* http://www.php.net/manual/en/class.httprequest.php
*
* This is for backwards compatibility.
+ * @since 1.17
*/
class HttpRequest extends MWHttpRequest { }
*/
abstract class TitleArray implements Iterator {
/**
- * @param $res result A MySQL result including at least page_namespace and
+ * @param $res ResultWrapper A SQL result including at least page_namespace and
* page_title -- also can have page_id, page_len, page_is_redirect,
* page_latest (if those will be used). See Title::newFromRow.
* @return TitleArrayFromResult
}
/**
- * @param $res
+ * @param $res ResultWrapper
* @return TitleArrayFromResult
*/
protected static function newFromResult_internal( $res ) {
}
class TitleArrayFromResult extends TitleArray {
+
+ /**
+ * @var ResultWrapper
+ */
var $res;
var $key, $current;
$this->setCurrent( $this->res->current() );
}
+ /**
+ * @param $row ResultWrapper
+ * @return void
+ */
protected function setCurrent( $row ) {
if ( $row === false ) {
$this->current = false;
}
}
+ /**
+ * @return int
+ */
public function count() {
return $this->res->numRows();
}
$this->setCurrent( $this->res->current() );
}
+ /**
+ * @return bool
+ */
function valid() {
return $this->current !== false;
}
<?php
abstract class UserArray implements Iterator {
-
/**
- * @param $res
+ * @param $res ResultWrapper
* @return UserArrayFromResult
*/
static function newFromResult( $res ) {
return self::newFromResult( $res );
}
+ /**
+ * @param $res
+ * @return UserArrayFromResult
+ */
protected static function newFromResult_internal( $res ) {
- $userArray = new UserArrayFromResult( $res );
- return $userArray;
+ return new UserArrayFromResult( $res );
}
}
class UserArrayFromResult extends UserArray {
+
+ /**
+ * @var ResultWrapper
+ */
var $res;
var $key, $current;
+ /**
+ * @param $res ResultWrapper
+ */
function __construct( $res ) {
$this->res = $res;
$this->key = 0;
$this->setCurrent( $this->res->current() );
}
+ /**
+ * @param $row
+ * @return void
+ */
protected function setCurrent( $row ) {
if ( $row === false ) {
$this->current = false;
}
}
+ /**
+ * @return int
+ */
public function count() {
return $this->res->numRows();
}
$this->setCurrent( $this->res->current() );
}
+ /**
+ * @return bool
+ */
function valid() {
return $this->current !== false;
}
/**
* Store the wrapper to a cache
+ *
+ * @param $cache BagOStuff
+ * @param $key
+ * @param $expiry
*/
function storeToCache( $cache, $key, $expiry = 0 ) {
$this->initialiseDeps();
* it will be generated with the callback function (if present), and the newly
* calculated value will be stored to the cache in a wrapper.
*
- * @param $cache Object: a cache object such as $wgMemc
+ * @param $cache BagOStuff a cache object such as $wgMemc
* @param $key String: the cache key
* @param $expiry Integer: the expiry timestamp or interval in seconds
* @param $callback Mixed: the callback for generating the value, or false
}
}
+ /**
+ * @return bool
+ */
function isExpired() {
if ( !file_exists( $this->filename ) ) {
if ( $this->timestamp === false ) {
/**
* Get rid of bulky Title object for sleep
+ *
+ * @return array
*/
function __sleep() {
return array( 'ns', 'dbk', 'touched' );
}
+ /**
+ * @return Title
+ */
function getTitle() {
if ( !isset( $this->titleObj ) ) {
$this->titleObj = Title::makeTitle( $this->ns, $this->dbk );
return $this->titleObj;
}
+ /**
+ * @return bool
+ */
function isExpired() {
$touched = $this->getTitle()->getTouched();
$this->timestamps = $this->calculateTimestamps();
}
+ /**
+ * @return array
+ */
function __sleep() {
return array( 'timestamps' );
}
return $this->linkBatch;
}
+ /**
+ * @return bool
+ */
function isExpired() {
$newTimestamps = $this->calculateTimestamps();
$this->value = $GLOBALS[$name];
}
+ /**
+ * @return bool
+ */
function isExpired() {
return $GLOBALS[$this->name] != $this->value;
}
$this->value = constant( $name );
}
+ /**
+ * @return bool
+ */
function isExpired() {
return constant( $this->name ) != $this->value;
}
abstract class BagOStuff {
private $debugMode = false;
+ /**
+ * @param $bool bool
+ */
public function setDebug( $bool ) {
$this->debugMode = $bool;
}
/**
* Get an item with the given key. Returns false if it does not exist.
* @param $key string
+ *
+ * @return bool|Object
*/
abstract public function get( $key );
* - timeout: The read timeout in microseconds
* - connect_timeout: The connect timeout in seconds
*
- * @params $params array
+ * @param $params array
*/
function __construct( $params ) {
if ( !isset( $params['servers'] ) ) {
$this->client->set_debug( $params['debug'] );
}
+ /**
+ * @param $debug bool
+ */
public function setDebug( $debug ) {
$this->client->set_debug( $debug );
}
+ /**
+ * @param $key string
+ * @return Mixed
+ */
public function get( $key ) {
return $this->client->get( $this->encodeKey( $key ) );
}
-
+
+ /**
+ * @param $key string
+ * @param $value
+ * @param $exptime int
+ * @return bool
+ */
public function set( $key, $value, $exptime = 0 ) {
return $this->client->set( $this->encodeKey( $key ), $value, $exptime );
}
+ /**
+ * @param $key string
+ * @param $time int
+ * @return bool
+ */
public function delete( $key, $time = 0 ) {
return $this->client->delete( $this->encodeKey( $key ), $time );
}
+ /**
+ * @param $key
+ * @param $timeout int
+ * @return
+ */
public function lock( $key, $timeout = 0 ) {
return $this->client->lock( $this->encodeKey( $key ), $timeout );
}
+ /**
+ * @param $key string
+ * @return Mixed
+ */
public function unlock( $key ) {
return $this->client->unlock( $this->encodeKey( $key ) );
}
+ /**
+ * @param $key string
+ * @param $value int
+ * @return Mixed
+ */
public function add( $key, $value, $exptime = 0 ) {
return $this->client->add( $this->encodeKey( $key ), $value, $exptime );
}
+ /**
+ * @param $key string
+ * @param $value int
+ * @param $exptime
+ * @return Mixed
+ */
public function replace( $key, $value, $exptime = 0 ) {
return $this->client->replace( $this->encodeKey( $key ), $value, $exptime );
}
+ /**
+ * @param $key string
+ * @param $value int
+ * @return Mixed
+ */
public function incr( $key, $value = 1 ) {
return $this->client->incr( $this->encodeKey( $key ), $value );
}
+ /**
+ * @param $key string
+ * @param $value int
+ * @return Mixed
+ */
public function decr( $key, $value = 1 ) {
return $this->client->decr( $this->encodeKey( $key ), $value );
}
/**
* Get the underlying client object. This is provided for debugging
* purposes.
+ *
+ * @return MemCachedClientforWiki
*/
public function getClient() {
return $this->client;
/**
* Decode a key encoded with encodeKey(). This is provided as a convenience
* function for debugging.
+ *
+ * @param $key string
+ *
+ * @return string
*/
public function decodeKey( $key ) {
return urldecode( $key );
*/
class MWTidyWrapper {
- protected $mTokens, $mUniqPrefix;
+ /**
+ * @var ReplacementArray
+ */
+ protected $mTokens;
+
+ protected $mUniqPrefix;
+
+ protected $mMarkerIndex;
public function __construct() {
$this->mTokens = null;
$this->mUniqPrefix = null;
}
+ /**
+ * @param $text string
+ * @return string
+ */
public function getWrapped( $text ) {
$this->mTokens = new ReplacementArray;
$this->mUniqPrefix = "\x7fUNIQ" .
}
/**
- * @private
+ * @param $m array
+ *
+ * @return string
*/
function replaceEditSectionLinksCallback( $m ) {
$marker = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}" . Parser::MARKER_SUFFIX;
return $marker;
}
+ /**
+ * @param $text string
+ * @return string
+ */
public function postprocess( $text ) {
return $this->mTokens->replace( $text );
}
* saving the overhead of spawning a new process.
*
* 'pear install tidy' should be able to compile the extension module.
+ *
+ * @param $text
+ * @param $stderr
+ * @param $retval
+ *
+ * @return string
*/
private static function execInternalTidy( $text, $stderr = false, &$retval = null ) {
global $wgTidyConf, $wgDebugTidy;