*
* To add an action in an extension, create a subclass of Action, and add the key to
* $wgActions. There is also the deprecated UnknownAction hook
+ *
+ * Actions generally fall into two groups: the show-a-form-then-do-something-with-the-input
+ * format (protect, delete, move, etc), and the just-do-something format (watch, rollback,
+ * patrol, etc). The FormAction and FormlessAction classes respresent these two groups.
*/
abstract class Action {
/**
* Page on which we're performing the action
- * @var Page
+ * @var Page $page
*/
protected $page;
/**
* IContextSource if specified; otherwise we'll use the Context from the Page
- * @var IContextSource
+ * @var IContextSource $context
*/
protected $context;
/**
* The fields used to create the HTMLForm
- * @var Array
+ * @var Array $fields
*/
protected $fields;
public abstract function execute();
}
+/**
+ * An action which shows a form and does something based on the input from the form
+ */
abstract class FormAction extends Action {
/**
/**
* @see Action::execute()
* @throws ErrorPageError
- * @param array|null $data
- * @param bool $captureErrors
+ * @param $data array|null
+ * @param $captureErrors bool
* @return bool
*/
public function execute( array $data = null, $captureErrors = true ) {
}
/**
- * Actions generally fall into two groups: the show-a-form-then-do-something-with-the-input
- * format (protect, delete, move, etc), and the just-do-something format (watch, rollback,
- * patrol, etc).
+ * An action which just does something, without showing a form first.
*/
abstract class FormlessAction extends Action {
return false;
}
+ /**
+ * @param $data Array
+ * @return bool
+ */
public function onSubmit( $data ) {
return false;
}
+ /**
+ * @return bool
+ */
public function onSuccess() {
return false;
}
* @ingroup Ajax
*/
class AjaxDispatcher {
- /** The way the request was made, either a 'get' or a 'post' */
+ /**
+ * The way the request was made, either a 'get' or a 'post'
+ * @var string $mode
+ */
private $mode;
- /** Name of the requested handler */
+ /**
+ * Name of the requested handler
+ * @var string $func_name
+ */
private $func_name;
- /** Arguments passed */
+ /** Arguments passed
+ * @var array $args
+ */
private $args;
- /** Load up our object with user supplied data */
+ /**
+ * Load up our object with user supplied data
+ */
function __construct() {
wfProfileIn( __METHOD__ );
wfProfileOut( __METHOD__ );
}
- /** Pass the request to our internal function.
+ /**
+ * Pass the request to our internal function.
* BEWARE! Data are passed as they have been supplied by the user,
* they should be carefully handled in the function processing the
* request.
* @ingroup Ajax
*/
class AjaxResponse {
- /** Number of seconds to get the response cached by a proxy */
+
+ /**
+ * Number of seconds to get the response cached by a proxy
+ * @var int $mCacheDuration
+ */
private $mCacheDuration;
- /** HTTP header Content-Type */
+ /**
+ * HTTP header Content-Type
+ * @var string $mContentType
+ */
private $mContentType;
- /** Disables output. Can be set by calling $AjaxResponse->disable() */
+ /**
+ * Disables output. Can be set by calling $AjaxResponse->disable()
+ * @var bool $mDisabled
+ */
private $mDisabled;
- /** Date for the HTTP header Last-modified */
+ /**
+ * Date for the HTTP header Last-modified
+ * @var string|false $mLastModified
+ */
private $mLastModified;
- /** HTTP response code */
+ /**
+ * HTTP response code
+ * @var string $mResponseCode
+ */
private $mResponseCode;
- /** HTTP Vary header */
+ /**
+ * HTTP Vary header
+ * @var string $mVary
+ */
private $mVary;
- /** Content of our HTTP response */
+ /**
+ * Content of our HTTP response
+ * @var string $mText
+ */
private $mText;
/**
}
}
+ /**
+ * Set the number of seconds to get the response cached by a proxy
+ * @param $duration int
+ */
function setCacheDuration( $duration ) {
$this->mCacheDuration = $duration;
}
+ /**
+ * Set the HTTP Vary header
+ * @param $vary string
+ */
function setVary( $vary ) {
$this->mVary = $vary;
}
+ /**
+ * Set the HTTP response code
+ * @param $code string
+ */
function setResponseCode( $code ) {
$this->mResponseCode = $code;
}
+ /**
+ * Set the HTTP header Content-Type
+ * @param $type string
+ */
function setContentType( $type ) {
$this->mContentType = $type;
}
+ /**
+ * Disable output.
+ */
function disable() {
$this->mDisabled = true;
}
}
/**
- * @param $mckey
- * @param $touched
+ * @param $mckey string
+ * @param $touched int
* @return bool
*/
function loadFromMemcached( $mckey, $touched ) {
}
/**
- * @param $mckey
+ * @param $mckey string
* @param $expiry int
* @return bool
*/
*
* This maintains WikiPage functions for backwards compatibility.
*
- * @TODO: move and rewrite code to an Action class
+ * @todo move and rewrite code to an Action class
*
* See design.txt for an overview.
* Note: edit user interface and cache support functions have been
*/
/**
- * @var IContextSource
+ * The context this Article is executed in
+ * @var IContextSource $mContext
*/
protected $mContext;
/**
- * @var WikiPage
+ * The WikiPage object of this instance
+ * @var WikiPage $mPage
*/
protected $mPage;
/**
- * @var ParserOptions: ParserOptions object for $wgUser articles
+ * ParserOptions object for $wgUser articles
+ * @var ParserOptions $mParserOptions
*/
public $mParserOptions;
+ /**
+ * Content of the revision we are working on
+ * @var string $mContent
+ */
var $mContent; // !<
+
+ /**
+ * Is the content ($mContent) already loaded?
+ * @var bool $mContentLoaded
+ */
var $mContentLoaded = false; // !<
+
+ /**
+ * The oldid of the article that is to be shown, 0 for the
+ * current revision
+ * @var int|null $mOldId
+ */
var $mOldId; // !<
/**
- * @var Title
+ * Title from which we were redirected here
+ * @var Title $mRedirectedFrom
*/
var $mRedirectedFrom = null;
/**
- * @var mixed: boolean false or URL string
+ * URL to redirect to or false if none
+ * @var string|false $mRedirectUrl
*/
var $mRedirectUrl = false; // !<
+
+ /**
+ * Revision ID of revision we are working on
+ * @var int $mRevIdFetched
+ */
var $mRevIdFetched = 0; // !<
/**
- * @var Revision
+ * Revision we are working on
+ * @var Revision $mRevision
*/
var $mRevision = null;
/**
- * @var ParserOutput
+ * ParserOutput object
+ * @var ParserOutput $mParserOutput
*/
var $mParserOutput;
* merging of several policies using array_merge().
* @param $policy Mixed, returns empty array on null/false/'', transparent
* to already-converted arrays, converts String.
- * @return Array: 'index' => <indexpolicy>, 'follow' => <followpolicy>
+ * @return Array: 'index' => \<indexpolicy\>, 'follow' => \<followpolicy\>
*/
public static function formatRobotPolicy( $policy ) {
if ( is_array( $policy ) ) {
/**
* Handle action=purge
* @deprecated since 1.19
+ * @return Action|bool|null false if the action is disabled, null if it is not recognised
*/
public function purge() {
return Action::factory( 'purge', $this )->show();
/**
* If you want to munge the case of an account name before the final
* check, now is your chance.
+ * @param $username string
+ * @return string
*/
public function getCanonicalName( $username ) {
return $username;
* Sanitizer that have define()s outside of their class definition. Of course
* this wouldn't be necessary if everything in MediaWiki was class-based. Sigh.
*
+ * @param $class string
* @return Boolean Return the results of class_exists() so we know if we were successful
*/
static function loadClass( $class ) {
* @file
*/
-if ( !defined( 'MEDIAWIKI' ) )
- die( 1 );
-
/**
* Special handling for category description pages, showing pages,
* subcategories and file that belong to the category
* @file
*/
-if ( !defined( 'MEDIAWIKI' ) )
- die( 1 );
-
class CategoryViewer extends ContextSource {
var $limit, $from, $until,
$articles, $articles_start_char,
* @file
*/
-if ( ! defined( 'MEDIAWIKI' ) )
- die( 1 );
-
/**
* Image gallery
*
* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- die( 1 );
-}
-
/**
* This class should be covered by a general architecture document which does
* not exist as of January 2011. This is one of the Core classes and should
* @defgroup Skins Skins
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- die( 1 );
-}
-
/**
* The main skin class that provide methods and properties for all other skins.
* This base class is also the "Standard" skin.
* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- die( 1 );
-}
-
class SkinLegacy extends SkinTemplate {
var $useHeadElement = true;
protected $mWatchLinkNum = 0; // Appended to end of watch link id's
* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- die( 1 );
-}
-
/**
* Wrapper object for MediaWiki's localization functions,
* to be passed to the template engine.
*/
private function getContextResult(){
$warnings = $this->getApiWarnings();
- if ( $warnings && !$this->mParams['ignorewarnings'] ) {
+ if ( $warnings ) {
// Get warnings formated in result array format
return $this->getWarningsResult( $warnings );
} elseif ( $this->mParams['chunk'] ) {
// Add chunk, and get result
- return $this->getChunkResult( $warnings );
+ return $this->getChunkResult();
} elseif ( $this->mParams['stash'] ) {
// Stash the file and get stash result
- return $this->getStashResult( $warnings );
+ return $this->getStashResult();
}
// This is the most common case -- a normal upload with no warnings
// performUpload will return a formatted properly for the API with status
- return $this->performUpload( $warnings );
+ return $this->performUpload();
}
/**
* Get Stash Result, throws an expetion if the file could not be stashed.
* @return array
*/
- private function getStashResult( $warnings ){
+ private function getStashResult(){
$result = array ();
// Some uploads can request they be stashed, so as not to publish them immediately.
// In this case, a failure to stash ought to be fatal
$result['result'] = 'Success';
$result['filekey'] = $this->performStash();
$result['sessionkey'] = $result['filekey']; // backwards compatibility
- $result['warnings'] = $warnings;
} catch ( MWException $e ) {
$this->dieUsage( $e->getMessage(), 'stashfailed' );
}
* Get the result of a chunk upload.
* @return array
*/
- private function getChunkResult( $warnings ){
+ private function getChunkResult(){
$result = array();
$result['result'] = 'Continue';
- $result['warnings'] = $warnings;
$request = $this->getMain()->getRequest();
$chunkPath = $request->getFileTempname( 'chunk' );
$chunkSize = $request->getUpload( 'chunk' )->getSize();
protected function getApiWarnings() {
$warnings = array();
- $warnings = $this->mUpload->checkWarnings();
-
+ if ( !$this->mParams['ignorewarnings'] ) {
+ $warnings = $this->mUpload->checkWarnings();
+ }
return $this->transformWarnings( $warnings );
}
*
* @return array
*/
- protected function performUpload( $warnings ) {
+ protected function performUpload() {
// Use comment as initial page text by default
if ( is_null( $this->mParams['text'] ) ) {
$this->mParams['text'] = $this->mParams['comment'];
$result['result'] = 'Success';
$result['filename'] = $file->getName();
- $result['warnings'] = $warnings;
return $result;
}
* @defgroup JobQueue JobQueue
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- die( "This file is part of MediaWiki, it is not a valid entry point\n" );
-}
-
/**
* Class to both describe a background job and handle jobs.
*
* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- die( 1 );
-}
-
require_once dirname( __FILE__ ) . '/Services_JSON.php';
/**
* @author Roan Kattouw
*/
-defined( 'MEDIAWIKI' ) || die( 1 );
-
/**
* Abstraction for resource loader modules which pull from wiki pages
*
* @ingroup SpecialPage
*/
-if (!defined('MEDIAWIKI'))
- die;
-
/**
* A special page that lists tags for edits
*
protected function doSha1LegacyUpdates() {
$count = 0;
$db = $this->getDB( DB_MASTER );
- $res = $db->select( 'archive', '*', array( 'ar_rev_id IS NULL' ), __METHOD__ );
+ $res = $db->select( 'archive', '*',
+ array( 'ar_rev_id IS NULL', 'ar_sha1' => '' ), __METHOD__ );
$updateSize = 0;
$db->begin( __METHOD__ );