/**
* Fork a number of worker processes.
+ *
+ * return string
*/
protected function forkWorkers( $numProcs ) {
$this->prepareEnvironment();
function wfArrayDiff2( $a, $b ) {
return array_udiff( $a, $b, 'wfArrayDiff2_cmp' );
}
+
function wfArrayDiff2_cmp( $a, $b ) {
if ( !is_array( $a ) ) {
return strcmp( $a, $b );
/**
* Register a parser object
+ *
+ * @param $parser Parser
*/
function setParser( $parser ) {
$this->mParser = $parser;
/**
* Returns true if we are running under HipHop, whether in compiled or
* interpreted mode.
+ *
+ * @return bool
*/
static function isHipHop() {
return function_exists( 'hphp_thread_set_warmup_enabled' );
/**
* Get a fully-qualified path for a source file relative to $IP. Including
* such a path under HipHop will force the file to be interpreted. This is
- * useful for configuration files.
+ * useful for configuration files.
+ *
+ * @param $file string
+ *
+ * @return string
*/
static function interpretedPath( $file ) {
global $IP;
* it will converted to a fully qualified path. It is necessary to use a
* path which is relative to $IP in order to make HipHop use its compiled
* code.
+ *
+ * @param $file string
+ *
+ * @return string
*/
static function compiledPath( $file ) {
global $IP;
* "volatile", which means (as of March 2011) that the class is broken and
* can't be used at all. So don't do that. See
* https://github.com/facebook/hiphop-php/issues/314
+ *
+ * @param $class string
+ *
+ * @return bool
*/
static function classExists( $class ) {
try {
/**
* Determine whether a function exists, using a method which works under
* HipHop.
+ *
+ * @param $function string
+ *
+ * @return bool
*/
static function functionExists( $function ) {
try {
/**
* Common code for getLinkAttributesX functions
+ *
+ * @param $title string
+ * @param $class string
+ *
+ * @return string
*/
private static function getLinkAttributesInternal( $title, $class ) {
$title = htmlspecialchars( $title );
* @param $query array The query string to append to the URL
* you're linking to, in key => value array form. Query keys and values
* will be URL-encoded.
- * @param $options mixed String or array of strings:
+ * @param $options string|array String or array of strings:
* 'known': Page is known to exist, so don't check if it does.
* 'broken': Page is known not to exist, so don't check if it does.
* 'noclasses': Don't add any classes automatically (includes "new",
* Constructor.
* For constructor parameters, see the documentation in DefaultSettings.php
* for $wgLocalisationCacheConf.
+ *
+ * @param $conf Array
*/
function __construct( $conf ) {
global $wgCacheDirectory;
/**
* Get the local directory corresponding to one of the three basic zones
+ *
+ * @param $zone string
+ *
+ * @return string
*/
function getZonePath( $zone ) {
switch ( $zone ) {
/**
* @see FileRepo::getZoneUrl()
+ *
+ * @param $zone string
+ *
+ * @return url
*/
function getZoneUrl( $zone ) {
switch ( $zone ) {
* Get a URL referring to this repository, with the private mwrepo protocol.
* The suffix, if supplied, is considered to be unencoded, and will be
* URL-encoded before being returned.
+ *
+ * @param $suffix string
+ *
+ * @return string
*/
function getVirtualUrl( $suffix = false ) {
$path = 'mwrepo://' . $this->name;
/**
* Get the local path corresponding to a virtual URL
+ *
+ * @param $url string
+ *
+ * @return string
*/
function resolveVirtualUrl( $url ) {
if ( substr( $url, 0, 9 ) != 'mwrepo://' ) {
* Do not call this except from inside a repo class.
*
* Note: $unused param is only here to avoid an E_STRICT
+ *
+ * @param $title
+ * @param $repo
+ * @param $unused
+ *
+ * @return LocalFile
*/
static function newFromTitle( $title, $repo, $unused = null ) {
return new self( $title, $repo );
/**
* Create a LocalFile from a title
* Do not call this except from inside a repo class.
+ *
+ * @param $row
+ * @param $repo
+ *
+ * @return LocalFile
*/
static function newFromRow( $row, $repo ) {
$title = Title::makeTitle( NS_FILE, $row->img_name );
/**
* Create a LocalFile from a SHA-1 key
* Do not call this except from inside a repo class.
- * @param $sha1
+ *
+ * @param $sha1 string
* @param $repo LocalRepo
- * @param $timestamp
+ * @param $timestamp string
+ *
+ * @return LocalFile
*/
static function newFromKey( $sha1, $repo, $timestamp = false ) {
$conds = array( 'img_sha1' => $sha1 );
}
}
+ /**
+ * @param $title
+ * @param $archiveName
+ * @return OldLocalFile
+ */
function newFromArchiveName( $title, $archiveName ) {
return OldLocalFile::newFromArchiveName( $title, $this, $archiveName );
}
var $localInfo, $foreignInfo;
var $cache;
+ /**
+ * @var RepoGroup
+ */
protected static $instance;
const MAX_CACHE_SIZE = 1000;
/**
* Set the singleton instance to a given object
+ *
+ * @param $instance RepoGroup
*/
static function setSingleton( $instance ) {
self::$instance = $instance;
* Search repositories for an image.
* You can also use wfFindFile() to do this.
*
- * @param $title Mixed: Title object or string
- * @param $options Associative array of options:
+ * @param $title Title|string Title object or string
+ * @param $options array Associative array of options:
* time: requested time for an archived image, or false for the
* current version. An image object will be returned which was
* created at the specified time.
*/
var $handler;
+ /**
+ * @param $path
+ * @param $mime
+ * @return UnregisteredLocalFile
+ */
static function newFromPath( $path, $mime ) {
return new UnregisteredLocalFile( false, false, $path, $mime );
}
+ /**
+ * @param $title
+ * @param $repo
+ * @return UnregisteredLocalFile
+ */
static function newFromTitle( $title, $repo ) {
return new UnregisteredLocalFile( $title, $repo, false, false );
}
/**
* @throws MWException
- * @param bool $title
+ * @param $title string
* @param $repo FSRepo
- * @param bool $path
- * @param bool $mime
+ * @param $path string
+ * @param $mime string
*/
function __construct( $title = false, $repo = false, $path = false, $mime = false ) {
if ( !( $title && $repo ) && !$path ) {
/**
* Overload: after this action field info table has to be rebuilt
+ *
+ * @param $what array
*/
public function doUpdates( $what = array( 'core', 'extensions', 'purge' ) ) {
parent::doUpdates( $what );
*/
class SqliteInstaller extends DatabaseInstaller {
+ /**
+ * @var DatabaseSqlite
+ */
+ public $db;
+
protected $globalNames = array(
'wgDBname',
'wgSQLiteDataDir',
/**
* Safe wrapper for PHP's realpath() that fails gracefully if it's unable to canonicalize the path.
+ *
+ * @param $path string
+ *
+ * @return string
*/
private static function realpath( $path ) {
$result = realpath( $path );
return $result;
}
+ /**
+ * @return Status
+ */
public function submitConnectForm() {
$this->setVarsFromRequest( array( 'wgSQLiteDataDir', 'wgDBname' ) );
# Try realpath() if the directory already exists
$dir = self::realpath( $this->getVar( 'wgSQLiteDataDir' ) );
$result = self::dataDirOKmaybeCreate( $dir, true /* create? */ );
- if ( $result->isOK() )
- {
+ if ( $result->isOK() ) {
# Try expanding again in case we've just created it
$dir = self::realpath( $dir );
$this->setVar( 'wgSQLiteDataDir', $dir );
return $result;
}
+ /**
+ * @param $dir
+ * @param $create bool
+ * @return Status
+ */
private static function dataDirOKmaybeCreate( $dir, $create = false ) {
if ( !is_dir( $dir ) ) {
if ( !is_writable( dirname( $dir ) ) ) {
return Status::newGood();
}
+ /**
+ * @return Status
+ */
public function openConnection() {
global $wgSQLiteDataDir;
return $status;
}
+ /**
+ * @return bool
+ */
public function needsUpgrade() {
$dir = $this->getVar( 'wgSQLiteDataDir' );
$dbName = $this->getVar( 'wgDBname' );
return parent::needsUpgrade();
}
+ /**
+ * @return Status
+ */
public function setupDatabase() {
$dir = $this->getVar( 'wgSQLiteDataDir' );
return $this->getConnection();
}
+ /**
+ * @return Staus
+ */
public function createTables() {
$status = parent::createTables();
return $this->setupSearchIndex( $status );
}
+ /**
+ * @param $status Status
+ * @return Status
+ */
public function setupSearchIndex( &$status ) {
global $IP;
return $status;
}
+ /**
+ * @return string
+ */
public function getLocalSettings() {
$dir = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgSQLiteDataDir' ) );
return
/**
* Get the final destination of a redirect
+ *
+ * @param $title Title
+ *
* @return false if the specified title is not a redirect, or if it is a circular redirect
*/
public static function getFinalDestination( $title ) {
* Pop a job of a certain type. This tries less hard than pop() to
* actually find a job; it may be adversely affected by concurrent job
* runners.
+ *
+ * @param $type string
+ *
+ * @return Job
*/
static function pop_type( $type ) {
wfProfilein( __METHOD__ );
* @ingroup Media
*/
class BmpHandler extends BitmapHandler {
- // We never want to use .bmp in an <img/> tag
+
+ /**
+ * @param $file
+ * @return bool
+ */
function mustRender( $file ) {
return true;
}
- // Render files as PNG
+ /**
+ * Render files as PNG
+ *
+ * @param $text
+ * @param $mime
+ * @param $params
+ * @return array
+ */
function getThumbType( $text, $mime, $params = null ) {
return array( 'png', 'image/png' );
}
/**
* Get width and height from the bmp header.
+ *
+ * @param $image
+ * @param $filename
+ * @return array
*/
function getImageSize( $image, $filename ) {
$f = fopen( $filename, 'r' );
- if(!$f) return false;
+ if( !$f ) {
+ return false;
+ }
$header = fread( $f, 54 );
fclose($f);
}
- /** get exif info using exif class.
- * Basically what used to be in BitmapHandler::getMetadata().
- * Just calls stuff in the Exif class.
- */
+ /**
+ *
+ * get exif info using exif class.
+ * Basically what used to be in BitmapHandler::getMetadata().
+ * Just calls stuff in the Exif class.
+ *
+ * @param $filename string
+ */
function getExif ( $filename ) {
if ( file_exists( $filename ) ) {
$exif = new Exif( $filename );
/**
* Get a MediaHandler for a given MIME type from the instance cache
*
+ * @param $type string
+ *
* @return MediaHandler
*/
static function getHandler( $type ) {
* Validate a thumbnail parameter at parse time.
* Return true to accept the parameter, and false to reject it.
* If you return false, the parser will do something quiet and forgiving.
+ *
+ * @param $name
+ * @param $value
*/
abstract function validateParam( $name, $value );
/**
* Merge a parameter array into a string appropriate for inclusion in filenames
+ *
+ * @param $params array
*/
abstract function makeParamString( $params );
/**
* Parse a param string made with makeParamString back into an array
+ *
+ * @param $str string
*/
abstract function parseParamString( $str );
* Changes the parameter array as necessary, ready for transformation.
* Should be idempotent.
* Returns false if the parameters are unacceptable and the transform should fail
+ * @param $image
+ * @param $params
*/
abstract function normaliseParams( $image, &$params );
/**
* Get a string describing the type of metadata, for display purposes.
+ *
+ * @return string
*/
function getMetadataType( $image ) { return false; }
/**
* Fetch HTML for this transform output
*
- * @param $options Associative array of options. Boolean options
+ * @param $options array Associative array of options. Boolean options
* should be indicated with a value of true for true, and false or
* absent for false.
*
/**
* Wrap some XHTML text in an anchor tag with the given attributes
+ *
+ * @param $linkAttribs array
+ * @param $contents string
+ *
+ * @return string
*/
protected function linkWrap( $linkAttribs, $contents ) {
if ( $linkAttribs ) {
}
}
+ /**
+ * @param $title string
+ * @param $params array
+ * @return array
+ */
function getDescLinkAttribs( $title = null, $params = '' ) {
$query = $this->page ? ( 'page=' . urlencode( $this->page ) ) : '';
if( $params ) {
}
}
-
/**
* Media transform output for images
*
* Return HTML <img ... /> tag for the thumbnail, will include
* width and height attributes and a blank alt text (as required).
*
- * @param $options Associative array of options. Boolean options
+ * @param $options array Associative array of options. Boolean options
* should be indicated with a value of true for true, and false or
* absent for false.
*
/**
* Encode value and expiry for storage
+ *
+ * @return string
*/
function encode( $value, $expiry ) {
# Convert to absolute time
}
/**
- * @return list containing value first and expiry second
+ * @return array list containing value first and expiry second
*/
function decode( $blob ) {
if ( !is_string( $blob ) ) {
/**
* Factory function referenced from DefaultSettings.php for CACHE_ACCEL.
+ *
+ * @return ObjectCache
*/
static function newAccelerator( $params ) {
if ( function_exists( 'eaccelerator_get' ) ) {
* reciprocal of the probability of purging on any given
* request. If this is set to zero, purging will never be
* done.
+ *
+ * @param $params array
*/
public function __construct( $params ) {
if ( isset( $params['server'] ) ) {
*
* Uses undocumented extended tag hook return values, introduced in r61913.
*
- * @param string $content
- * @param array $attribs
- * @param Parser $parser
+ * @param $content string
+ * @param $attribs array
+ * @param $parser Parser
* @return array
*/
static function html( $content, $attributes, $parser ) {
*
* Uses undocumented extended tag hook return values, introduced in r61913.
*
- * @param string $content
- * @param array $attribs
- * @param Parser $parser
+ * @param $content string
+ * @param $attribs array
+ * @param $parser Parser
* @return array
*/
static function nowiki( $content, $attributes, $parser ) {
/**
* Retrieve the ParserOutput from ParserCache.
* false if not found or outdated.
+ *
+ * @param $article Article
+ * @param $popts ParserOptions
+ * @param $useOutdated
+ *
* @return ParserOutput|false
*/
public function get( $article, $popts, $useOutdated = false ) {