protected $mPage;
/**
- * @protected
* @var ParserOptions: ParserOptions object for $wgUser articles
*/
public $mParserOptions;
}
// the loop prepends the arrow image before the link, so the first case needs to be outside
+
+ /**
+ * @var $title Title
+ */
$title = array_shift( $target );
if ( $forceKnown ) {
/**
* Perform a deletion and output success or failure messages
+ * @param $reason
+ * @param $suppress bool
*/
public function doDelete( $reason, $suppress = false ) {
global $wgOut;
* @param $title Title
*/
public static function onArticleCreate( $title ) {
- return WikiPage::onArticleCreate( $title );
+ WikiPage::onArticleCreate( $title );
}
/**
* @param $title Title
*/
public static function onArticleDelete( $title ) {
- return WikiPage::onArticleDelete( $title );
+ WikiPage::onArticleDelete( $title );
}
/**
* @param $title Title
*/
public static function onArticleEdit( $title ) {
- return WikiPage::onArticleEdit( $title );
+ WikiPage::onArticleEdit( $title );
}
/**
$this->parserOptions = $parserOptions;
}
+ /**
+ * @return bool
+ */
function doWork() {
return $this->mArticle->doViewParse();
}
+ /**
+ * @return bool
+ */
function getCachedWork() {
global $wgOut;
return false;
}
+ /**
+ * @return bool
+ */
function fallback() {
return $this->mArticle->tryDirtyCache();
}
/**
* Add a subcategory to the internal lists, using a Category object
+ * @param $cat Category
+ * @param $sortkey
+ * @param $pageLength
*/
function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) {
// Subcategory; strip the 'Category' namespace from the link text.
/**
* Add a page in the image namespace
+ * @param $title Title
+ * @param $sortkey
+ * @param $pageLength
+ * @param $isRedirect bool
*/
function addImage( Title $title, $sortkey, $pageLength, $isRedirect = false ) {
global $wgContLang;
/**
* Add a miscellaneous page
+ * @param $title
+ * @param $sortkey
+ * @param $pageLength
+ * @param $isRedirect bool
*/
function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) {
global $wgContLang;
}
}
+ /**
+ * @return string
+ */
function getCategoryTop() {
$r = $this->getCategoryBottom();
return $r === ''
: "<br style=\"clear:both;\"/>\n" . $r;
}
+ /**
+ * @return string
+ */
function getSubcategorySection() {
# Don't show subcategories section if there are none.
$r = '';
return $r;
}
+ /**
+ * @return string
+ */
function getPagesSection() {
$ti = htmlspecialchars( $this->title->getText() );
# Don't show articles section if there are none.
return $r;
}
+ /**
+ * @return string
+ */
function getImageSection() {
$r = '';
$rescnt = $this->showGallery ? $this->gallery->count() : count( $this->imgsNoGallery );
}
}
+ /**
+ * @return string
+ */
function getCategoryBottom() {
return '';
}
*
* @param Title $title: The title (usually $this->title)
* @param String $section: Which section
+ * @return Title
*/
private function addFragmentToTitle( $title, $section ) {
switch ( $section ) {
<?php
/**
- * This is a port of D.J. Bernstein's CDB to PHP. It's based on the copy that
+ * This is a port of D.J. Bernstein's CDB to PHP. It's based on the copy that
* appears in PHP 5.3. Changes are:
* * Error returns replaced with exceptions
* * Exception thrown if sizes or offsets are between 2GB and 4GB
/**
* The CDB hash function.
- *
+ *
* @param $s
*
* @return
// Do a 32-bit sum
// Inlined here for speed
$sum = ($h & 0x3fffffff) + ($h5 & 0x3fffffff);
- $h =
+ $h =
(
( $sum & 0x40000000 ? 1 : 0 )
+ ( $h & 0x80000000 ? 2 : 0 )
var $dpos;
/* initialized if cdb_findnext() returns 1 */
- var $dlen;
+ var $dlen;
+ /**
+ * @param $fileName string
+ */
function __construct( $fileName ) {
$this->handle = fopen( $fileName, 'rb' );
if ( !$this->handle ) {
var $handle, $realFileName, $tmpFileName;
var $hplist;
- var $numEntries, $pos;
+ var $numentries, $pos;
+ /**
+ * @param $fileName string
+ */
function __construct( $fileName ) {
$this->realFileName = $fileName;
$this->tmpFileName = $fileName . '.tmp.' . mt_rand( 0, 0x7fffffff );
}
// Excessively clever and indulgent code to simultaneously fill $packedTables
- // with the packed hashtables, and adjust the elements of $starts
+ // with the packed hashtables, and adjust the elements of $starts
// to actually point to the starts instead of the ends.
$packedTables = array_fill( 0, $this->numentries, false );
foreach ( $this->hplist as $item ) {
// is taken.
for ( $u = 0; $u < $count; ++$u ) {
$hp = $packedTables[$starts[$i] + $u];
- $where = CdbFunctions::unsignedMod(
+ $where = CdbFunctions::unsignedMod(
CdbFunctions::unsignedShiftRight( $hp['h'], 8 ), $len );
while ( $hashtable[$where]['p'] )
if ( ++$where == $len )
// Write the hashtable
for ( $u = 0; $u < $len; ++$u ) {
- $buf = pack( 'vvV',
+ $buf = pack( 'vvV',
$hashtable[$u]['h'] & 0xffff,
CdbFunctions::unsignedShiftRight( $hashtable[$u]['h'], 16 ),
$hashtable[$u]['p'] );
*/
class FileDeleteForm {
+ /**
+ * @var Title
+ */
private $title = null;
+
+ /**
+ * @var File
+ */
private $file = null;
+ /**
+ * @var File
+ */
private $oldfile = null;
private $oldimage = '';
+ private $DeleteReason, $DeleteReasonList;
/**
* Constructor
*
* value was provided, does it correspond to an
* existing, local, old version of this file?
*
+ * @param $file File
+ * @param $oldfile File
+ * @param $oldimage File
* @return bool
*/
public static function haveDeletableFile(&$file, &$oldfile, $oldimage) {
* Simple wrapper for Http::request( 'GET' )
* @see Http::request()
*
+ * @param $url
+ * @param $timeout string
+ * @param $options array
* @return string
*/
public static function get( $url, $timeout = 'default', $options = array() ) {
* Simple wrapper for Http::request( 'POST' )
* @see Http::request()
*
+ * @param $url
+ * @param $options array
* @return string
*/
public static function post( $url, $options = array() ) {
* Generate a new request object
* @param $url String: url to use
* @param $options Array: (optional) extra params to pass (see Http::request())
+ * @return \CurlHttpRequest|\PhpHttpRequest
* @see MWHttpRequest::__construct
*/
public static function factory( $url, $options = null ) {
/**
* Set the user agent
+ * @param $UA string
*/
public function setUserAgent( $UA ) {
$this->setHeader( 'User-Agent', $UA );
/**
* Set an arbitrary header
+ * @param $name
+ * @param $value
*/
public function setHeader( $name, $value ) {
// I feel like I should normalize the case here...
/**
* Get an array of the headers
+ * @return array
*/
public function getHeaderList() {
$list = array();
* cookies. Used internally after a request to parse the
* Set-Cookie headers.
* @see Cookie::set
+ * @param $name
+ * @param $value null
+ * @param $attr null
*/
public function setCookie( $name, $value = null, $attr = null ) {
if ( !$this->cookieJar ) {
/**
* Returns true if the backend can follow redirects. Overridden by the
* child classes.
+ * @return bool
*/
public function canFollowRedirects() {
return true;
protected $curlOptions = array();
protected $headerText = "";
+ /**
+ * @param $fh
+ * @param $content
+ * @return int
+ */
protected function readHeader( $fh, $content ) {
$this->headerText .= $content;
return strlen( $content );
return $this->status;
}
+ /**
+ * @return bool
+ */
public function canFollowRedirects() {
if ( strval( ini_get( 'open_basedir' ) ) !== '' || wfIniGetBool( 'safe_mode' ) ) {
wfDebug( "Cannot follow redirects in safe mode\n" );
}
class PhpHttpRequest extends MWHttpRequest {
+
+ /**
+ * @param $url string
+ * @return string
+ */
protected function urlToTcp( $url ) {
$parsedUrl = parse_url( $url );
$wgOut->addModuleStyles( 'filepage' );
}
+ /**
+ * @return File
+ */
public function getDisplayedFile() {
$this->loadFile();
return $this->displayImg;
*
* Omit noarticletext if sharedupload; text will be fetched from the
* shared upload server if possible.
+ * @return string
*/
public function getContent() {
$this->loadFile();
'action' => $wgScript,
'onchange' => 'document.pageselector.submit();',
);
-
+ $options = array();
for ( $i = 1; $i <= $count; $i++ ) {
$options[] = Xml::option( $wgLang->formatNum( $i ), $i, $i == $page );
}
/**
* Creates an thumbnail of specified size and returns an HTML link to it
- * @param array $params Scaler parameters
- * @param int $width
- * @param int $height
+ * @param $params array Scaler parameters
+ * @param $width int
+ * @param $height int
+ * @return string
*/
private function makeSizeLink( $params, $width, $height ) {
$params['width'] = $width;
}
}
+ /**
+ * @param $target
+ * @param $limit
+ * @return ResultWrapper
+ */
protected function queryImageLinks( $target, $limit ) {
$dbr = wfGetDB( DB_SLAVE );
);
$wgOut->addHTML( "<ul class='mw-imagepage-duplicates'>\n" );
+ /**
+ * @var $file File
+ */
foreach ( $dupes as $file ) {
$fromSrc = '';
if ( $file->isLocal() ) {
*/
protected $imagePage;
+ /**
+ * @var File
+ */
+ protected $current;
+
protected $repo, $showThumb;
protected $preventClickjacking = false;
$this->showThumb = $wgShowArchiveThumbnails && $this->img->canRender();
}
+ /**
+ * @return ImagePage
+ */
public function getImagePage() {
return $this->imagePage;
}
+ /**
+ * @return File
+ */
public function getFile() {
return $this->img;
}
+ /**
+ * @param $navLinks string
+ * @return string
+ */
public function beginImageHistoryList( $navLinks = '' ) {
global $wgOut, $wgUser;
return Xml::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'filehist' ) ) . "\n"
. "</tr>\n";
}
+ /**
+ * @param $navLinks string
+ * @return string
+ */
public function endImageHistoryList( $navLinks = '' ) {
return "</table>\n$navLinks\n</div>\n";
}
}
}
+ /**
+ * @param $enable bool
+ */
protected function preventClickjacking( $enable = true ) {
$this->preventClickjacking = $enable;
}
+ /**
+ * @return bool
+ */
public function getPreventClickjacking() {
return $this->preventClickjacking;
}
$this->mRange = array( 0, 0 ); // display range
}
+ /**
+ * @return Title
+ */
function getTitle() {
return $this->mTitle;
}
return false;
}
+ /**
+ * @return string
+ */
function getIndexField() {
return '';
}
+ /**
+ * @return string
+ */
function formatRow( $row ) {
return '';
}
+ /**
+ * @return string
+ */
function getBody() {
$s = '';
$this->doQuery();
$this->mQueryDone = true;
}
+ /**
+ * @param $enable bool
+ */
protected function preventClickjacking( $enable = true ) {
$this->preventClickjacking = $enable;
}
+ /**
+ * @return bool
+ */
public function getPreventClickjacking() {
return $this->preventClickjacking;
}
/**
* Creates an ImportXMLReader drawing from the source provided
+ * @param $source
*/
function __construct( $source ) {
$this->reader = new XMLReader();
$id = UploadSourceAdapter::registerSource( $source );
if (defined( 'LIBXML_PARSEHUGE' ) ) {
$this->reader->open( "uploadsource://$id", null, LIBXML_PARSEHUGE );
- }
- else {
+ } else {
$this->reader->open( "uploadsource://$id" );
}
/**
* Set debug mode...
+ * @param $debug bool
*/
function setDebug( $debug ) {
$this->mDebug = $debug;
/**
* Set 'no updates' mode. In this mode, the link tables will not be updated by the importer
+ * @param $noupdates bool
*/
function setNoUpdates( $noupdates ) {
$this->mNoUpdates = $noupdates;
/**
* Set a target namespace to override the defaults
+ * @param $namespace
+ * @return bool
*/
public function setTargetNamespace( $namespace ) {
if( is_null( $namespace ) ) {
}
/**
- * @parma $dir
+ * @param $dir
*/
public function setImageBasePath( $dir ) {
$this->mImageBasePath = $dir;
/**
* Default per-revision callback, performs the import.
* @param $revision WikiRevision
+ * @return bool
*/
public function importRevision( $revision ) {
$dbw = wfGetDB( DB_MASTER );
/**
* Default per-revision callback, performs the import.
* @param $rev WikiRevision
+ * @return bool
*/
public function importLogItem( $rev ) {
$dbw = wfGetDB( DB_MASTER );
/**
* Dummy for now...
+ * @param $revision
+ * @return bool
*/
public function importUpload( $revision ) {
$dbw = wfGetDB( DB_MASTER );
/**
* Mostly for hook use
+ * @param $title
+ * @param $origTitle
+ * @param $revCount
+ * @param $sRevCount
+ * @param $pageInfo
+ * @return
*/
public function finishImportPage( $title, $origTitle, $revCount, $sRevCount, $pageInfo ) {
$args = func_get_args();
*/
class WikiRevision {
var $importer = null;
+
+ /**
+ * @var Title
+ */
var $title = null;
var $id = 0;
var $timestamp = "20010115000000";
var $sha1base36 = false;
var $isTemp = false;
var $archiveName = '';
+ var $fileIsTemp;
private $mNoUpdates = false;
/**
$this->type = $type;
}
+ /**
+ * @param $action
+ */
function setAction( $action ) {
$this->action = $action;
}
$this->mRead = false;
}
+ /**
+ * @return bool
+ */
function atEnd() {
return $this->mRead;
}
+ /**
+ * @return bool|string
+ */
function readChunk() {
if( $this->atEnd() ) {
return false;
return feof( $this->mHandle );
}
+ /**
+ * @return string
+ */
function readChunk() {
return fread( $this->mHandle, 32768 );
}
);
}
+ /**
+ * @param $cats
+ */
function invalidateCategories( $cats ) {
$this->invalidatePages( NS_CATEGORY, array_keys( $cats ) );
}
/**
* Update all the appropriate counts in the category table.
- * @param $added associative array of category name => sort key
- * @param $deleted associative array of category name => sort key
+ * @param $added array associative array of category name => sort key
+ * @param $deleted array associative array of category name => sort key
*/
function updateCategoryCounts( $added, $deleted ) {
$a = new Article($this->mTitle);
);
}
+ /**
+ * @param $images
+ */
function invalidateImageDescriptions( $images ) {
$this->invalidatePages( NS_FILE, array_keys( $images ) );
}
+ /**
+ * @param $table
+ * @param $insertions
+ * @param $fromField
+ */
function dumbTableUpdate( $table, $insertions, $fromField ) {
$this->mDb->delete( $table, array( $fromField => $this->mId ), __METHOD__ );
if ( count( $insertions ) ) {
/**
* Update a table by doing a delete query then an insert query
- *
+ * @param $table
+ * @param $prefix
+ * @param $deletions
+ * @param $insertions
*/
function incrTableUpdate( $table, $prefix, $deletions, $insertions ) {
if ( $table == 'page_props' ) {
}
}
-
/**
* Get an array of pagelinks insertions for passing to the DB
* Skips the titles specified by the 2-D array $existing
- *
+ * @param $existing array
+ * @return array
*/
function getLinkInsertions( $existing = array() ) {
$arr = array();
/**
* Get an array of template insertions. Like getLinkInsertions()
- *
+ * @param $existing array
+ * @return array
*/
function getTemplateInsertions( $existing = array() ) {
$arr = array();
/**
* Get an array of image insertions
* Skips the names specified in $existing
+ * @param $existing array
+ * @return array
*/
function getImageInsertions( $existing = array() ) {
$arr = array();
/**
* Get an array of externallinks insertions. Skips the names specified in $existing
+ * @param $existing array
+ * @return array
*/
function getExternalInsertions( $existing = array() ) {
$arr = array();
/**
* Get an array of category insertions
*
- * @param $existing Array mapping existing category names to sort keys. If both
+ * @param $existing array mapping existing category names to sort keys. If both
* match a link in $this, the link will be omitted from the output
+ *
+ * @return array
*/
function getCategoryInsertions( $existing = array() ) {
global $wgContLang, $wgCategoryCollation;
*
* @param $existing Array mapping existing language codes to titles
*
+ * @return array
*/
function getInterlangInsertions( $existing = array() ) {
$diffs = array_diff_assoc( $this->mInterlangs, $existing );
/**
* Get an array of page property insertions
+ * @param $existing array
+ * @return array
*/
function getPropertyInsertions( $existing = array() ) {
$diffs = array_diff_assoc( $this->mProperties, $existing );
/**
* Get an array of interwiki insertions for passing to the DB
* Skips the titles specified by the 2-D array $existing
- *
+ * @param $existing array
+ * @return array
*/
function getInterwikiInsertions( $existing = array() ) {
$arr = array();
/**
* Given an array of existing links, returns those links which are not in $this
* and thus should be deleted.
- *
+ * @param $existing array
+ * @return array
*/
function getLinkDeletions( $existing ) {
$del = array();
/**
* Given an array of existing templates, returns those templates which are not in $this
* and thus should be deleted.
- *
+ * @param $existing array
+ * @return array
*/
function getTemplateDeletions( $existing ) {
$del = array();
/**
* Given an array of existing images, returns those images which are not in $this
* and thus should be deleted.
- *
+ * @param $existing array
+ * @return array
*/
function getImageDeletions( $existing ) {
return array_diff_key( $existing, $this->mImages );
/**
* Given an array of existing external links, returns those links which are not
* in $this and thus should be deleted.
- *
+ * @param $existing array
+ * @return array
*/
function getExternalDeletions( $existing ) {
return array_diff_key( $existing, $this->mExternals );
/**
* Given an array of existing categories, returns those categories which are not in $this
* and thus should be deleted.
- *
+ * @param $existing array
+ * @return array
*/
function getCategoryDeletions( $existing ) {
return array_diff_assoc( $existing, $this->mCategories );
/**
* Given an array of existing interlanguage links, returns those links which are not
* in $this and thus should be deleted.
- *
+ * @param $existing array
+ * @return array
*/
function getInterlangDeletions( $existing ) {
return array_diff_assoc( $existing, $this->mInterlangs );
/**
* Get array of properties which should be deleted.
- *
+ * @param $existing array
+ * @return array
*/
function getPropertyDeletions( $existing ) {
return array_diff_assoc( $existing, $this->mProperties );
/**
* Given an array of existing interwiki links, returns those links which are not in $this
* and thus should be deleted.
- *
+ * @param $existing array
+ * @return array
*/
function getInterwikiDeletions( $existing ) {
$del = array();
/**
* Get an array of existing links, as a 2-D array
*
+ * @return array
*/
function getExistingLinks() {
$res = $this->mDb->select( 'pagelinks', array( 'pl_namespace', 'pl_title' ),
/**
* Get an array of existing templates, as a 2-D array
*
+ * @return array
*/
function getExistingTemplates() {
$res = $this->mDb->select( 'templatelinks', array( 'tl_namespace', 'tl_title' ),
/**
* Get an array of existing images, image names in the keys
*
+ * @return array
*/
function getExistingImages() {
$res = $this->mDb->select( 'imagelinks', array( 'il_to' ),
/**
* Get an array of existing external links, URLs in the keys
*
+ * @return array
*/
function getExistingExternals() {
$res = $this->mDb->select( 'externallinks', array( 'el_to' ),
/**
* Get an array of existing categories, with the name in the key and sort key in the value.
*
+ * @return array
*/
function getExistingCategories() {
$res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey_prefix' ),
* Get an array of existing interlanguage links, with the language code in the key and the
* title in the value.
*
+ * @return array
*/
function getExistingInterlangs() {
$res = $this->mDb->select( 'langlinks', array( 'll_lang', 'll_title' ),
/**
* Get an array of existing categories, with the name in the key and sort key in the value.
*
+ * @return array
*/
function getExistingProperties() {
$res = $this->mDb->select( 'page_props', array( 'pp_propname', 'pp_value' ),
return $arr;
}
-
/**
* Return the title object of the page being updated
+ * @return Title
*/
function getTitle() {
return $this->mTitle;
/**
* Return the list of images used as generated by the parser
+ * @return array
*/
public function getImages() {
return $this->mImages;
/**
* Invalidate any necessary link lists related to page property changes
+ * @param $changed
*/
function invalidateProperties( $changed ) {
global $wgPagePropLinkInvalidations;
/**
* Returns true if any of the dependencies have expired
+ *
+ * @return bool
*/
function isExpired() {
foreach ( $this->deps as $dep ) {
/**
* Get the user-defined value
+ * @return bool|\Mixed
*/
function getValue() {
return $this->value;
$this->timestamp = $timestamp;
}
+ /**
+ * @return array
+ */
function __sleep() {
$this->loadDependencyValues();
return array( 'filename', 'timestamp' );
/**
* Construct a dependency on a list of titles
+ * @param $linkBatch LinkBatch
*/
function __construct( LinkBatch $linkBatch ) {
$this->linkBatch = $linkBatch;
}
+ /**
+ * @return array
+ */
function calculateTimestamps() {
# Initialise values to false
$timestamps = array();
return array( 'timestamps' );
}
+ /**
+ * @return LinkBatch
+ */
function getLinkBatch() {
if ( !isset( $this->linkBatch ) ) {
$this->linkBatch = new LinkBatch;