* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.
Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
* must throw subclasses of ErrorPageError
*
* @param $user User: the user to check, or null to use the context user
- * @throws ErrorPageError
+ * @throws UserBlockedError|ReadOnlyError|PermissionsError
* @return bool True on success
*/
protected function checkCanExecute( User $user ) {
* forms, they probably won't have any data, but some (eg rollback) may do
* @param $data Array values that would normally be in the GET request
* @param $captureErrors Bool whether to catch exceptions and just return false
+ * @throws ErrorPageError
* @return Bool whether execution was successful
*/
public function execute( array $data = null, $captureErrors = true ) {
*
* @param $cond Array: A condition, which must not contain other conditions
* @param $user User The user to check the condition against
+ * @throws MWException
* @return bool Whether the condition is true for the user
*/
private static function checkCondition( $cond, User $user ) {
/**
* Get the field name prefix for a given table
* @param $table String
+ * @throws MWException
* @return null|string
*/
protected function getPrefix( $table ) {
* Get the SQL condition array for selecting backlinks, with a join
* on the page table.
* @param $table String
+ * @throws MWException
* @return array|null
*/
protected function getConditions( $table ) {
* Partition a DB result with backlinks in it into batches
* @param $res ResultWrapper database result
* @param $batchSize integer
+ * @throws MWException
* @return array @see
*/
protected function partitionResult( $res, $batchSize ) {
* 3) An autoblock on the given IP
* @param $vagueTarget User|String also search for blocks affecting this target. Doesn't
* make any sense to use TYPE_AUTO / TYPE_ID here. Leave blank to skip IP lookups.
+ * @throws MWException
* @return Bool whether a relevant block was found
*/
protected function newLoad( $vagueTarget = null ) {
/**
* Delete the row from the IP blocks table.
*
+ * @throws MWException
* @return Boolean
*/
public function delete() {
/**
* Get the IP address at the start of the range in Hex form
+ * @throws MWException
* @return String IP in Hex form
*/
public function getRangeStart() {
/**
* Get the IP address at the start of the range in Hex form
+ * @throws MWException
* @return String IP in Hex form
*/
public function getRangeEnd() {
/**
* Set up all member variables using a database query.
+ * @throws MWException
* @return bool True on success, false on failure.
*/
protected function initialize() {
*
* @param Title $title: The title (usually $this->title)
* @param String $section: Which section
+ * @throws MWException
* @return Title
*/
private function addFragmentToTitle( $title, $section ) {
/**
* @param $fileName string
+ * @throws MWException
*/
function __construct( $fileName ) {
$this->fileName = $fileName;
/**
* Unpack an unsigned integer and throw an exception if it needs more than 31 bits
* @param $s
- * @return
+ * @throws MWException
+ * @return mixed
*/
protected function unpack31( $s ) {
$data = unpack( 'V', $s );
* @param $log_id int: log_id of the change to add the tags to
* @param $params String: params to put in the ct_params field of tabel 'change_tag'
*
+ * @throws MWException
* @return bool: false if no changes are made, otherwise true
*
* @exception MWException when $rc_id, $rev_id and $log_id are all null
* @param $conds String|Array: conditions used in query, see DatabaseBase::select
* @param $join_conds Array: join conditions, see DatabaseBase::select
* @param $options Array: options, see Database::select
- * @param $filter_tag String: tag to select on
- *
- * @exception MWException when unable to determine appropriate JOIN condition for tagging
+ * @param bool|string $filter_tag Tag to select on
*
+ * @throws MWException When unable to determine appropriate JOIN condition for tagging
*/
static function modifyDisplayQuery( &$tables, &$fields, &$conds,
&$join_conds, &$options, $filter_tag = false ) {
* insert
* Insert a new element at the start of the array.
*
+ * @throws MWException
* @return string
*/
public function edit( $ops ) {
* Finds the source byte region which you would want to delete, if $pathName
* was to be deleted. Includes the leading spaces and tabs, the trailing line
* break, and any comments in between.
+ * @param $pathName
+ * @throws MWException
* @return array
*/
function findDeletionRegion( $pathName ) {
* or semicolon.
*
* The end position is the past-the-end (end + 1) value as per convention.
+ * @param $pathName
+ * @throws MWException
* @return array
*/
function findValueRegion( $pathName ) {
/**
* Sets a cookie. Used before a request to set up any individual
- * cookies. Used internally after a request to parse the
+ * cookies. Used internally after a request to parse the
* Set-Cookie headers.
*
* @param $value String: the value of the cookie
* @param $attr Array: possible key/values:
- * expires A date string
- * path The path this cookie is used on
- * domain Domain this cookie is used on
+ * expires A date string
+ * path The path this cookie is used on
+ * domain Domain this cookie is used on
+ * @throws MWException
*/
public function set( $value, $attr ) {
$this->value = $value;
*
* @static
* @param $updates array a list of DataUpdate instances
+ * @throws Exception|null
*/
public static function runUpdates( $updates ) {
if ( empty( $updates ) ) return; # nothing to do
* @since 1.19
* @param $permErrors Array of permissions errors, as returned by
* Title::getUserPermissionsErrors().
+ * @throws PermissionsError
*/
protected function displayPermissionsError( array $permErrors ) {
global $wgRequest, $wgOut;
/**
* Attempt submission
+ * @throws UserBlockedError|ReadOnlyError|ThrottledError|PermissionsError
* @return bool false if output is done, true if the rest of the form should be displayed
*/
function attemptSave() {
/**
* Get the rendered text for previewing.
+ * @throws MWException
* @return string
*/
function getPreviewText() {
/**
* @param $sink DumpOutput
* @param $param
+ * @throws MWException
*/
function __construct( &$sink, $param ) {
parent::__construct( $sink );
*
* @param $data String
* @param $storageParams Array: associative array of parameters for the ExternalStore object.
- * @throws DBConnectionError|DBQueryError|MWException
- * @return string The URL of the stored data item, or false on error
+ * @throws MWException|DBConnectionError|DBQueryError
+ * @return string|bool The URL of the stored data item, or false on error
*/
public static function insertToDefault( $data, $storageParams = array() ) {
global $wgDefaultExternalStore;
* @param $reason String: reason of the deletion
* @param $suppress Boolean: whether to mark all deleted versions as restricted
* @param $user User object performing the request
+ * @throws MWException
* @return bool|Status
*/
public static function doDelete( &$title, &$file, &$oldimage, $reason, $suppress, User $user = null ) {
* which will be assumed as INT if the data is an integer.
*
* @param $data Mixed: value to guess type for
+ * @throws MWException
* @exception MWException Unsupported datatype
* @return int Type constant
*/
*
* @param $name String: option name
* @param $strict Boolean: throw an exception when the option does not exist (default false)
+ * @throws MWException
* @return Boolean: true if option exist, false otherwise
*/
public function validateName( $name, $strict = false ) {
/**
* Validate and set an option integer value
- * The value will be altered to fit in the range.
+ * The value will be altered to fit in the range.
*
* @param $name String: option name
* @param $min Int: minimum value
* @param $max Int: maximum value
+ * @throws MWException
* @exception MWException Option is not of type int
* @return null
*/
* @param $value Mixed
* @param $default Mixed
* @param $changed Array to alter
+ * @throws MWException
*/
function wfAppendToArrayIfNotDefault( $key, $value, $default, &$changed ) {
if ( is_null( $changed ) ) {
*
* @param $text String
* @param $file String filename
+ * @throws MWException
*/
function wfErrorLog( $text, $file ) {
if ( substr( $file, 0, 4 ) == 'udp:' ) {
* but now throws an exception instead, with similar results.
*
* @param $msg String: message shown when dying.
+ * @throws MWException
*/
function wfDebugDieBacktrace( $msg = '' ) {
throw new MWException( $msg );
* @param $dir String: full path to directory to create
* @param $mode Integer: chmod value to use, default is $wgDirectoryMode
* @param $caller String: optional caller param for debugging.
+ * @throws MWException
* @return bool
*/
function wfMkdirParents( $dir, $mode = null, $caller = null ) {
*
* @param $req_ver Mixed: the version to check, can be a string, an integer, or
* a float
+ * @throws MWException
*/
function wfUsePHP( $req_ver ) {
$php_ver = PHP_VERSION;
*
* @param $req_ver Mixed: the version to check, can be a string, an integer, or
* a float
+ * @throws MWException
*/
function wfUseMW( $req_ver ) {
global $wgVersion;
* Set format in which to display the form
* @param $format String the name of the format to use, must be one of
* $this->availableDisplayFormats
+ * @throws MWException
* @since 1.20
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* Initialise a new Object for the field
* @param $fieldname string
* @param $descriptor string input Descriptor, as described above
+ * @throws MWException
* @return HTMLFormField subclass
*/
static function loadInputFromParameters( $fieldname, $descriptor ) {
* @attention When doing method chaining, that should be the very last
* method call before displayForm().
*
+ * @throws MWException
* @return HTMLForm $this for chaining calls (since 1.20)
*/
function prepareForm() {
/**
* Validate all the fields, and call the submision callback
* function if everything is kosher.
+ * @throws MWException
* @return Mixed Bool true == Successful submission, Bool false
- * == No submission attempted, anything else == Error to
- * display.
+ * == No submission attempted, anything else == Error to
+ * display.
*/
function trySubmit() {
# Check for validation
/**
* Initialise the object
* @param $params array Associative Array. See HTMLForm doc for syntax.
+ * @throws MWException
*/
function __construct( $params ) {
$this->mParams = $params;
* Generate a new request object
* @param $url String: url to use
* @param $options Array: (optional) extra params to pass (see Http::request())
+ * @throws MWException
* @return CurlHttpRequest|PhpHttpRequest
* @see MWHttpRequest::__construct
*/
* will be aborted.
*
* @param $callback Callback
+ * @throws MWException
*/
public function setCallback( $callback ) {
if ( !is_callable( $callback ) ) {
/**
* Primary entry point
+ * @throws MWException
* @return bool
*/
public function doImport() {
* @param $context IContextSource context to use to get the messages
* @param $namespace int Namespace number
* @param $title string Text of the title, without the namespace part
+ * @return string
*/
public static function getInvalidTitleDescription( IContextSource $context, $namespace, $title ) {
global $wgContLang;
* @param $title Title of the page we're updating
* @param $parserOutput ParserOutput: output from a full parse of this page
* @param $recursive Boolean: queue jobs for recursive updates?
+ * @throws MWException
*/
function __construct( $title, $parserOutput, $recursive = true ) {
parent::__construct( false ); // no implicit transaction
* for $wgLocalisationCacheConf.
*
* @param $conf Array
+ * @throws MWException
*/
function __construct( $conf ) {
global $wgCacheDirectory;
/**
* Initialise a language in this object. Rebuild the cache if necessary.
* @param $code
+ * @throws MWException
*/
protected function initLanguage( $code ) {
if ( isset( $this->initialisedLangs[$code] ) ) {
* Read a PHP file containing localisation data.
* @param $_fileName
* @param $_fileType
+ * @throws MWException
* @return array
*/
protected function readPHPFile( $_fileName, $_fileType ) {
* Load localisation data for a given language for both core and extensions
* and save it to the persistent cache store and the process cache
* @param $code
+ * @throws MWException
*/
public function recache( $code ) {
global $wgExtensionMessagesFiles;
* turned off.
* @since 1.17
* @param $lang Mixed: language code or Language object.
+ * @throws MWException
* @return Message: $this
*/
public function inLanguage( $lang ) {
/**
* Wrapper for what ever method we use to get message contents
* @since 1.17
+ * @throws MWException
* @return string
*/
protected function fetchMessage() {
* @param $resourceLoader ResourceLoader object
* @param $modules Array of module names
* @param $lang String: language code
+ * @throws MWException
* @return array Array mapping module names to blobs
*/
private static function getFromDB( ResourceLoader $resourceLoader, $modules, $lang ) {
* @param $index
* @param $method
*
+ * @throws MWException
* @return bool
*/
private static function isMethodValidFor( $index, $method ) {
* @param $interface Boolean: use interface language ($wgLang instead of
* $wgContLang) while parsing language sensitive magic
* words like GRAMMAR and PLURAL. This also disables
- * LanguageConverter.
+ * LanguageConverter.
* @param $language Language object: target language object, will override
* $interface
+ * @throws MWException
* @return String: HTML
*/
public function parse( $text, $linestart = true, $interface = false, $language = null ) {
* Display an error page noting that a given permission bit is required.
* @deprecated since 1.18, just throw the exception directly
* @param $permission String: key required
+ * @throws PermissionsError
*/
public function permissionRequired( $permission ) {
throw new PermissionsError( $permission );
* @param $protected Boolean: is this a permissions error?
* @param $reasons Array: list of reasons for this error, as returned by Title::getUserPermissionsErrors().
* @param $action String: action that was denied or null if unknown
+ * @throws ReadOnlyError
*/
public function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
$this->setRobotPolicy( 'noindex,nofollow' );
/**
* For back-compat, subclasses may return a raw SQL query here, as a string.
* This is stronly deprecated; getQueryInfo() should be overridden instead.
+ * @throws MWException
* @return string
*/
function getSQL() {
* @param $row
* @param $overrides array
*
+ * @throws MWException
* @return Revision
*/
public static function newFromArchiveRow( $row, $overrides = array() ) {
* Constructor
*
* @param $row Mixed: either a database row or an array
+ * @throws MWException
* @access private
*/
function __construct( $row ) {
* number on success and dies horribly on failure.
*
* @param $dbw DatabaseBase: (master connection)
+ * @throws MWException
* @return Integer
*/
public function insertOn( $dbw ) {
* attribs regex matches.
*
* @param $set Array
+ * @throws MWException
* @return String
*/
private static function getTagAttributeCallback( $set ) {
*
* @param $fname String Name of called method
* @param $args Array Arguments to the method
+ * @throws MWException
* @return mixed
*/
function __call( $fname, $args ) {
* By default it is capitalized.
*
* @param $name string Language name, e.g. "English" or "español"
+ * @return string
* @private
*/
function formatLanguageName( $name ) {
*
* @param $name String
* @param $subpage String|Bool subpage string, or false to not use a subpage
+ * @throws MWException
* @return Title object
*/
public static function getTitleFor( $name, $subpage = false ) {
*
* @param $fName String Name of called method
* @param $a Array Arguments to the method
+ * @throws MWException
* @deprecated since 1.17, call parent::__construct()
*/
public function __call( $fName, $a ) {
* Called from execute() to check if the given user can perform this action.
* Failures here must throw subclasses of ErrorPageError.
* @param $user User
+ * @throws UserBlockedError
* @return Bool true
- * @throws ErrorPageError
*/
protected function checkExecutePermissions( User $user ) {
$this->checkPermissions();
* @param $fname string Full name and path of the file to stream
* @param $headers array Any additional headers to send
* @param $sendErrors bool Send error messages if errors occur (like 404)
+ * @throws MWException
* @return bool Success
*/
public static function stream( $fname, $headers = array(), $sendErrors = true ) {
* @param $name String: name of the method called in this object.
* @param $level Integer: level to go in the stact trace to get the function
* who called this function.
+ * @throws MWException
*/
function _unstub( $name = '_unstub', $level = 2 ) {
static $recursionLevel = 0;
* - 'usable' Valid for batch processes and login
* - 'creatable' Valid for batch processes, login and account creation
*
+ * @throws MWException
* @return bool|string
*/
public static function getCanonicalName( $name, $validate = 'valid' ) {
* @param $body String: email's text.
* @param $replyto MailAddress: optional reply-to email (default: null).
* @param $contentType String: optional custom Content-Type (default: text/plain; charset=UTF-8)
+ * @throws MWException
* @return Status object
*/
public static function send( $to, $from, $subject, $body, $replyto = null, $contentType = 'text/plain; charset=UTF-8' ) {
* Return the path and query string portion of the request URI.
* This will be suitable for use as a relative link in HTML output.
*
+ * @throws MWException
* @return String
*/
public function getRequestURL() {
* false if an error message has been shown and the request should be aborted.
*
* @param $extWhitelist array
+ * @throws HttpError
* @return bool
*/
public function checkUrlExtension( $extWhitelist = array() ) {
/**
* Work out the IP address based on various globals
* For trusted proxies, use the XFF client IP (first of the chain)
- *
+ *
* @since 1.19
*
+ * @throws MWException
* @return string
*/
public function getIP() {
* fake GET/POST values
* @param $wasPosted Bool: whether to treat the data as POST
* @param $session Mixed: session array or null
+ * @throws MWException
*/
public function __construct( $data = array(), $wasPosted = false, $session = null ) {
if( is_array( $data ) ) {
* - special pages
* - normal pages
*
+ * @throws MWException|PermissionsError|BadTitleError|HttpError
* @return void
*/
private function performRequest() {
* The values are passed to Sanitizer::encodeAttribute.
* Return null if no attributes given.
* @param $attribs Array of attributes for an XML element
+ * @throws MWException
* @return null|string
*/
public static function expandAttributes( $attribs ) {
*
* @param $offset int The offset into the string at which to start unpacking.
*
+ * @throws MWException
* @return array Unpacked associative array. Note that large integers in the input
* may be represented as floating point numbers in the return value, so
* the use of weak comparison is advised.
* Returns page information in an easily-manipulated format. Array keys are used so extensions
* may add additional information in arbitrary positions. Array values are arrays with one
* element to be rendered as a header, arrays with two elements to be rendered as a table row.
+ *
+ * @return array
*/
protected function pageInfo() {
global $wgContLang, $wgDisableCounters, $wgRCMaxAge;
* Construct an ObjectFileCache from a Title and an action
* @param $title Title|string Title object or prefixed DB key string
* @param $action string
+ * @throws MWException
* @return HTMLFileCache
*/
public static function newFromTitle( $title, $action ) {
* @param $key String: the message cache key
* @param $useDB Boolean: get the message from the DB, false to use only
* the localisation
- * @param $langcode String: code of the language to get the message for, if
+ * @param bool|string $langcode Code of the language to get the message for, if
* it is a valid code create a language for that language,
* if it is a string but not a valid code then make a basic
* language object, if it is a false boolean then use the
* @param $isFullKey Boolean: specifies whether $key is a two part key
* "msg/lang".
*
+ * @throws MWException
* @return string|bool
*/
function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
* Initialize a new child class based on a configuration array
* @param $conf Array of configuration settings, see $wgConfiguration
* for details
+ * @throws MWException
* @return Conf
*/
private static function newFromSettings( $conf ) {
/**
* Get the singleton if we don't want a specific wiki
- * @param $wiki String An id for a remote wiki
+ * @param bool|string $wiki An id for a remote wiki
+ * @throws MWException
* @return Conf child
*/
public static function load( $wiki = false ) {
* Set the Language object
*
* @param $l Mixed Language instance or language code
+ * @throws MWException
* @since 1.19
*/
public function setLanguage( $l ) {
* canUseWikiPage() to check whether this method can be called safely.
*
* @since 1.19
+ * @throws MWException
* @return WikiPage
*/
public function getWikiPage() {
* Set the Language object
*
* @param $l Mixed Language instance or language code
+ * @throws MWException
* @since 1.19
*/
public function setLanguage( $l ) {
/**
* @param $error String: fallback error message, used if none is given by DB
+ * @throws DBConnectionError
*/
function reportConnectionError( $error = 'Unknown error' ) {
$myError = $this->lastError();
* comment (you can use __METHOD__ or add some extra info)
* @param $tempIgnore Boolean: Whether to avoid throwing an exception on errors...
* maybe best to catch the exception instead?
+ * @throws MWException
* @return boolean|ResultWrapper. true for a successful write query, ResultWrapper object
* for a successful read query, or false on failure if $tempIgnore set
- * @throws DBQueryError Thrown when the database returns an error of any kind
*/
public function query( $sql, $fname = '', $tempIgnore = false ) {
$isMaster = !is_null( $this->getLBInfo( 'master' ) );
* @param $sql String
* @param $fname String
* @param $tempIgnore Boolean
+ * @throws DBQueryError
*/
public function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
# Ignore errors during error handling to avoid infinite recursion
* while we're doing this.
*
* @param $matches Array
+ * @throws DBUnexpectedError
* @return String
*/
protected function fillPreparedArg( $matches ) {
/**
* Makes an encoded list of strings from an array
* @param $a Array containing the data
- * @param $mode int Constant
+ * @param int $mode Constant
* - LIST_COMMA: comma separated, no field names
* - LIST_AND: ANDed WHERE clause (without the WHERE). See
* the documentation for $conds in DatabaseBase::select().
* - LIST_SET: comma separated with field names, like a SET clause
* - LIST_NAMES: comma separated field names
*
+ * @throws MWException|DBUnexpectedError
* @return string
*/
public function makeList( $a, $mode = LIST_COMMA ) {
* ANDed together in the WHERE clause
* @param $fname String: Calling function name (use __METHOD__) for
* logs/profiling
+ * @throws DBUnexpectedError
*/
public function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds,
$fname = 'DatabaseBase::deleteJoin' )
* the format. Use $conds == "*" to delete all rows
* @param $fname String name of the calling function
*
+ * @throws DBUnexpectedError
* @return bool
*/
public function delete( $table, $conds, $fname = 'DatabaseBase::delete' ) {
* @param $limit Integer the SQL limit
* @param $offset Integer|bool the SQL offset (default false)
*
+ * @throws DBUnexpectedError
* @return string
*/
public function limitResult( $sql, $limit, $offset = false ) {
* @param $newName String: name of table to be created
* @param $temporary Boolean: whether the new table should be temporary
* @param $fname String: calling function name
+ * @throws MWException
* @return Boolean: true if operation was successful
*/
public function duplicateTableStructure( $oldName, $newName, $temporary = false,
*
* @param $prefix string Only show tables with this prefix, e.g. mw_
* @param $fname String: calling function name
+ * @throws MWException
*/
function listTables( $prefix = null, $fname = 'DatabaseBase::listTables' ) {
throw new MWException( 'DatabaseBase::listTables is not implemented in descendant class' );
* on object's error ignore settings).
*
* @param $filename String: File name to open
- * @param $lineCallback Callback: Optional function called before reading each line
- * @param $resultCallback Callback: Optional function called for each MySQL result
- * @param $fname String: Calling function name or false if name should be
+ * @param bool|callable $lineCallback Optional function called before reading each line
+ * @param bool|callable $resultCallback Optional function called for each MySQL result
+ * @param bool|string $fname Calling function name or false if name should be
* generated dynamically using $filename
+ * @throws MWException
* @return bool|string
*/
public function sourceFile(
* @param $user String
* @param $password String
* @param $dbName String: database name
+ * @throws DBConnectionError
* @return DatabaseBase a fresh connection
*/
public function open( $server, $user, $password, $dbName ) {
/**
* The DBMS-dependent part of query()
* @param $sql String: SQL query.
+ * @throws DBUnexpectedError
* @return object Result object for fetch functions or false on failure
*/
protected function doQuery( $sql ) {
* LIST_SET - comma separated with field names, like a SET clause
* LIST_NAMES - comma separated field names
* LIST_SET_PREPARED - like LIST_SET, except with ? tokens as values
+ * @param array $a
+ * @param int $mode
+ * @throws DBUnexpectedError
* @return string
*/
function makeList( $a, $mode = LIST_COMMA ) {
*
* @param $sql string SQL query we will append the limit too
* @param $limit integer the SQL limit
- * @param $offset integer the SQL offset (default false)
+ * @param bool|int $offset SQL offset (default false)
+ * @throws DBUnexpectedError
* @return string
*/
public function limitResult( $sql, $limit, $offset=false ) {
* DELETE query wrapper
*
* Use $conds == "*" to delete all rows
+ * @param array $table
+ * @param array|string $conds
+ * @param string $fname
+ * @throws DBUnexpectedError
* @return bool|\ResultWrapper
*/
public function delete( $table, $conds, $fname = 'DatabaseIbm_db2::delete' ) {
/**
* Frees memory associated with a statement resource
* @param $res Object: statement resource to free
+ * @throws DBUnexpectedError
* @return Boolean success or failure
*/
public function freeResult( $res ) {
/**
* Usually aborts on failure
+ * @param String $server
+ * @param String $user
+ * @param String $password
+ * @param String $dbName
+ * @throws DBConnectionError
* @return bool|DatabaseBase|null
*/
function open( $server, $user, $password, $dbName ) {
*
* Usually aborts on failure
* If errors are explicitly ignored, returns success
+ * @param String $table
+ * @param Array $arrToInsert
+ * @param string $fname
+ * @param array $options
+ * @throws DBQueryError
* @return bool
*/
function insert( $table, $arrToInsert, $fname = 'DatabaseMssql::insert', $options = array() ) {
* Source items may be literals rather than field names, but strings should be quoted with Database::addQuotes()
* $conds may be "*" to copy the whole table
* srcTable may be an array of tables.
+ * @param string $destTable
+ * @param array|string $srcTable
+ * @param array $varMap
+ * @param array $conds
+ * @param string $fname
+ * @param array $insertOptions
+ * @param array $selectOptions
+ * @throws DBQueryError
* @return null|\ResultWrapper
*/
function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = 'DatabaseMssql::insertSelect',
* Escapes a identifier for use inm SQL.
* Throws an exception if it is invalid.
* Reference: http://msdn.microsoft.com/en-us/library/aa224033%28v=SQL.80%29.aspx
+ * @param $identifier
+ * @throws MWException
* @return string
*/
private function escapeIdentifier( $identifier ) {
* @param $delVar string
* @param $joinVar string
* @param $conds array|string
- * @param $fname bool
+ * @param bool|string $fname bool
+ * @throws DBUnexpectedError
* @return bool|ResultWrapper
*/
function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = 'DatabaseBase::deleteJoin' ) {
/**
* Usually aborts on failure
+ * @param string $server
+ * @param string $user
+ * @param string $password
+ * @param string $dbName
+ * @throws DBConnectionError
* @return DatabaseBase|null
*/
function open( $server, $user, $password, $dbName ) {
/**
* Usually aborts on failure
+ * @param string $server
+ * @param string $user
+ * @param string $password
+ * @param string $dbName
+ * @throws DBConnectionError
* @return DatabaseBase|null
*/
function open( $server, $user, $password, $dbName ) {
/** Open an SQLite database and return a resource handle to it
* NOTE: only $dbName is used, the other parameters are irrelevant for SQLite databases
*
- * @param $server
- * @param $user
- * @param $pass
- * @param $dbName
+ * @param string $server
+ * @param string $user
+ * @param string $pass
+ * @param string $dbName
*
+ * @throws DBConnectionError
* @return PDO
*/
function open( $server, $user, $pass, $dbName ) {
*
* @param $fileName string
*
+ * @throws DBConnectionError
* @return PDO|bool SQL connection or false if failed
*/
function openFile( $fileName ) {
/**
* @param $conf array
+ * @throws MWException
*/
function __construct( $conf ) {
$this->chronProt = new ChronologyProtector;
}
/**
- * @param $cluster
- * @param $wiki
+ * @param String $cluster
+ * @param bool $wiki
+ * @throws MWException
* @return LoadBalancer
*/
function newExternalLB( $cluster, $wiki = false ) {
* servers Required. Array of server info structures.
* masterWaitTimeout Replication lag wait timeout
* loadMonitor Name of a class used to fetch server lag and load.
+ * @throws MWException
*/
function __construct( $params ) {
if ( !isset( $params['servers'] ) ) {
* Side effect: opens connections to databases
* @param $group bool
* @param $wiki bool
+ * @throws MWException
* @return bool|int|string
*/
function getReaderIndex( $group = false, $wiki = false ) {
*
* @param $i Integer: server index
* @param $groups Array: query groups
- * @param $wiki String: wiki ID
+ * @param bool|string $wiki Wiki ID
*
+ * @throws MWException
* @return DatabaseBase
*/
public function &getConnection( $i, $groups = array(), $wiki = false ) {
* the same number of times as getConnection() to work.
*
* @param DatabaseBase $conn
+ * @throws MWException
*/
public function reuseConnection( $conn ) {
$serverIndex = $conn->getLBInfo('serverIndex');
*
* @param $server
* @param $dbNameOverride bool
+ * @throws MWException
* @return DatabaseBase
*/
function reallyOpenConnection( $server, $dbNameOverride = false ) {
*
* @param $type string One of (attachment, inline)
* @param $filename string Suggested file name (should not contain slashes)
+ * @throws MWException
* @return string
* @since 1.20
*/
/**
* @see FileBackend::fileExists()
* @param $params array
+ * @return bool|null
*/
public function fileExists( array $params ) {
$realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] );
/**
* @see FileBackendStore::executeOpHandlesInternal()
+ * @param array $fileOpHandles
+ * @throws MWException
* @return Array List of corresponding Status objects
*/
protected function doExecuteOpHandlesInternal( array $fileOpHandles ) {
* - wikiId : Wiki ID string that all resources are relative to. [optional]
*
* @param Array $config
+ * @throws MWException
*/
public function __construct( array $config ) {
parent::__construct( $config );
* e.g. s/z/a/ for sza251lrxrc1jad41h5mgilp8nysje52.jpg
*
* @param $key string
+ * @throws MWException
* @return string
*/
public function getDeletedHashPath( $key ) {
/**
* Loads a file object from the filearchive table
+ * @throws MWException
* @return bool|null True on success or null
*/
public function load() {
* other similar objects in the new DB.
* - create-tables: A connection with a role suitable for creating tables.
*
+ * @throws MWException
* @return Status object. On success, a connection object will be in the
* value member.
*/
* value in consideration.
* @param $title Title the page
* @param $parameters array query parameters
+ * @throws MWException
* @return String
*/
protected function makePageLink( Title $title = null, $parameters = array() ) {
* to filter down to users.
*
* @param $path string The file path
- * @param $scene string The scene specification, or false if there is none
+ * @param bool|string $scene The scene specification, or false if there is none
+ * @throws MWException
* @return string
*/
function escapeMagickInput( $path, $scene = false ) {
* helper function for escapeMagickInput() and escapeMagickOutput().
*
* @param $path string The file path
- * @param $scene string The scene specification, or false if there is none
+ * @param bool|string $scene The scene specification, or false if there is none
+ * @throws MWException
* @return string
*/
protected function escapeMagickPath( $path, $scene = false ) {
*
* The various exceptions this throws are caught later.
* @param $filename String
+ * @throws MWException
* @return Array The metadata.
*/
static public function Tiff ( $filename ) {
*
* @param $file String: filename.
* @param $byteOrder String Type of byte ordering either 'BE' (Big Endian) or 'LE' (Little Endian). Default ''.
+ * @throws MWException
* @todo FIXME: The following are broke:
* SubjectArea. Need to test the more obscure tags.
*
/**
* @param $data
+ * @throws Exception
* @return int
*/
static function decodeBPP( $data ) {
/**
* @param $fh
- * @return
+ * @throws Exception
*/
static function skipBlock( $fh ) {
while ( !feof( $fh ) ) {
fread( $fh, $block_len );
}
}
+
/**
* Read a block. In the GIF format, a block is made up of
* several sub-blocks. Each sub block starts with one byte
* sub-blocks in the returned value. Normally this is false,
* except XMP is weird and does a hack where you need to keep
* these length bytes.
+ * @throws Exception
* @return string The data.
*/
static function readBlock( $fh, $includeLengths = false ) {
}
/**
- * Helper function for jpegSegmentSplitter
- * @param &$fh FileHandle for jpeg file
- * @return string data content of segment.
- */
+ * Helper function for jpegSegmentSplitter
+ * @param &$fh FileHandle for jpeg file
+ * @throws MWException
+ * @return string data content of segment.
+ */
private static function jpegExtractMarker( &$fh ) {
$size = wfUnpack( "nint", fread( $fh, 2 ), 2 );
if ( $size['int'] <= 2 ) {
* For images, desc-link and file-link are implemented as a click-through. For
* sounds and videos, they may be displayed in other ways.
*
+ * @throws MWException
* @return string
*/
function toHtml( $options = array() ) {
}
/**
- * Transform an SVG file to PNG
- * This function can be called outside of thumbnail contexts
- * @param string $srcPath
- * @param string $dstPath
- * @param string $width
- * @param string $height
- * @return bool|MediaTransformError
- */
+ * Transform an SVG file to PNG
+ * This function can be called outside of thumbnail contexts
+ * @param string $srcPath
+ * @param string $dstPath
+ * @param string $width
+ * @param string $height
+ * @throws MWException
+ * @return bool|MediaTransformError
+ */
public function rasterize( $srcPath, $dstPath, $width, $height ) {
global $wgSVGConverters, $wgSVGConverter, $wgSVGConverterPath;
$err = false;
*
* Creates an SVGReader drawing from the source provided
* @param $source String: URI from which to read
+ * @throws MWException|Exception
*/
function __construct( $source ) {
global $wgSVGMetadataCutoff;
/**
* Read the SVG
+ * @throws MWException
* @return bool
*/
public function read() {
* Read an XML snippet from an element
*
* @param String $metafield that we will fill with the result
+ * @throws MWException
*/
private function readXml( $metafield=null ) {
$this->debug ( "Read top level metadata" );
}
/**
- * @param $image
- * @param $filename
+ * @param File $image
+ * @param string $filename
+ * @throws MWException
* @return string
*/
function getMetadata( $image, $filename ) {
}
/**
- * Main function to call to parse XMP. Use getResults to
- * get results.
- *
- * Also catches any errors during processing, writes them to
- * debug log, blanks result array and returns false.
- *
- * @param $content String: XMP data
- * @param $allOfIt Boolean: If this is all the data (true) or if its split up (false). Default true
- * @param $reset Boolean: does xml parser need to be reset. Default false
- * @return Boolean success.
- */
+ * Main function to call to parse XMP. Use getResults to
+ * get results.
+ *
+ * Also catches any errors during processing, writes them to
+ * debug log, blanks result array and returns false.
+ *
+ * @param $content String: XMP data
+ * @param $allOfIt Boolean: If this is all the data (true) or if its split up (false). Default true
+ * @param $reset Boolean: does xml parser need to be reset. Default false
+ * @throws MWException
+ * @return Boolean success.
+ */
public function parse( $content, $allOfIt = true, $reset = false ) {
if ( $reset ) {
$this->resetXMLParser();
}
/**
- * Hit a closing element in MODE_STRUCT, MODE_SEQ, MODE_BAG
- * generally means we've finished processing a nested structure.
- * resets some internal variables to indicate that.
- *
- * Note this means we hit the closing element not the "</rdf:Seq>".
- *
- * @par For example, when processing:
- * @code{,xml}
- * <exif:ISOSpeedRatings> <rdf:Seq> <rdf:li>64</rdf:li>
- * </rdf:Seq> </exif:ISOSpeedRatings>
- * @endcode
- *
- * This method is called when we hit the "</exif:ISOSpeedRatings>" tag.
- *
- * @param $elm String namespace . space . tag name.
- */
+ * Hit a closing element in MODE_STRUCT, MODE_SEQ, MODE_BAG
+ * generally means we've finished processing a nested structure.
+ * resets some internal variables to indicate that.
+ *
+ * Note this means we hit the closing element not the "</rdf:Seq>".
+ *
+ * @par For example, when processing:
+ * @code{,xml}
+ * <exif:ISOSpeedRatings> <rdf:Seq> <rdf:li>64</rdf:li>
+ * </rdf:Seq> </exif:ISOSpeedRatings>
+ * @endcode
+ *
+ * This method is called when we hit the "</exif:ISOSpeedRatings>" tag.
+ *
+ * @param $elm String namespace . space . tag name.
+ * @throws MWException
+ */
private function endElementNested( $elm ) {
/* cur item must be the same as $elm, unless if in MODE_STRUCT
}
/**
- * Hit a closing element in MODE_LI (either rdf:Seq, or rdf:Bag )
- * Add information about what type of element this is.
- *
- * Note we still have to hit the outer "</property>"
- *
- * @par For example, when processing:
- * @code{,xml}
- * <exif:ISOSpeedRatings> <rdf:Seq> <rdf:li>64</rdf:li>
- * </rdf:Seq> </exif:ISOSpeedRatings>
- * @endcode
- *
- * This method is called when we hit the "</rdf:Seq>".
- * (For comparison, we call endElementModeSimple when we
- * hit the "</rdf:li>")
- *
- * @param $elm String namespace . ' ' . element name
- */
+ * Hit a closing element in MODE_LI (either rdf:Seq, or rdf:Bag )
+ * Add information about what type of element this is.
+ *
+ * Note we still have to hit the outer "</property>"
+ *
+ * @par For example, when processing:
+ * @code{,xml}
+ * <exif:ISOSpeedRatings> <rdf:Seq> <rdf:li>64</rdf:li>
+ * </rdf:Seq> </exif:ISOSpeedRatings>
+ * @endcode
+ *
+ * This method is called when we hit the "</rdf:Seq>".
+ * (For comparison, we call endElementModeSimple when we
+ * hit the "</rdf:li>")
+ *
+ * @param $elm String namespace . ' ' . element name
+ * @throws MWException
+ */
private function endElementModeLi( $elm ) {
list( $ns, $tag ) = explode( ' ', $this->curItem[0], 2 );
}
/**
- * Handler for hitting a closing element.
- *
- * generally just calls a helper function depending on what
- * mode we're in.
- *
- * Ignores the outer wrapping elements that are optional in
- * xmp and have no meaning.
- *
- * @param $parser XMLParser
- * @param $elm String namespace . ' ' . element name
- */
+ * Handler for hitting a closing element.
+ *
+ * generally just calls a helper function depending on what
+ * mode we're in.
+ *
+ * Ignores the outer wrapping elements that are optional in
+ * xmp and have no meaning.
+ *
+ * @param $parser XMLParser
+ * @param $elm String namespace . ' ' . element name
+ * @throws MWException
+ */
function endElement( $parser, $elm ) {
if ( $elm === ( self::NS_RDF . ' RDF' )
|| $elm === 'adobe:ns:meta/ xmpmeta'
}
/**
- * Handle an opening element when in MODE_SIMPLE
- *
- * This should not happen often. This is for if a simple element
- * already opened has a child element. Could happen for a
- * qualified element.
- *
- * For example:
- * <exif:DigitalZoomRatio><rdf:Description><rdf:value>0/10</rdf:value>
- * <foo:someQualifier>Bar</foo:someQualifier> </rdf:Description>
- * </exif:DigitalZoomRatio>
- *
- * This method is called when processing the <rdf:Description> element
- *
- * @param $elm String namespace and tag names separated by space.
- * @param $attribs Array Attributes of the element.
- */
+ * Handle an opening element when in MODE_SIMPLE
+ *
+ * This should not happen often. This is for if a simple element
+ * already opened has a child element. Could happen for a
+ * qualified element.
+ *
+ * For example:
+ * <exif:DigitalZoomRatio><rdf:Description><rdf:value>0/10</rdf:value>
+ * <foo:someQualifier>Bar</foo:someQualifier> </rdf:Description>
+ * </exif:DigitalZoomRatio>
+ *
+ * This method is called when processing the <rdf:Description> element
+ *
+ * @param $elm String namespace and tag names separated by space.
+ * @param $attribs Array Attributes of the element.
+ * @throws MWException
+ */
private function startElementModeSimple( $elm, $attribs ) {
if ( $elm === self::NS_RDF . ' Description' ) {
// If this value has qualifiers
}
/**
- * Starting an element when in MODE_INITIAL
- * This usually happens when we hit an element inside
- * the outer rdf:Description
- *
- * This is generally where most properties start.
- *
- * @param $ns String Namespace
- * @param $tag String tag name (without namespace prefix)
- * @param $attribs Array array of attributes
- */
+ * Starting an element when in MODE_INITIAL
+ * This usually happens when we hit an element inside
+ * the outer rdf:Description
+ *
+ * This is generally where most properties start.
+ *
+ * @param $ns String Namespace
+ * @param $tag String tag name (without namespace prefix)
+ * @param $attribs Array array of attributes
+ * @throws MWException
+ */
private function startElementModeInitial( $ns, $tag, $attribs ) {
if ( $ns !== self::NS_RDF ) {
}
/**
- * Hit an opening element when in a Struct (MODE_STRUCT)
- * This is generally for fields of a compound property.
- *
- * Example of a struct (abbreviated; flash has more properties):
- *
- * <exif:Flash> <rdf:Description> <exif:Fired>True</exif:Fired>
- * <exif:Mode>1</exif:Mode></rdf:Description></exif:Flash>
- *
- * or:
- *
- * <exif:Flash rdf:parseType='Resource'> <exif:Fired>True</exif:Fired>
- * <exif:Mode>1</exif:Mode></exif:Flash>
- *
- * @param $ns String namespace
- * @param $tag String tag name (no ns)
- * @param $attribs Array array of attribs w/ values.
- */
+ * Hit an opening element when in a Struct (MODE_STRUCT)
+ * This is generally for fields of a compound property.
+ *
+ * Example of a struct (abbreviated; flash has more properties):
+ *
+ * <exif:Flash> <rdf:Description> <exif:Fired>True</exif:Fired>
+ * <exif:Mode>1</exif:Mode></rdf:Description></exif:Flash>
+ *
+ * or:
+ *
+ * <exif:Flash rdf:parseType='Resource'> <exif:Fired>True</exif:Fired>
+ * <exif:Mode>1</exif:Mode></exif:Flash>
+ *
+ * @param $ns String namespace
+ * @param $tag String tag name (no ns)
+ * @param $attribs Array array of attribs w/ values.
+ * @throws MWException
+ */
private function startElementModeStruct( $ns, $tag, $attribs ) {
if ( $ns !== self::NS_RDF ) {
}
/**
- * Hits an opening element.
- * Generally just calls a helper based on what MODE we're in.
- * Also does some initial set up for the wrapper element
- *
- * @param $parser XMLParser
- * @param $elm String namespace "<space>" element
- * @param $attribs Array attribute name => value
- */
+ * Hits an opening element.
+ * Generally just calls a helper based on what MODE we're in.
+ * Also does some initial set up for the wrapper element
+ *
+ * @param $parser XMLParser
+ * @param $elm String namespace "<space>" element
+ * @param $attribs Array attribute name => value
+ * @throws MWException
+ */
function startElement( $parser, $elm, $attribs ) {
if ( $elm === self::NS_RDF . ' RDF'
}
/**
- * Process attributes.
- * Simple values can be stored as either a tag or attribute
- *
- * Often the initial "<rdf:Description>" tag just has all the simple
- * properties as attributes.
- *
- * @par Example:
- * @code
- * <rdf:Description rdf:about="" xmlns:exif="http://ns.adobe.com/exif/1.0/" exif:DigitalZoomRatio="0/10">
- * @endcode
- *
- * @param $attribs Array attribute=>value array.
- */
+ * Process attributes.
+ * Simple values can be stored as either a tag or attribute
+ *
+ * Often the initial "<rdf:Description>" tag just has all the simple
+ * properties as attributes.
+ *
+ * @par Example:
+ * @code
+ * <rdf:Description rdf:about="" xmlns:exif="http://ns.adobe.com/exif/1.0/" exif:DigitalZoomRatio="0/10">
+ * @endcode
+ *
+ * @param $attribs Array attribute=>value array.
+ * @throws MWException
+ */
private function doAttribs( $attribs ) {
// first check for rdf:parseType attribute, as that can change
/**
* @param $params array
+ * @throws MWException
*/
function __construct( $params ) {
if ( !defined( 'CURLOPT_TIMEOUT_MS' ) ) {
* Get a connection to the server with the specified name. Connections
* are cached, and failures are persistent to avoid multiple timeouts.
*
+ * @param $server
+ * @throws MWException
* @return Redis object, or false on failure
*/
protected function getConnectionToServer( $server ) {
* @param $content string
* @param $attributes array
* @param $parser Parser
+ * @throws MWException
* @return array
*/
static function html( $content, $attributes, $parser ) {
*
* @since 1.19
*
+ * @throws MWException
* @return Language|null
*/
public function getTargetLanguage() {
*
* @param $text string
*
+ * @throws MWException
* @return string
*/
function replaceExternalLinks( $text ) {
/**
* Process [[ ]] wikilinks (RIL)
+ * @param $s
+ * @throws MWException
* @return LinkHolderArray
*
* @private
* @param $str String the string to split
* @param &$before String set to everything before the ':'
* @param &$after String set to everything after the ':'
+ * @throws MWException
* @return String the position of the ':', or false if none found
*/
function findColonNoLinks( $str, &$before, &$after ) {
* @private
*
* @param $index integer
- * @param $frame PPFrame
+ * @param bool|\PPFrame $frame
*
+ * @throws MWException
* @return string
*/
function getVariableValue( $index, $frame = false ) {
* $piece['parts']: the parameter array
* $piece['lineStart']: whether the brace was at the start of a line
* @param $frame PPFrame The current frame, contains template arguments
+ * @throws MWException
* @return String: the text of the template
* @private
*/
* noClose Original text did not have a close tag
* @param $frame PPFrame
*
+ * @throws MWException
* @return string
*/
function extensionSubstitution( $params, $frame ) {
*
* @param $tag Mixed: the tag to use, e.g. 'hook' for "<hook>"
* @param $callback Mixed: the callback function (and object) to use for the tag
+ * @throws MWException
* @return Mixed|null The old value of the mTagHooks array associated with the hook
*/
public function setHook( $tag, $callback ) {
*
* @param $tag Mixed: the tag to use, e.g. 'hook' for "<hook>"
* @param $callback Mixed: the callback function (and object) to use for the tag
+ * @throws MWException
* @return Mixed|null The old value of the mTagHooks array associated with the hook
*/
function setTransparentTagHook( $tag, $callback ) {
* Please read the documentation in includes/parser/Preprocessor.php for more information
* about the methods available in PPFrame and PPNode.
*
+ * @throws MWException
* @return string|callback The old callback function for this name, if any
*/
public function setFunctionHook( $id, $callback, $flags = 0 ) {
* Create a tag function, e.g. "<test>some stuff</test>".
* Unlike tag hooks, tag functions are parsed at preprocessor level.
* Unlike parser functions, their content is not preprocessed.
+ * @param $tag
+ * @param $callback
+ * @param $flags
+ * @throws MWException
* @return null
*/
function setFunctionTagHook( $tag, $callback, $flags ) {
* check whether it is still valid, by calling isValidHalfParsedText().
*
* @param $data array Serialized data
+ * @throws MWException
* @return String
*/
function unserializeHalfParsedText( $data ) {
* May be a memcached client or a BagOStuff derivative.
*
* @param $memCached Object
+ * @throws MWException
*/
protected function __construct( $memCached ) {
if ( !$memCached ) {
/**
* callback used by getText to replace editsection tokens
* @private
+ * @param $m
+ * @throws MWException
* @return mixed
*/
function replaceEditSectionLinksCallback( $m ) {
* Create a link hook, e.g. [[Namepsace:...|display}}
* The callback function should have the form:
* function myLinkCallback( $parser, $holders, $markers,
- * Title $title, $titleText, &$sortText = null, &$leadingColon = false ) { ... }
+ * Title $title, $titleText, &$sortText = null, &$leadingColon = false ) { ... }
*
* Or with SLH_PATTERN:
* function myLinkCallback( $parser, $holders, $markers, )
- * &$titleText, &$sortText = null, &$leadingColon = false ) { ... }
+ * &$titleText, &$sortText = null, &$leadingColon = false ) { ... }
*
* The callback may either return a number of different possible values:
* String) Text result of the link
* @param $flags Integer: a combination of the following flags:
* SLH_PATTERN Use a regex link pattern rather than a namespace
*
+ * @throws MWException
* @return callback|null The old callback function for this name, if any
*/
public function setLinkHook( $ns, $callback, $flags = 0 ) {
function getLinkHooks() {
return array_keys( $this->mLinkHooks );
}
-
+
/**
* Process [[ ]] wikilinks
+ * @param $s
+ * @throws MWException
* @return LinkHolderArray
*
* @private
* cache may be implemented at a later date which takes further advantage of these strict
* dependency requirements.
*
+ * @throws MWException
* @return PPNode_DOM
*/
function preprocessToObj( $text, $flags = 0 ) {
* - index String index
* - value PPNode value
*
+ * @throws MWException
* @return array
*/
function splitArg() {
* Split an "<ext>" node into an associative array containing name, attr, inner and close
* All values in the resulting array are PPNodes. Inner and close are optional.
*
+ * @throws MWException
* @return array
*/
function splitExt() {
/**
* Split a "<h>" node
+ * @throws MWException
* @return array
*/
function splitHeading() {
* cache may be implemented at a later date which takes further advantage of these strict
* dependency requirements.
*
+ * @throws MWException
* @return PPNode_Hash_Tree
*/
function preprocessToObj( $text, $flags = 0 ) {
* Create a new child frame
* $args is optionally a multi-root PPNode or array containing the template arguments
*
- * @param $args PPNode_Hash_Array|array
+ * @param array|bool|\PPNode_Hash_Array $args PPNode_Hash_Array|array
* @param $title Title|bool
*
+ * @param int $indexOffset
+ * @throws MWException
* @return PPTemplateFrame_Hash
*/
function newChild( $args = false, $title = false, $indexOffset = 0 ) {
* - index String index
* - value PPNode value
*
+ * @throws MWException
* @return array
*/
function splitArg() {
* Split an "<ext>" node into an associative array containing name, attr, inner and close
* All values in the resulting array are PPNodes. Inner and close are optional.
*
+ * @throws MWException
* @return array
*/
function splitExt() {
/**
* Split an "<h>" node
*
+ * @throws MWException
* @return array
*/
function splitHeading() {
/**
* Split a "<template>" or "<tplarg>" node
*
+ * @throws MWException
* @return array
*/
function splitTemplate() {
/**
* Split a <template> or <tplarg> node
*
+ * @throws MWException
* @return array
*/
function splitTemplate() {
*
* @param $id Mixed: source ID (string), or array( id1 => props1, id2 => props2, ... )
* @param $properties Array: source properties
+ * @throws MWException
*/
public function addSource( $id, $properties = null) {
// Allow multiple sources to be registered in one call
* associative array mapping message key to value, or a JSON-encoded message blob containing
* the same data, wrapped in an XmlJsCode object.
*
+ * @throws MWException
* @return string
*/
public static function makeLoaderImplementScript( $name, $scripts, $styles, $messages ) {
* to $wgScriptPath
*
* Below is a description for the $options array:
+ * @throws MWException
* @par Construction options:
* @code
- * array(
- * // Base path to prepend to all local paths in $options. Defaults to $IP
- * 'localBasePath' => [base path],
- * // Base path to prepend to all remote paths in $options. Defaults to $wgScriptPath
- * 'remoteBasePath' => [base path],
- * // Equivalent of remoteBasePath, but relative to $wgExtensionAssetsPath
- * 'remoteExtPath' => [base path],
- * // Scripts to always include
- * 'scripts' => [file path string or array of file path strings],
- * // Scripts to include in specific language contexts
- * 'languageScripts' => array(
- * [language code] => [file path string or array of file path strings],
- * ),
- * // Scripts to include in specific skin contexts
- * 'skinScripts' => array(
- * [skin name] => [file path string or array of file path strings],
- * ),
- * // Scripts to include in debug contexts
- * 'debugScripts' => [file path string or array of file path strings],
- * // Scripts to include in the startup module
- * 'loaderScripts' => [file path string or array of file path strings],
- * // Modules which must be loaded before this module
- * 'dependencies' => [modile name string or array of module name strings],
- * // Styles to always load
- * 'styles' => [file path string or array of file path strings],
- * // Styles to include in specific skin contexts
- * 'skinStyles' => array(
- * [skin name] => [file path string or array of file path strings],
- * ),
- * // Messages to always load
- * 'messages' => [array of message key strings],
- * // Group which this module should be loaded together with
- * 'group' => [group name string],
- * // Position on the page to load this module at
- * 'position' => ['bottom' (default) or 'top']
- * )
+ * array(
+ * // Base path to prepend to all local paths in $options. Defaults to $IP
+ * 'localBasePath' => [base path],
+ * // Base path to prepend to all remote paths in $options. Defaults to $wgScriptPath
+ * 'remoteBasePath' => [base path],
+ * // Equivalent of remoteBasePath, but relative to $wgExtensionAssetsPath
+ * 'remoteExtPath' => [base path],
+ * // Scripts to always include
+ * 'scripts' => [file path string or array of file path strings],
+ * // Scripts to include in specific language contexts
+ * 'languageScripts' => array(
+ * [language code] => [file path string or array of file path strings],
+ * ),
+ * // Scripts to include in specific skin contexts
+ * 'skinScripts' => array(
+ * [skin name] => [file path string or array of file path strings],
+ * ),
+ * // Scripts to include in debug contexts
+ * 'debugScripts' => [file path string or array of file path strings],
+ * // Scripts to include in the startup module
+ * 'loaderScripts' => [file path string or array of file path strings],
+ * // Modules which must be loaded before this module
+ * 'dependencies' => [modile name string or array of module name strings],
+ * // Styles to always load
+ * 'styles' => [file path string or array of file path strings],
+ * // Styles to include in specific skin contexts
+ * 'skinStyles' => array(
+ * [skin name] => [file path string or array of file path strings],
+ * ),
+ * // Messages to always load
+ * 'messages' => [array of message key strings],
+ * // Group which this module should be loaded together with
+ * 'group' => [group name string],
+ * // Position on the page to load this module at
+ * 'position' => ['bottom' (default) or 'top']
+ * )
* @endcode
*/
public function __construct( $options = array(), $localBasePath = null,
* Gets the contents of a list of JavaScript files.
*
* @param $scripts Array: List of file paths to scripts to read, remap and concetenate
+ * @throws MWException
* @return String: Concatenated and remapped JavaScript data from $scripts
*/
protected function readScriptFiles( array $scripts ) {
* comment: The log comment
* authorsIds: The array of the user IDs of the offenders
* authorsIPs: The array of the IP/anon user offenders
+ * @throws MWException
*/
protected function updateLog( $params ) {
// Get the URL param's corresponding DB field
* be thrown.
* @param $html String: The raw HTML.
* @param $state String: State, one of 'noframework', 'unknownframework' or 'frameworkfound'
+ * @throws MWException
* @return string
*/
private function wrapSummaryHtml( $html, $state ) {
* userCanExecute(), and if the data array contains 'Username', etc, then Username
* resets are allowed.
* @param $data array
+ * @throws MWException
+ * @throws ThrottledError|PermissionsError
* @return Bool|Array
*/
public function onSubmit( array $data ) {
/**
* UI entry point for form submission.
+ * @throws PermissionsError
* @return bool
*/
protected function submit() {
*
* @param $data Array
* @param $context IContextSource
+ * @throws ErrorPageError
* @return Array( Array(message key, parameters) ) on failure, True on success
*/
public static function processUnblock( array $data, IContextSource $context ){
* Provides output to the user for a result of UploadBase::verifyUpload
*
* @param $details Array: result of UploadBase::verifyUpload
+ * @throws MWException
*/
protected function processVerificationError( $details ) {
global $wgFileExtensions;
* n.b. Most sanity checking done in UploadStashLocalFile, so this is straightforward.
*
* @param $key String: the key of a particular requested file
+ * @throws HttpError
* @return bool
*/
public function showUpload( $key ) {
* application the transform parameters
*
* @param string $key
+ * @throws UploadStashBadPathException
* @return array
*/
private function parseKey( $key ) {
/**
* Scale a file (probably with a locally installed imagemagick, or similar) and output it to STDOUT.
- * @param $file: File object
- * @param $params: scaling parameters ( e.g. array( width => '50' ) );
- * @param $flags: scaling flags ( see File:: constants )
+ * @param $file File
+ * @param $params array Scaling parameters ( e.g. array( width => '50' ) );
+ * @param $flags int Scaling flags ( see File:: constants )
* @throws MWException
+ * @throws UploadStashFileNotFoundException
* @return boolean success
*/
private function outputLocallyScaledThumb( $file, $params, $flags ) {
* Side effect: writes HTTP response to STDOUT.
*
* @param $file File object with a local path (e.g. UnregisteredLocalFile, LocalFile. Oddly these don't share an ancestor!)
+ * @throws SpecialUploadStashTooLargeException
* @return bool
*/
private function outputLocalFile( File $file ) {
* Side effect: writes HTTP response to STDOUT.
* @param $content String content
* @param $contentType String mime type
+ * @throws SpecialUploadStashTooLargeException
* @return bool
*/
private function outputContents( $content, $contentType ) {
/**
* @private
+ * @throws PermissionsError|ReadOnlyError
* @return bool|User
*/
function addNewAccountInternal() {
* Depending on the submit button used, call a form or a save function.
*
* @param $par Mixed: string if any subpage provided, else null
+ * @throws UserBlockedError|PermissionsError
*/
public function execute( $par ) {
// If the visitor doesn't have permissions to assign or remove
/**
* Remove a particular file from the stash. Also removes it from the repo.
*
- * @throws UploadStashNotLoggedInException
- * @throws UploadStashWrongOwnerException
+ * @param $key
+ * @throws UploadStashNoSuchKeyException|UploadStashNotLoggedInException|UploadStashWrongOwnerException
* @return boolean: success
*/
public function removeFile( $key ) {
* with an extension.
* XXX this is somewhat redundant with the checks that ApiUpload.php does with incoming
* uploads versus the desired filename. Maybe we can get that passed to us...
+ * @param $path
+ * @throws UploadStashFileException
* @return string
*/
public static function getExtensionForPath( $path ) {
* @param $token string The token string
* @param $left The left operand. If it is an object, its state may be destroyed.
* @param $right The right operand
+ * @throws CLDRPluralRuleError
* @return mixed
*/
private static function doOperation( $token, $left, $right ) {
/**
* Check a language.
* @param $code string The language code.
+ * @throws MWException
* @return array The results.
*/
protected function checkLanguage( $code ) {
/**
* Check a language and show the results.
* @param $code string The language code.
+ * @throws MWException
*/
protected function checkLanguage( $code ) {
foreach( $this->extensions as $extension ) {
/**
* @params $config Array
+ * @param array $config
+ * @throws Exception
* @return LockServerDaemon
*/
public static function init( array $config ) {
}
/**
+ * @throws Exception
* @return void
*/
protected function setupServerSocket() {
* Checks given files for correctness of SQL syntax. MySQL DDL will be converted to
* SQLite-compatible during processing.
* Will throw exceptions on SQL errors
+ * @param $files
+ * @throws MWException
* @return mixed true if no error or error string in case of errors
*/
public static function checkSqlSyntax( $files ) {