* @return String HTML which will be sent to $form->addPreText()
*/
protected function preText() { return ''; }
+
+ /**
+ * @return string
+ */
protected function postText() { return ''; }
/**
}
}
+ /**
+ * @param $mckey
+ * @param $touched
+ * @return bool
+ */
function loadFromMemcached( $mckey, $touched ) {
global $wgMemc;
return false;
}
+ /**
+ * @param $mckey
+ * @param $expiry int
+ * @return bool
+ */
function storeInMemcached( $mckey, $expiry = 86400 ) {
global $wgMemc;
wfProfileOut( __METHOD__ );
}
- /*
+ /**
* Adjust title for pages with displaytitle, -{T|}- or language conversion
* @param $pOutput ParserOutput
*/
/**
* Get parser options suitable for rendering the primary article wikitext
- * @return mixed ParserOptions object or boolean false
+ * @return ParserOptions|false
*/
public function getParserOptions() {
global $wgUser;
}
// ****** B/C functions to work-around PHP silliness with __call and references ****** //
+
+ /**
+ * @param $limit array
+ * @param $reason string
+ * @param $cascade int
+ * @param $expiry array
+ * @return bool
+ */
public function updateRestrictions( $limit = array(), $reason = '', &$cascade = 0, $expiry = array() ) {
return $this->mPage->updateRestrictions( $limit, $reason, $cascade, $expiry );
}
+ /**
+ * @param $reason string
+ * @param $suppress bool
+ * @param $id int
+ * @param $commit bool
+ * @param $error string
+ * @return bool
+ */
public function doDeleteArticle( $reason, $suppress = false, $id = 0, $commit = true, &$error = '' ) {
return $this->mPage->doDeleteArticle( $reason, $suppress, $id, $commit, $error );
}
+ /**
+ * @param $fromP
+ * @param $summary
+ * @param $token
+ * @param $bot
+ * @param $resultDetails
+ * @param $user User
+ * @return array
+ */
public function doRollback( $fromP, $summary, $token, $bot, &$resultDetails, User $user = null ) {
global $wgUser;
$user = is_null( $user ) ? $wgUser : $user;
return $this->mPage->doRollback( $fromP, $summary, $token, $bot, $resultDetails, $user );
}
+ /**
+ * @param $fromP
+ * @param $summary
+ * @param $bot
+ * @param $resultDetails
+ * @param $guser User
+ * @return array
+ */
public function commitRollback( $fromP, $summary, $bot, &$resultDetails, User $guser = null ) {
global $wgUser;
$guser = is_null( $guser ) ? $wgUser : $guser;
return $this->mPage->commitRollback( $fromP, $summary, $bot, $resultDetails, $guser );
}
+ /**
+ * @param $hasHistory bool
+ * @return mixed
+ */
public function generateReason( &$hasHistory ) {
return $this->mPage->getAutoDeleteReason( $hasHistory );
}
// ****** B/C functions for static methods ( __callStatic is PHP>=5.3 ) ****** //
+
+ /**
+ * @return array
+ */
public static function selectFields() {
return WikiPage::selectFields();
}
+ /**
+ * @param $title Title
+ */
public static function onArticleCreate( $title ) {
return WikiPage::onArticleCreate( $title );
}
+ /**
+ * @param $title Title
+ */
public static function onArticleDelete( $title ) {
return WikiPage::onArticleDelete( $title );
}
+ /**
+ * @param $title Title
+ */
public static function onArticleEdit( $title ) {
return WikiPage::onArticleEdit( $title );
}
+ /**
+ * @param $oldtext
+ * @param $newtext
+ * @param $flags
+ * @return string
+ */
public static function getAutosummary( $oldtext, $newtext, $flags ) {
return WikiPage::getAutosummary( $oldtext, $newtext, $flags );
}
/**
* If $wgShowExceptionDetails is true, return a text message with a
* backtrace to the error.
+ * @return string
*/
function getText() {
global $wgShowExceptionDetails;
}
}
+ /**
+ * @static
+ * @return bool
+ */
static function isCommandLine() {
return !empty( $GLOBALS['wgCommandLineMode'] );
}
* @ingroup Exception
*/
class FatalError extends MWException {
+
+ /**
+ * @return string
+ */
function getHTML() {
return $this->getMessage();
}
+ /**
+ * @return string
+ */
function getText() {
return $this->getMessage();
}
'actionthrottledtext'
);
}
+
public function report(){
global $wgOut;
$wgOut->setStatusCode( 503 );
}
if ( count( $users ) === 0 ) {
- return false;
+ return;
}
$dbr = wfGetDB( DB_SLAVE );
var $mExtraDescription = false;
+ /**
+ * @param $title Title
+ * @return WikiFilePage
+ */
protected function newPage( Title $title ) {
// Overload mPage with a file-specific page
return new WikiFilePage( $title );
function setDebug( $debug ) {
$this->mDebug = $debug;
}
-
+
/**
* Set 'no updates' mode. In this mode, the link tables will not be updated by the importer
*/
return false;
}
}
-
+
/**
- *
+ * @parma $dir
*/
public function setImageBasePath( $dir ) {
$this->mImageBasePath = $dir;
}
+
+ /**
+ * @param $import
+ */
public function setImportUploads( $import ) {
$this->mImportUploads = $import;
}
return true;
}
+ /**
+ * @return bool
+ * @throws MWException
+ */
private function handleSiteInfo() {
// Site info is useful, but not actually used for dump imports.
// Includes a quick short-circuit to save performance.
$this->processLogItem( $logInfo );
}
+ /**
+ * @param $logInfo
+ * @return bool|mixed
+ */
private function processLogItem( $logInfo ) {
$revision = new WikiRevision;
$pageInfo );
}
+ /**
+ * @param $pageInfo
+ */
private function handleRevision( &$pageInfo ) {
$this->debug( "Enter revision handler" );
$revisionInfo = array();
}
}
+ /**
+ * @param $pageInfo
+ * @param $revisionInfo
+ * @return bool|mixed
+ */
private function processRevision( $pageInfo, $revisionInfo ) {
$revision = new WikiRevision;
return $this->revisionCallback( $revision );
}
+ /**
+ * @param $pageInfo
+ * @return mixed
+ */
private function handleUpload( &$pageInfo ) {
$this->debug( "Enter upload handler" );
$uploadInfo = array();
$skip = true;
}
}
-
+
if ( $this->mImageBasePath && isset( $uploadInfo['rel'] ) ) {
$path = "{$this->mImageBasePath}/{$uploadInfo['rel']}";
if ( file_exists( $path ) ) {
return $this->processUpload( $pageInfo, $uploadInfo );
}
}
-
+
+ /**
+ * @param $contents
+ * @return string
+ */
private function dumpTemp( $contents ) {
$filename = tempnam( wfTempDir(), 'importupload' );
file_put_contents( $filename, $contents );
return $filename;
}
-
+ /**
+ * @param $pageInfo
+ * @param $uploadInfo
+ * @return mixed
+ */
private function processUpload( $pageInfo, $uploadInfo ) {
$revision = new WikiRevision;
$text = isset( $uploadInfo['text'] ) ? $uploadInfo['text'] : '';
return call_user_func( $this->mUploadCallback, $revision );
}
+ /**
+ * @return array
+ */
private function handleContributor() {
$fields = array( 'id', 'ip', 'username' );
$info = array();
}
/**
+ * @param $text string
* @return Array or false
*/
private function processTitle( $text ) {
private $mBuffer;
private $mPosition;
+ /**
+ * @param $source
+ * @return string
+ */
static function registerSource( $source ) {
$id = wfGenerateToken();
return $id;
}
+ /**
+ * @param $path
+ * @param $mode
+ * @param $options
+ * @param $opened_path
+ * @return bool
+ */
function stream_open( $path, $mode, $options, &$opened_path ) {
$url = parse_url($path);
$id = $url['host'];
return true;
}
+ /**
+ * @param $count
+ * @return string
+ */
function stream_read( $count ) {
$return = '';
$leave = false;
return $return;
}
+ /**
+ * @param $data
+ * @return bool
+ */
function stream_write( $data ) {
return false;
}
+ /**
+ * @return mixed
+ */
function stream_tell() {
return $this->mPosition;
}
+ /**
+ * @return bool
+ */
function stream_eof() {
return $this->mSource->atEnd();
}
+ /**
+ * @return array
+ */
function url_stat() {
$result = array();
}
class XMLReader2 extends XMLReader {
+
+ /**
+ * @return bool|string
+ */
function nodeContents() {
if( $this->isEmptyElement ) {
return "";
var $archiveName = '';
private $mNoUpdates = false;
+ /**
+ * @param $title
+ * @throws MWException
+ */
function setTitle( $title ) {
if( is_object( $title ) ) {
$this->title = $title;
}
}
+ /**
+ * @param $id
+ */
function setID( $id ) {
$this->id = $id;
}
+ /**
+ * @param $ts
+ */
function setTimestamp( $ts ) {
# 2003-08-05T18:30:02Z
$this->timestamp = wfTimestamp( TS_MW, $ts );
}
+ /**
+ * @param $user
+ */
function setUsername( $user ) {
$this->user_text = $user;
}
+ /**
+ * @param $ip
+ */
function setUserIP( $ip ) {
$this->user_text = $ip;
}
+ /**
+ * @param $text
+ */
function setText( $text ) {
$this->text = $text;
}
+ /**
+ * @param $text
+ */
function setComment( $text ) {
$this->comment = $text;
}
+ /**
+ * @param $minor
+ */
function setMinor( $minor ) {
$this->minor = (bool)$minor;
}
+ /**
+ * @param $src
+ */
function setSrc( $src ) {
$this->src = $src;
}
+
+ /**
+ * @param $src
+ * @param $isTemp
+ */
function setFileSrc( $src, $isTemp ) {
$this->fileSrc = $src;
$this->fileIsTemp = $isTemp;
}
- function setSha1Base36( $sha1base36 ) {
+
+ /**
+ * @param $sha1base36
+ */
+ function setSha1Base36( $sha1base36 ) {
$this->sha1base36 = $sha1base36;
}
+ /**
+ * @param $filename
+ */
function setFilename( $filename ) {
$this->filename = $filename;
}
+
+ /**
+ * @param $archiveName
+ */
function setArchiveName( $archiveName ) {
$this->archiveName = $archiveName;
}
+ /**
+ * @param $size
+ */
function setSize( $size ) {
$this->size = intval( $size );
}
+ /**
+ * @param $type
+ */
function setType( $type ) {
$this->type = $type;
}
$this->action = $action;
}
+ /**
+ * @param $params
+ */
function setParams( $params ) {
$this->params = $params;
}
-
+
+ /**
+ * @param $noupdates
+ */
public function setNoUpdates( $noupdates ) {
$this->mNoUpdates = $noupdates;
}
return $this->title;
}
+ /**
+ * @return int
+ */
function getID() {
return $this->id;
}
+ /**
+ * @return string
+ */
function getTimestamp() {
return $this->timestamp;
}
+ /**
+ * @return string
+ */
function getUser() {
return $this->user_text;
}
+ /**
+ * @return string
+ */
function getText() {
return $this->text;
}
+ /**
+ * @return string
+ */
function getComment() {
return $this->comment;
}
+ /**
+ * @return bool
+ */
function getMinor() {
return $this->minor;
}
+ /**
+ * @return mixed
+ */
function getSrc() {
return $this->src;
}
+
+ /**
+ * @return bool|String
+ */
function getSha1() {
if ( $this->sha1base36 ) {
return wfBaseConvert( $this->sha1base36, 36, 16 );
}
return false;
}
+
+ /**
+ * @return string
+ */
function getFileSrc() {
return $this->fileSrc;
}
+
+ /**
+ * @return bool
+ */
function isTempSrc() {
return $this->isTemp;
}
+ /**
+ * @return mixed
+ */
function getFilename() {
return $this->filename;
}
+
+ /**
+ * @return string
+ */
function getArchiveName() {
return $this->archiveName;
}
+ /**
+ * @return mixed
+ */
function getSize() {
return $this->size;
}
+ /**
+ * @return string
+ */
function getType() {
return $this->type;
}
+ /**
+ * @return string
+ */
function getAction() {
return $this->action;
}
+ /**
+ * @return string
+ */
function getParams() {
return $this->params;
}
+ /**
+ * @return bool
+ */
function importOldRevision() {
$dbw = wfGetDB( DB_MASTER );
return true;
}
+ /**
+ * @return mixed
+ */
function importLogItem() {
$dbw = wfGetDB( DB_MASTER );
# @todo FIXME: This will not record autoblocks
if( $prior ) {
wfDebug( __METHOD__ . ": skipping existing item for Log:{$this->type}/{$this->action}, timestamp " .
$this->timestamp . "\n" );
- return false;
+ return;
}
$log_id = $dbw->nextSequenceValue( 'logging_log_id_seq' );
$data = array(
$dbw->insert( 'logging', $data, __METHOD__ );
}
+ /**
+ * @return bool
+ */
function importUpload() {
# Construct a file
$archiveName = $this->getArchiveName();
if ( $archiveName ) {
wfDebug( __METHOD__ . "Importing archived file as $archiveName\n" );
- $file = OldLocalFile::newFromArchiveName( $this->getTitle(),
- RepoGroup::singleton()->getLocalRepo(), $archiveName );
+ $file = OldLocalFile::newFromArchiveName( $this->getTitle(),
+ RepoGroup::singleton()->getLocalRepo(), $archiveName );
} else {
$file = wfLocalFile( $this->getTitle() );
wfDebug( __METHOD__ . 'Importing new file as ' . $file->getName() . "\n" );
if ( $file->exists() && $file->getTimestamp() > $this->getTimestamp() ) {
$archiveName = $file->getTimestamp() . '!' . $file->getName();
- $file = OldLocalFile::newFromArchiveName( $this->getTitle(),
+ $file = OldLocalFile::newFromArchiveName( $this->getTitle(),
RepoGroup::singleton()->getLocalRepo(), $archiveName );
wfDebug( __METHOD__ . "File already exists; importing as $archiveName\n" );
}
wfDebug( __METHOD__ . ': Bad file for ' . $this->getTitle() . "\n" );
return false;
}
-
+
# Get the file source or download if necessary
$source = $this->getFileSrc();
$flags = $this->isTempSrc() ? File::DELETE_SOURCE : 0;
}
$user = User::newFromName( $this->user_text );
-
+
# Do the actual upload
if ( $archiveName ) {
- $status = $file->uploadOld( $source, $archiveName,
+ $status = $file->uploadOld( $source, $archiveName,
$this->getTimestamp(), $this->getComment(), $user, $flags );
} else {
- $status = $file->upload( $source, $this->getComment(), $this->getComment(),
+ $status = $file->upload( $source, $this->getComment(), $this->getComment(),
$flags, false, $this->getTimestamp(), $user );
}
-
+
if ( $status->isGood() ) {
wfDebug( __METHOD__ . ": Succesful\n" );
return true;
}
}
+ /**
+ * @return bool|string
+ */
function downloadSource() {
global $wgEnableUploads;
if( !$wgEnableUploads ) {
function readChunk() {
if( $this->atEnd() ) {
return false;
- } else {
- $this->mRead = true;
- return $this->mString;
}
+ $this->mRead = true;
+ return $this->mString;
}
}
$this->mHandle = $handle;
}
+ /**
+ * @return bool
+ */
function atEnd() {
return feof( $this->mHandle );
}
return fread( $this->mHandle, 32768 );
}
+ /**
+ * @param $filename string
+ * @return Status
+ */
static function newFromFile( $filename ) {
wfSuppressWarnings();
$file = fopen( $filename, 'rt' );
return Status::newGood( new ImportStreamSource( $file ) );
}
+ /**
+ * @param $fieldname string
+ * @return Status
+ */
static function newFromUpload( $fieldname = "xmlimport" ) {
$upload =& $_FILES[$fieldname];
}
}
+ /**
+ * @param $url
+ * @param $method string
+ * @return Status
+ */
static function newFromURL( $url, $method = 'GET' ) {
wfDebug( __METHOD__ . ": opening $url\n" );
# Use the standard HTTP fetch function; it times out
}
}
+ /**
+ * @param $interwiki
+ * @param $page
+ * @param $history bool
+ * @param $templates bool
+ * @param $pageLinkDepth int
+ * @return Status
+ */
public static function newFromInterwiki( $interwiki, $page, $history = false, $templates = false, $pageLinkDepth = 0 ) {
if( $page == '' ) {
return Status::newFatal( 'import-noarticle' );
// Parser related.
var $mContainsOldMagic = 0, $mContainsNewMagic = 0;
- /// lazy initialised, use parserOptions()
+ /**
+ * lazy initialised, use parserOptions()
+ * @var ParserOptions
+ */
protected $mParserOptions = null;
/**
return Status::newGood();
}
- /*
+ /**
* Try to set a user's email address.
* This does *not* try to validate the address.
* Caller is responsible for checking $wgAuth.
wfSuppressWarnings();
$ot = array_pop( $optstack );
wfRestoreWarnings();
- while ( $ot ) {
+ while ( $ot ) {
array_push( $tagstack, $ot );
wfSuppressWarnings();
$ot = array_pop( $optstack );
/**
* Create a new object to replace this stub object.
+ * @return object
*/
function _newObject() {
return MWFunction::newObj( $this->mClass, $this->mParams );
if ( !($GLOBALS[$this->mGlobal] instanceof StubObject) )
return $GLOBALS[$this->mGlobal]; // already unstubbed.
-
+
if ( get_class( $GLOBALS[$this->mGlobal] ) != $this->mClass ) {
$fname = __METHOD__.'-'.$this->mGlobal;
wfProfileIn( $fname );
*/
class EmailNotification {
protected $to, $subject, $body, $replyto, $from;
- protected $user, $title, $timestamp, $summary, $minorEdit, $oldid, $composed_common, $editor;
+ protected $timestamp, $summary, $minorEdit, $oldid, $composed_common;
protected $mailTargets = array();
+ /**
+ * @var Title
+ */
+ protected $title;
+
+ /**
+ * @var User
+ */
+ protected $user, $editor;
+
/**
* Send emails corresponding to the user $editor editing the page $title.
* Also updates wl_notificationtimestamp.
* depending on settings.
*
* Call sendMails() to send any mails that were queued.
+ * @param $user User
*/
function compose( $user ) {
global $wgEnotifImpersonal;
return self::newFromLookup( $database, 'user_name', $name, $ignoreInvalidDB );
}
+ /**
+ * @param $database
+ * @param $field
+ * @param $value
+ * @param $ignoreInvalidDB bool
+ * @return null|UserRightsProxy
+ */
private static function newFromLookup( $database, $field, $value, $ignoreInvalidDB = false ) {
$db = self::getDB( $database, $ignoreInvalidDB );
if( $db ) {
return null;
}
+ /**
+ * @return int
+ */
public function getId() {
return $this->id;
}
+ /**
+ * @return bool
+ */
public function isAnon() {
return $this->getId() == 0;
}
),
__METHOD__ );
}
-
+
/**
* Replaces User::setOption()
*/
public function setOption( $option, $value ) {
$this->newOptions[$option] = $value;
}
-
+
public function saveSettings() {
$rows = array();
foreach ( $this->newOptions as $option => $value ) {
/**
* Called by serialize. Throw an exception when DB connection is serialized.
- * This causes problems on some database engines because the connection is
+ * This causes problems on some database engines because the connection is
* not restored on unserialize.
*/
public function __sleep() {
# that would delay transaction initializations to once connection
# is really used by application
$sqlstart = substr( $sql, 0, 10 ); // very much worth it, benchmark certified(tm)
- if ( strpos( $sqlstart, "SHOW " ) !== 0 and strpos( $sqlstart, "SET " ) !== 0 )
+ if ( strpos( $sqlstart, "SHOW " ) !== 0 && strpos( $sqlstart, "SET " ) !== 0 )
$this->begin();
}
*/
protected function doQuery( $sql ) {
$this->applySchema();
-
+
// Needed to handle any UTF-8 encoding issues in the raw sql
// Note that we fully support prepared statements for DB2
// prepare() and execute() should be used instead of doQuery() whenever possible
$sql = utf8_decode($sql);
-
+
$ret = db2_exec( $this->mConn, $sql, $this->mStmtOptions );
if( $ret == false ) {
$error = db2_stmt_errormsg();
-
+
$this->installPrint( "<pre>$sql</pre>" );
$this->installPrint( $error );
throw new DBUnexpectedError( $this, 'SQL error: '
*/
public function tableExists( $table ) {
$schema = $this->mSchema;
-
- $sql = "SELECT COUNT( * ) FROM SYSIBM.SYSTABLES ST WHERE ST.NAME = '" .
+
+ $sql = "SELECT COUNT( * ) FROM SYSIBM.SYSTABLES ST WHERE ST.NAME = '" .
strtoupper( $table ) .
"' AND ST.CREATOR = '" .
strtoupper( $schema ) . "'";
*/
private function removeNullPrimaryKeys( $table, $args ) {
$schema = $this->mSchema;
-
+
// find out the primary keys
- $keyres = $this->doQuery( "SELECT NAME FROM SYSIBM.SYSCOLUMNS WHERE TBNAME = '"
- . strtoupper( $table )
- . "' AND TBCREATOR = '"
- . strtoupper( $schema )
+ $keyres = $this->doQuery( "SELECT NAME FROM SYSIBM.SYSCOLUMNS WHERE TBNAME = '"
+ . strtoupper( $table )
+ . "' AND TBCREATOR = '"
+ . strtoupper( $schema )
. "' AND KEYSEQ > 0" );
-
+
$keys = array();
for (
$row = $this->fetchRow( $keyres );
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
-
+
if ( $this->mNumRows ) {
return $this->mNumRows;
} else {
}
}
- /*
+ /**
* Read an XML snippet from an element
*
* @param String $metafield that we will fill with the result
}
}
- /*
+ /**
* Do a batched query to get the parent revision lengths
*/
private function getParentLengths( array $revIds ) {
return $retval;
}
- /*
+ /**
* Increment the login attempt throttle hit count for the (username,current IP)
* tuple unless the throttle was already reached.
* @param $username string The user name
return $throttleCount;
}
- /*
+ /**
* Clear the login attempt throttle hit count for the (username,current IP) tuple.
* @param $username string The user name
* @return void
if( $this->mLanguage )
$template->set( 'uselang', $this->mLanguage );
}
-
+
// Use loginend-https for HTTPS requests if it's not blank, loginend otherwise
// Ditto for signupend
$usingHTTPS = WebRequest::detectProtocol() == 'https';