From 96641da58e81237076e6940c2c84e8ae36b9dded Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Wed, 26 Oct 2011 03:44:47 +0000 Subject: [PATCH] Add, update, tweak documentation Fix document comment blocks Tweak some returns --- includes/Action.php | 4 + includes/AjaxResponse.php | 10 + includes/Article.php | 60 ++++- includes/Exception.php | 13 ++ includes/GenderCache.php | 2 +- includes/ImagePage.php | 4 + includes/Import.php | 251 +++++++++++++++++++-- includes/OutputPage.php | 5 +- includes/Preferences.php | 2 +- includes/Sanitizer.php | 2 +- includes/StubObject.php | 3 +- includes/UserMailer.php | 13 +- includes/UserRightsProxy.php | 17 +- includes/db/Database.php | 4 +- includes/db/DatabaseIbm_db2.php | 24 +- includes/media/SVGMetadataExtractor.php | 2 +- includes/specials/SpecialContributions.php | 2 +- includes/specials/SpecialUserlogin.php | 6 +- 18 files changed, 375 insertions(+), 49 deletions(-) diff --git a/includes/Action.php b/includes/Action.php index 9958be9d04..9f362d121f 100644 --- a/includes/Action.php +++ b/includes/Action.php @@ -290,6 +290,10 @@ abstract class FormAction extends Action { * @return String HTML which will be sent to $form->addPreText() */ protected function preText() { return ''; } + + /** + * @return string + */ protected function postText() { return ''; } /** diff --git a/includes/AjaxResponse.php b/includes/AjaxResponse.php index b9f8085557..31d9478f3f 100644 --- a/includes/AjaxResponse.php +++ b/includes/AjaxResponse.php @@ -193,6 +193,11 @@ class AjaxResponse { } } + /** + * @param $mckey + * @param $touched + * @return bool + */ function loadFromMemcached( $mckey, $touched ) { global $wgMemc; @@ -216,6 +221,11 @@ class AjaxResponse { return false; } + /** + * @param $mckey + * @param $expiry int + * @return bool + */ function storeInMemcached( $mckey, $expiry = 86400 ) { global $wgMemc; diff --git a/includes/Article.php b/includes/Article.php index 432f3774ff..5c9257985e 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -591,7 +591,7 @@ class Article extends Page { wfProfileOut( __METHOD__ ); } - /* + /** * Adjust title for pages with displaytitle, -{T|}- or language conversion * @param $pOutput ParserOutput */ @@ -1884,7 +1884,7 @@ class Article extends Page { /** * 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; @@ -1969,47 +1969,103 @@ class Article extends Page { } // ****** 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 ); } diff --git a/includes/Exception.php b/includes/Exception.php index b1e788f86c..2e3dc636cc 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -119,6 +119,7 @@ class MWException extends Exception { /** * If $wgShowExceptionDetails is true, return a text message with a * backtrace to the error. + * @return string */ function getText() { global $wgShowExceptionDetails; @@ -214,6 +215,10 @@ class MWException extends Exception { } } + /** + * @static + * @return bool + */ static function isCommandLine() { return !empty( $GLOBALS['wgCommandLineMode'] ); } @@ -225,10 +230,17 @@ class MWException extends Exception { * @ingroup Exception */ class FatalError extends MWException { + + /** + * @return string + */ function getHTML() { return $this->getMessage(); } + /** + * @return string + */ function getText() { return $this->getMessage(); } @@ -326,6 +338,7 @@ class ThrottledError extends ErrorPageError { 'actionthrottledtext' ); } + public function report(){ global $wgOut; $wgOut->setStatusCode( 503 ); diff --git a/includes/GenderCache.php b/includes/GenderCache.php index a17ac024fc..342f8dba83 100644 --- a/includes/GenderCache.php +++ b/includes/GenderCache.php @@ -111,7 +111,7 @@ class GenderCache { } if ( count( $users ) === 0 ) { - return false; + return; } $dbr = wfGetDB( DB_SLAVE ); diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 9a017daae2..7950aafd8a 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -18,6 +18,10 @@ class ImagePage extends Article { var $mExtraDescription = false; + /** + * @param $title Title + * @return WikiFilePage + */ protected function newPage( Title $title ) { // Overload mPage with a file-specific page return new WikiFilePage( $title ); diff --git a/includes/Import.php b/includes/Import.php index 0a1824ca16..502b015b13 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -91,7 +91,7 @@ class WikiImporter { function setDebug( $debug ) { $this->mDebug = $debug; } - + /** * Set 'no updates' mode. In this mode, the link tables will not be updated by the importer */ @@ -183,13 +183,17 @@ class WikiImporter { return false; } } - + /** - * + * @parma $dir */ public function setImageBasePath( $dir ) { $this->mImageBasePath = $dir; } + + /** + * @param $import + */ public function setImportUploads( $import ) { $this->mImportUploads = $import; } @@ -411,6 +415,10 @@ class WikiImporter { 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. @@ -452,6 +460,10 @@ class WikiImporter { $this->processLogItem( $logInfo ); } + /** + * @param $logInfo + * @return bool|mixed + */ private function processLogItem( $logInfo ) { $revision = new WikiRevision; @@ -531,6 +543,9 @@ class WikiImporter { $pageInfo ); } + /** + * @param $pageInfo + */ private function handleRevision( &$pageInfo ) { $this->debug( "Enter revision handler" ); $revisionInfo = array(); @@ -566,6 +581,11 @@ class WikiImporter { } } + /** + * @param $pageInfo + * @param $revisionInfo + * @return bool|mixed + */ private function processRevision( $pageInfo, $revisionInfo ) { $revision = new WikiRevision; @@ -601,6 +621,10 @@ class WikiImporter { return $this->revisionCallback( $revision ); } + /** + * @param $pageInfo + * @return mixed + */ private function handleUpload( &$pageInfo ) { $this->debug( "Enter upload handler" ); $uploadInfo = array(); @@ -637,7 +661,7 @@ class WikiImporter { $skip = true; } } - + if ( $this->mImageBasePath && isset( $uploadInfo['rel'] ) ) { $path = "{$this->mImageBasePath}/{$uploadInfo['rel']}"; if ( file_exists( $path ) ) { @@ -650,14 +674,22 @@ class WikiImporter { 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'] : ''; @@ -692,6 +724,9 @@ class WikiImporter { return call_user_func( $this->mUploadCallback, $revision ); } + /** + * @return array + */ private function handleContributor() { $fields = array( 'id', 'ip', 'username' ); $info = array(); @@ -713,6 +748,7 @@ class WikiImporter { } /** + * @param $text string * @return Array or false */ private function processTitle( $text ) { @@ -757,6 +793,10 @@ class UploadSourceAdapter { private $mBuffer; private $mPosition; + /** + * @param $source + * @return string + */ static function registerSource( $source ) { $id = wfGenerateToken(); @@ -765,6 +805,13 @@ class UploadSourceAdapter { 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']; @@ -778,6 +825,10 @@ class UploadSourceAdapter { return true; } + /** + * @param $count + * @return string + */ function stream_read( $count ) { $return = ''; $leave = false; @@ -803,18 +854,31 @@ class UploadSourceAdapter { 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(); @@ -837,6 +901,10 @@ class UploadSourceAdapter { } class XMLReader2 extends XMLReader { + + /** + * @return bool|string + */ function nodeContents() { if( $this->isEmptyElement ) { return ""; @@ -879,6 +947,10 @@ class WikiRevision { var $archiveName = ''; private $mNoUpdates = false; + /** + * @param $title + * @throws MWException + */ function setTitle( $title ) { if( is_object( $title ) ) { $this->title = $title; @@ -889,57 +961,103 @@ class WikiRevision { } } + /** + * @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; } @@ -948,10 +1066,16 @@ class WikiRevision { $this->action = $action; } + /** + * @param $params + */ function setParams( $params ) { $this->params = $params; } - + + /** + * @param $noupdates + */ public function setNoUpdates( $noupdates ) { $this->mNoUpdates = $noupdates; } @@ -963,69 +1087,124 @@ class WikiRevision { 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 ); @@ -1093,6 +1272,9 @@ class WikiRevision { return true; } + /** + * @return mixed + */ function importLogItem() { $dbw = wfGetDB( DB_MASTER ); # @todo FIXME: This will not record autoblocks @@ -1118,7 +1300,7 @@ class WikiRevision { 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( @@ -1136,19 +1318,22 @@ class WikiRevision { $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" ); } @@ -1157,7 +1342,7 @@ class WikiRevision { 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; @@ -1180,16 +1365,16 @@ class WikiRevision { } $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; @@ -1199,6 +1384,9 @@ class WikiRevision { } } + /** + * @return bool|string + */ function downloadSource() { global $wgEnableUploads; if( !$wgEnableUploads ) { @@ -1247,10 +1435,9 @@ class ImportStringSource { function readChunk() { if( $this->atEnd() ) { return false; - } else { - $this->mRead = true; - return $this->mString; } + $this->mRead = true; + return $this->mString; } } @@ -1263,6 +1450,9 @@ class ImportStreamSource { $this->mHandle = $handle; } + /** + * @return bool + */ function atEnd() { return feof( $this->mHandle ); } @@ -1271,6 +1461,10 @@ class ImportStreamSource { return fread( $this->mHandle, 32768 ); } + /** + * @param $filename string + * @return Status + */ static function newFromFile( $filename ) { wfSuppressWarnings(); $file = fopen( $filename, 'rt' ); @@ -1281,6 +1475,10 @@ class ImportStreamSource { return Status::newGood( new ImportStreamSource( $file ) ); } + /** + * @param $fieldname string + * @return Status + */ static function newFromUpload( $fieldname = "xmlimport" ) { $upload =& $_FILES[$fieldname]; @@ -1309,6 +1507,11 @@ class ImportStreamSource { } } + /** + * @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 @@ -1327,6 +1530,14 @@ class ImportStreamSource { } } + /** + * @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' ); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index ad5db3c331..c4c1a72532 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -152,7 +152,10 @@ class OutputPage extends ContextSource { // Parser related. var $mContainsOldMagic = 0, $mContainsNewMagic = 0; - /// lazy initialised, use parserOptions() + /** + * lazy initialised, use parserOptions() + * @var ParserOptions + */ protected $mParserOptions = null; /** diff --git a/includes/Preferences.php b/includes/Preferences.php index bfdc538ff4..853643c85e 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -1425,7 +1425,7 @@ class Preferences { 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. diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 13ba8c1a07..478fe1eaaa 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -468,7 +468,7 @@ class Sanitizer { wfSuppressWarnings(); $ot = array_pop( $optstack ); wfRestoreWarnings(); - while ( $ot ) { + while ( $ot ) { array_push( $tagstack, $ot ); wfSuppressWarnings(); $ot = array_pop( $optstack ); diff --git a/includes/StubObject.php b/includes/StubObject.php index 951cbaea4d..be865e1e04 100644 --- a/includes/StubObject.php +++ b/includes/StubObject.php @@ -60,6 +60,7 @@ class StubObject { /** * Create a new object to replace this stub object. + * @return object */ function _newObject() { return MWFunction::newObj( $this->mClass, $this->mParams ); @@ -91,7 +92,7 @@ class StubObject { 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 ); diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 0789f555d3..f4b9d59b3f 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -348,9 +348,19 @@ class UserMailer { */ 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. @@ -632,6 +642,7 @@ class EmailNotification { * depending on settings. * * Call sendMails() to send any mails that were queued. + * @param $user User */ function compose( $user ) { global $wgEnotifImpersonal; diff --git a/includes/UserRightsProxy.php b/includes/UserRightsProxy.php index 6c2a5f1201..dfce8adf77 100644 --- a/includes/UserRightsProxy.php +++ b/includes/UserRightsProxy.php @@ -85,6 +85,13 @@ class UserRightsProxy { 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 ) { @@ -122,10 +129,16 @@ class UserRightsProxy { return null; } + /** + * @return int + */ public function getId() { return $this->id; } + /** + * @return bool + */ public function isAnon() { return $this->getId() == 0; } @@ -187,14 +200,14 @@ class UserRightsProxy { ), __METHOD__ ); } - + /** * Replaces User::setOption() */ public function setOption( $option, $value ) { $this->newOptions[$option] = $value; } - + public function saveSettings() { $rows = array(); foreach ( $this->newOptions as $option => $value ) { diff --git a/includes/db/Database.php b/includes/db/Database.php index 06af308a58..5015462b63 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -610,7 +610,7 @@ abstract class DatabaseBase implements DatabaseType { /** * 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() { @@ -807,7 +807,7 @@ abstract class DatabaseBase implements DatabaseType { # 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(); } diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index 056ad9b71a..2f225d530e 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -460,16 +460,16 @@ class DatabaseIbm_db2 extends DatabaseBase { */ 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( "
$sql
" ); $this->installPrint( $error ); throw new DBUnexpectedError( $this, 'SQL error: ' @@ -494,8 +494,8 @@ class DatabaseIbm_db2 extends DatabaseBase { */ 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 ) . "'"; @@ -939,14 +939,14 @@ class DatabaseIbm_db2 extends DatabaseBase { */ 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 ); @@ -1046,7 +1046,7 @@ class DatabaseIbm_db2 extends DatabaseBase { if ( $res instanceof ResultWrapper ) { $res = $res->result; } - + if ( $this->mNumRows ) { return $this->mNumRows; } else { diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index 22ef8e6186..f20482b4c7 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -166,7 +166,7 @@ class SVGReader { } } - /* + /** * Read an XML snippet from an element * * @param String $metafield that we will fill with the result diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 5dc8f97962..ee9ae08275 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -571,7 +571,7 @@ class ContribsPager extends ReverseChronologicalPager { } } - /* + /** * Do a batched query to get the parent revision lengths */ private function getParentLengths( array $revIds ) { diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index f73bfb7dcd..f06c307aea 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -602,7 +602,7 @@ class LoginForm extends SpecialPage { 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 @@ -631,7 +631,7 @@ class LoginForm extends SpecialPage { return $throttleCount; } - /* + /** * Clear the login attempt throttle hit count for the (username,current IP) tuple. * @param $username string The user name * @return void @@ -1049,7 +1049,7 @@ class LoginForm extends SpecialPage { 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'; -- 2.20.1