/**
* Create a Pool counter. This should only be called from the PoolWorks.
+ *
+ * @param $type
+ * @param $key
+ *
+ * @return PoolCounter
*/
public static function factory( $type, $key ) {
global $wgPoolCounterConf;
}
class PoolCounter_Stub extends PoolCounter {
+
+ /**
+ * @return Status
+ */
function acquireForMe() {
return Status::newGood( PoolCounter::LOCKED );
}
+ /**
+ * @return Status
+ */
function acquireForAnyone() {
return Status::newGood( PoolCounter::LOCKED );
}
+ /**
+ * @return Status
+ */
function release() {
return Status::newGood( PoolCounter::RELEASED );
}
-
+
public function __construct() {
/* No parameters needed */
}
* Make a fake revision object from an archive table row. This is queried
* for permissions or even inserted (as in Special:Undelete)
* @todo FIXME: Should be a subclass for RevisionDelete. [TS]
+ *
+ * @return Revision
*/
public static function newFromArchiveRow( $row, $overrides = array() ) {
$attribs = $overrides + array(
/**
* Handle duplicate entries. Backend for duplicateEntries().
+ *
+ * @param $ot Title
+ * @param $nt Title
+ *
+ * @return bool
*/
private static function doDuplicateEntries( $ot, $nt ) {
$oldnamespace = $ot->getNamespace();
* Detect compiled mode by looking for a function that only exists if compiled
* in. Note that we can't use function_exists(), because it is terribly broken
* under HipHop due to the "volatile" feature.
+ *
+ * @return bool
*/
function wfDetectCompiledMode() {
try {
function containsOldMagic() { return $this->mContainsOldMagic; }
function setContainsOldMagic( $com ) { return wfSetVar( $this->mContainsOldMagic, $com ); }
-
- /**
- * setCacheTime() sets the timestamp expressing when the page has been rendered.
+
+ /**
+ * setCacheTime() sets the timestamp expressing when the page has been rendered.
* This doesn not control expiry, see updateCacheExpiry() for that!
+ * @param $t string
+ * @return string
*/
function setCacheTime( $t ) { return wfSetVar( $this->mCacheTime, $t ); }
* the new call has no effect. The value returned by getCacheExpiry is smaller
* or equal to the smallest number that was provided as an argument to
* updateCacheExpiry().
+ *
+ * @param $seconds number
*/
function updateCacheExpiry( $seconds ) {
$seconds = (int)$seconds;
/**
* Returns true if the infinite loop check is OK, false if a loop is detected
*
+ * @param $title
+ *
* @return bool
*/
function loopCheck( $title );
/**
* Add a nowiki strip item
+ * @param $marker
+ * @param $value
*/
function addNoWiki( $marker, $value ) {
$this->addItem( 'nowiki', $marker, $value );
}
+ /**
+ * @param $marker
+ * @param $value
+ */
function addGeneral( $marker, $value ) {
$this->addItem( 'general', $marker, $value );
}
+ /**
+ * @throws MWException
+ * @param $type
+ * @param $marker
+ * @param $value
+ */
protected function addItem( $type, $marker, $value ) {
if ( !preg_match( $this->regex, $marker, $m ) ) {
throw new MWException( "Invalid marker: $marker" );
$this->data[$type][$m[1]] = $value;
}
+ /**
+ * @param $text
+ * @return mixed
+ */
function unstripGeneral( $text ) {
return $this->unstripType( 'general', $text );
}
+ /**
+ * @param $text
+ * @return mixed
+ */
function unstripNoWiki( $text ) {
return $this->unstripType( 'nowiki', $text );
}
+ /**
+ * @param $text
+ * @return mixed
+ */
function unstripBoth( $text ) {
$text = $this->unstripType( 'general', $text );
$text = $this->unstripType( 'nowiki', $text );
return $text;
}
+ /**
+ * @param $type
+ * @param $text
+ * @return mixed
+ */
protected function unstripType( $type, $text ) {
// Shortcut
if ( !count( $this->data[$type] ) ) {
return $out;
}
+ /**
+ * @param $m array
+ * @return array
+ */
protected function unstripCallback( $m ) {
if ( isset( $this->data[$this->tempType][$m[1]] ) ) {
return $this->data[$this->tempType][$m[1]];
/**
* Get a StripState object which is sufficient to unstrip the given text.
* It will contain the minimum subset of strip items necessary.
+ *
+ * @param $text string
+ *
+ * @return StripState
*/
function getSubState( $text ) {
$subState = new StripState( $this->prefix );
* Return a LIMIT clause to limit results on the query.
* @return String
*/
- function queryLimit($sql) {
+ function queryLimit( $sql ) {
return $this->db->limitResult($sql, $this->limit, $this->offset);
}
/**
* Return a LIMIT clause to limit results on the query.
*
+ * @param $sql string
+ *
* @return String
- * @private
*/
function queryLimit( $sql ) {
return $this->db->limitResult( $sql, $this->limit, $this->offset );
* subclasses may define this though
*
* @return String
- * @private
*/
function queryRanking( $filteredTerm, $fulltext ) {
return ' ORDER BY ftindex.[RANK] DESC'; // return ' ORDER BY score(1)';
*
* @param $filteredTerm String
* @param $fulltext Boolean
- * @private
*/
function getQuery( $filteredTerm, $fulltext ) {
return $this->queryLimit( $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
$this->queryRanking( $filteredTerm, $fulltext ) . ' ' );
}
-
/**
* Picks which field to index on, depending on what type of query.
*
/**
* Parse the user's query and transform it into an SQL fragment which will
* become part of a WHERE clause
+ *
+ * @return string
*/
function parseQuery( $filteredText, $fulltext ) {
global $wgContLang;
/**
* Return a LIMIT clause to limit results on the query.
+ *
+ * @param string
+ *
* @return String
*/
- function queryLimit($sql) {
+ function queryLimit( $sql ) {
return $this->db->limitResult($sql, $this->limit, $this->offset);
}
/**
* Does not do anything for generic search engine
* subclasses may define this though
+ *
* @return String
*/
- function queryRanking($filteredTerm, $fulltext) {
+ function queryRanking( $filteredTerm, $fulltext ) {
return ' ORDER BY score(1)';
}
/**
* Transform the user's search string into a better form for tsearch2
* Returns an SQL fragment consisting of quoted text to search for.
+ *
+ * @param $term string
+ *
+ * @return string
*/
function parseQuery( $term ) {
* @ingroup Search
*/
class SearchSqlite extends SearchEngine {
+
+ /**
+ * @var DatabaseSqlite
+ */
+ protected $db;
+
/**
* Creates an instance of this class
* @param $db DatabaseSqlite: database object
* Fetch links and cache their existence
*
* @param $db DatabaseBase
+ * @param $res
*/
function preprocessResults( $db, $res ) {
$batch = new LinkBatch;
}
}
-
function formatResult( $skin, $result ) {
global $wgContLang;
$title = Title::newFromID( $result->value );
/**
* Main execution point
*
- * @param $user User
- * @param $output OutputPage
- * @param $request WebRequest
* @param $mode int
*/
public function execute( $mode ) {
/**
*
- * @param Array of File objects $dupes
+ * @param $dupes Array of File objects
*/
function showList( $dupes ) {
global $wgUser, $wgOut;
/**
* Return an appropriately formatted LIKE query and the clause
+ *
+ * @return array
*/
static function mungeQuery( $query, $prot ) {
$field = 'el_index';
* Fetch user page links and cache their existence
*
* @param $db DatabaseBase
+ * @param $res DatabaseResult
*/
function preprocessResults( $db, $res ) {
$batch = new LinkBatch;
/**
* Callback function to output a restriction
+ *
+ * @return string
*/
function formatRow( $row ) {
global $wgUser, $wgLang;
return array( 'file' => $file, 'type' => $type );
}
-
-
-
/**
* Get a thumbnail for file, either generated locally or remotely, and stream it out
- * @param String $key: key for the file in the stash
- * @param int $width: width of desired thumbnail
+ *
+ * @param $file
+ * @param $params array
+ *
* @return boolean success
*/
private function outputThumbFromStash( $file, $params ) {
} else {
$this->outputLocallyScaledThumb( $file, $params, $flags );
}
-
-
}
-
/**
* Scale a file (probably with a locally installed imagemagick, or similar) and output it to STDOUT.
* @param $file: File object
* @param $limit int Number of entries to display
* @param $from Title Display from this article ID
* @param $back Title Display from this article ID at backwards scrolling
- * @private
*/
function showIndirectLinks( $level, $target, $limit, $from = 0, $back = 0 ) {
global $wgMaxRedirectLinksRetrieved;
* Create a form of UploadBase depending on wpSourceType and initializes it
*
* @param $request WebRequest
+ * @param $type
*/
public static function createFromRequest( &$request, $type = null ) {
$type = $type ? $type : $request->getVal( 'wpSourceType', 'File' );
return $this->initialize( $desiredDestName, $upload );
}
-
+
/**
* Initialize from a filename and a WebRequestUpload
+ * @param $name
+ * @param $webRequestUpload
*/
function initialize( $name, $webRequestUpload ) {
$this->mUpload = $webRequestUpload;
return $this->initializePathInfo( $name,
$this->mUpload->getTempName(), $this->mUpload->getSize() );
}
+
+ /**
+ * @param $request
+ * @return bool
+ */
static function isValidRequest( $request ) {
# Allow all requests, even if no file is present, so that an error
# because a post_max_size or upload_max_filesize overflow
return true;
}
-
- public function getSourceType() { return 'file'; }
-
+
+ /**
+ * @return string
+ */
+ public function getSourceType() {
+ return 'file';
+ }
+
+ /**
+ * @return array
+ */
public function verifyUpload() {
# Check for a post_max_size or upload_max_size overflow, so that a
# proper error can be shown to the user
* There is no need to stash the image twice
*/
public function stashSession( $key = null ) {
- if ( !empty( $this->mSessionKey ) )
+ if ( !empty( $this->mSessionKey ) ) {
return $this->mSessionKey;
+ }
return parent::stashSession();
}