From a4e5e935b6fb3b6e221fb8b3f2daf70b3b756cd0 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 11 Dec 2009 21:07:27 +0000 Subject: [PATCH] Mass convert NULL -> null. Left strings and comments alone, obviously. --- includes/AjaxDispatcher.php | 2 +- includes/AjaxResponse.php | 6 ++--- includes/Article.php | 8 +++--- includes/ChangesList.php | 8 +++--- includes/DatabaseFunctions.php | 2 +- includes/DefaultSettings.php | 22 ++++++++-------- includes/Exif.php | 2 +- includes/GlobalFunctions.php | 6 ++--- includes/Hooks.php | 8 +++--- includes/ImagePage.php | 2 +- includes/LinkCache.php | 10 ++++---- includes/Linker.php | 4 +-- includes/LogPage.php | 4 +-- includes/MagicWord.php | 2 +- includes/Math.php | 8 +++--- includes/MimeMagic.php | 22 ++++++++-------- includes/Namespace.php | 2 +- includes/QueryPage.php | 4 +-- includes/RecentChange.php | 14 +++++----- includes/Sanitizer.php | 2 +- includes/Skin.php | 4 +-- includes/SkinTemplate.php | 2 +- includes/SpecialPage.php | 24 ++++++++--------- includes/Title.php | 30 +++++++++++----------- includes/User.php | 4 +-- includes/WatchedItem.php | 4 +-- includes/WebRequest.php | 12 ++++----- includes/Wiki.php | 2 +- includes/api/ApiDelete.php | 6 ++--- includes/api/ApiFormatYaml_spyc.php | 2 +- includes/api/ApiProtect.php | 2 +- includes/api/ApiQueryInfo.php | 4 +-- includes/api/ApiQueryUserInfo.php | 2 +- includes/api/ApiQueryUsers.php | 2 +- includes/api/ApiRollback.php | 2 +- includes/api/ApiUndelete.php | 2 +- includes/db/Database.php | 30 +++++++++++----------- includes/db/DatabaseIbm_db2.php | 28 ++++++++++---------- includes/db/DatabaseMssql.php | 6 ++--- includes/db/DatabasePostgres.php | 18 ++++++------- includes/db/DatabaseSqlite.php | 4 +-- includes/db/LoadBalancer.php | 2 +- includes/filerepo/ArchivedFile.php | 2 +- includes/filerepo/File.php | 2 +- includes/filerepo/Image.php | 2 +- includes/json/Services_JSON.php | 4 +-- includes/memcached-client.php | 4 +-- includes/normal/Utf8Test.php | 2 +- includes/normal/UtfNormal.php | 8 +++--- includes/parser/Parser.php | 10 ++++---- includes/search/SearchEngine.php | 4 +-- includes/search/SearchSqlite.php | 4 +-- includes/specials/SpecialAllpages.php | 4 +-- includes/specials/SpecialContributions.php | 2 +- includes/specials/SpecialExport.php | 2 +- includes/specials/SpecialMovepage.php | 2 +- includes/specials/SpecialNewpages.php | 2 +- includes/specials/SpecialSearch.php | 2 +- includes/specials/SpecialUndelete.php | 4 +-- includes/specials/SpecialUserlogin.php | 4 +-- includes/upload/UploadBase.php | 10 ++++---- index.php | 2 +- t/inc/Database.t | 2 +- tests/DatabaseTest.php | 2 +- 64 files changed, 205 insertions(+), 205 deletions(-) diff --git a/includes/AjaxDispatcher.php b/includes/AjaxDispatcher.php index c489cf1cef..9971ad5fab 100644 --- a/includes/AjaxDispatcher.php +++ b/includes/AjaxDispatcher.php @@ -101,7 +101,7 @@ class AjaxDispatcher { try { $result = call_user_func_array($func, $this->args); - if ( $result === false || $result === NULL ) { + if ( $result === false || $result === null ) { wfDebug( __METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export( $this->args, true ) . "): " . "no data returned\n" ); diff --git a/includes/AjaxResponse.php b/includes/AjaxResponse.php index 26b6f44398..646019d5a6 100644 --- a/includes/AjaxResponse.php +++ b/includes/AjaxResponse.php @@ -37,9 +37,9 @@ class AjaxResponse { /** Content of our HTTP response */ private $mText; - function __construct( $text = NULL ) { - $this->mCacheDuration = NULL; - $this->mVary = NULL; + function __construct( $text = null ) { + $this->mCacheDuration = null; + $this->mVary = null; $this->mDisabled = false; $this->mText = ''; diff --git a/includes/Article.php b/includes/Article.php index a8813e4495..20c01c7550 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -499,7 +499,7 @@ class Article { * * @param $x Mixed: FIXME */ - public function forUpdate( $x = NULL ) { + public function forUpdate( $x = null ) { return wfSetVar( $this->mForUpdate, $x ); } @@ -614,7 +614,7 @@ class Article { } else { $titleObj = Title::newFromRedirect( $text ); } - return $titleObj !== NULL; + return $titleObj !== null; } /** @@ -1596,7 +1596,7 @@ class Article { 'page_latest' => $revision->getId(), 'page_touched' => $dbw->timestamp(), 'page_is_new' => ($lastRevision === 0) ? 1 : 0, - 'page_is_redirect' => $rt !== NULL ? 1 : 0, + 'page_is_redirect' => $rt !== null ? 1 : 0, 'page_len' => strlen( $text ), ), $conditions, @@ -1688,7 +1688,7 @@ class Article { * @param $section empty/null/false or a section number (0, 1, 2, T1, T2...) * @return string Complete article text, or null if error */ - public function replaceSection( $section, $text, $summary = '', $edittime = NULL ) { + public function replaceSection( $section, $text, $summary = '', $edittime = null ) { wfProfileIn( __METHOD__ ); if( strval( $section ) == '' ) { // Whole-page edit; let the whole text through diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 70a5dcbbde..e09258e2f8 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -45,7 +45,7 @@ class ChangesList { */ public static function newFromUser( &$user ) { $sk = $user->getSkin(); - $list = NULL; + $list = null; if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) { return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk ); @@ -504,7 +504,7 @@ class OldChangesList extends ChangesList { /** * Format a line using the old system (aka without any javascript). */ - public function recentChangesLine( &$rc, $watched = false, $linenumber = NULL ) { + public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) { global $wgLang, $wgRCShowChangedSize, $wgUser; wfProfileIn( __METHOD__ ); # Should patrol-related stuff be shown? @@ -915,10 +915,10 @@ class EnhancedChangesList extends ChangesList { $last = 0; $first = count($block) - 1; # Some events (like logs) have an "empty" size, so we need to skip those... - while( $last < $first && $block[$last]->mAttribs['rc_new_len'] === NULL ) { + while( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) { $last++; } - while( $first > $last && $block[$first]->mAttribs['rc_old_len'] === NULL ) { + while( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) { $first--; } # Get net change diff --git a/includes/DatabaseFunctions.php b/includes/DatabaseFunctions.php index 52e9a8c8dd..2df56115e6 100644 --- a/includes/DatabaseFunctions.php +++ b/includes/DatabaseFunctions.php @@ -58,7 +58,7 @@ function wfIgnoreSQLErrors( $newstate, $dbi = DB_LAST ) { if ( $db !== false ) { return $db->ignoreErrors( $newstate ); } else { - return NULL; + return null; } } diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 321f338c0a..ee0b959d40 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -313,7 +313,7 @@ $wgUrlProtocols = array( /** internal name of virus scanner. This servers as a key to the $wgAntivirusSetup array. * Set this to NULL to disable virus scanning. If not null, every file uploaded will be scanned for viruses. */ -$wgAntivirus= NULL; +$wgAntivirus= null; /** Configuration for different virus scanners. This an associative array of associative arrays: * it contains on setup array per known scanner type. The entry is selected by $wgAntivirus, i.e. @@ -380,11 +380,11 @@ $wgVerifyMimeType= true; /** Sets the mime type definition file to use by MimeMagic.php. */ $wgMimeTypeFile= "includes/mime.types"; #$wgMimeTypeFile= "/etc/mime.types"; -#$wgMimeTypeFile= NULL; #use built-in defaults only. +#$wgMimeTypeFile= null; #use built-in defaults only. /** Sets the mime type info file to use by MimeMagic.php. */ $wgMimeInfoFile= "includes/mime.info"; -#$wgMimeInfoFile= NULL; #use built-in defaults only. +#$wgMimeInfoFile= null; #use built-in defaults only. /** Switch for loading the FileInfo extension by PECL at runtime. * This should be used only if fileinfo is installed as a shared object @@ -397,7 +397,7 @@ $wgLoadFileinfoExtension= false; * The name of the file to process will be appended to the command given here. * If not set or NULL, mime_content_type will be used if available. */ -$wgMimeDetectorCommand= NULL; # use internal mime_content_type function, available since php 4.3.0 +$wgMimeDetectorCommand= null; # use internal mime_content_type function, available since php 4.3.0 #$wgMimeDetectorCommand= "file -bi"; #use external mime detector (Linux) /** Switch for trivial mime detection. Used by thumb.php to disable all fance @@ -2443,13 +2443,13 @@ $wgEnableCreativeCommonsRdf = false; /** Override for copyright metadata. * TODO: these options need documentation */ -$wgRightsPage = NULL; -$wgRightsUrl = NULL; -$wgRightsText = NULL; -$wgRightsIcon = NULL; +$wgRightsPage = null; +$wgRightsUrl = null; +$wgRightsText = null; +$wgRightsIcon = null; /** Set this to some HTML to override the rights icon with an arbitrary logo */ -$wgCopyrightIcon = NULL; +$wgCopyrightIcon = null; /** Set this to true if you want detailed copyright information forms on Upload. */ $wgUseCopyrightUpload = false; @@ -2924,7 +2924,7 @@ $wgOverrideSiteFeed = array(); # 102 => "Aide", # 103 => "Discussion_Aide" # ); -$wgExtraNamespaces = NULL; +$wgExtraNamespaces = null; /** * Namespace aliases @@ -3533,7 +3533,7 @@ $wgRateLimits = array( 'subnet' => null, ), 'mailpassword' => array( - 'anon' => NULL, + 'anon' => null, ), 'emailuser' => array( 'user' => null, diff --git a/includes/Exif.php b/includes/Exif.php index 971d01928b..594e633abf 100644 --- a/includes/Exif.php +++ b/includes/Exif.php @@ -558,7 +558,7 @@ class Exif { * @param $fname String: * @param $action Mixed: , default NULL. */ - function debug( $in, $fname, $action = NULL ) { + function debug( $in, $fname, $action = null ) { if ( !$this->log ) { return; } diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 57c33c472b..4d1f1f5de0 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1277,7 +1277,7 @@ function wfSetBit( &$dest, $bit, $state = true ) { * "days=7&limit=100". Options in the first array override options in the second. * Options set to "" will not be output. */ -function wfArrayToCGI( $array1, $array2 = NULL ) +function wfArrayToCGI( $array1, $array2 = null ) { if ( !is_null( $array2 ) ) { $array1 = $array1 + $array2; @@ -1717,7 +1717,7 @@ function mimeTypeMatch( $type, $avail ) { } elseif( array_key_exists( '*/*', $avail ) ) { return '*/*'; } else { - return NULL; + return null; } } } @@ -1759,7 +1759,7 @@ function wfNegotiateType( $cprefs, $sprefs ) { } $bestq = 0; - $besttype = NULL; + $besttype = null; foreach( array_keys( $combine ) as $type ) { if( $combine[$type] > $bestq ) { diff --git a/includes/Hooks.php b/includes/Hooks.php index faf7fb961f..dec1c44236 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -49,10 +49,10 @@ function wfRunHooks($event, $args = array()) { foreach ($wgHooks[$event] as $index => $hook) { - $object = NULL; - $method = NULL; - $func = NULL; - $data = NULL; + $object = null; + $method = null; + $func = null; + $data = null; $have_data = false; $closure = false; diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 700bb767ba..40cbe7c114 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -1021,7 +1021,7 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager { $this->mImagePage = $imagePage; $this->mTitle = clone( $imagePage->getTitle() ); $this->mTitle->setFragment( '#filehistory' ); - $this->mImg = NULL; + $this->mImg = null; $this->mHist = array(); $this->mRange = array( 0, 0 ); // display range } diff --git a/includes/LinkCache.php b/includes/LinkCache.php index a6d2185ec6..8d035763e3 100644 --- a/includes/LinkCache.php +++ b/includes/LinkCache.php @@ -33,7 +33,7 @@ class LinkCache { /** * General accessor to get/set whether SELECT FOR UPDATE should be used */ - public function forUpdate( $update = NULL ) { + public function forUpdate( $update = null ) { return wfSetVar( $this->mForUpdate, $update ); } @@ -57,7 +57,7 @@ class LinkCache { if ( array_key_exists( $dbkey, $this->mGoodLinkFields ) ) { return $this->mGoodLinkFields[$dbkey][$field]; } else { - return NULL; + return null; } } @@ -72,7 +72,7 @@ class LinkCache { * @param int $len * @param int $redir */ - public function addGoodLinkObj( $id, $title, $len = -1, $redir = NULL ) { + public function addGoodLinkObj( $id, $title, $len = -1, $redir = null ) { $dbkey = $title->getPrefixedDbKey(); $this->mGoodLinks[$dbkey] = intval( $id ); $this->mGoodLinkFields[$dbkey] = array( @@ -114,7 +114,7 @@ class LinkCache { * @param $redir bool, is redirect? * @return integer */ - public function addLink( $title, $len = -1, $redir = NULL ) { + public function addLink( $title, $len = -1, $redir = null ) { $nt = Title::newFromDBkey( $title ); if( $nt ) { return $this->addLinkObj( $nt, $len, $redir ); @@ -130,7 +130,7 @@ class LinkCache { * @param $redir bool, is redirect? * @return integer */ - public function addLinkObj( &$nt, $len = -1, $redirect = NULL ) { + public function addLinkObj( &$nt, $len = -1, $redirect = null ) { global $wgAntiLockFlags, $wgProfiler; wfProfileIn( __METHOD__ ); diff --git a/includes/Linker.php b/includes/Linker.php index b967a87379..c0258c0ff9 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -934,7 +934,7 @@ class Linker { * @param mixed $title Title object (to generate link to the section in autocomment) or null * @param bool $local Whether section links should refer to local page */ - function formatComment($comment, $title = NULL, $local = false) { + function formatComment($comment, $title = null, $local = false) { wfProfileIn( __METHOD__ ); # Sanitize text a bit: @@ -1188,7 +1188,7 @@ class Linker { * * @return string */ - function commentBlock( $comment, $title = NULL, $local = false ) { + function commentBlock( $comment, $title = null, $local = false ) { // '*' used to be the comment inserted by the software way back // in antiquity in case none was provided, here for backwards // compatability, acc. to brion -ævar diff --git a/includes/LogPage.php b/includes/LogPage.php index 8cd9dea14f..24a9b0953d 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -166,7 +166,7 @@ class LogPage { * @static * @return HTML string */ - public static function actionText( $type, $action, $title = NULL, $skin = NULL, + public static function actionText( $type, $action, $title = null, $skin = null, $params = array(), $filterWikilinks = false ) { global $wgLang, $wgContLang, $wgLogActions, $wgMessageCache; @@ -385,7 +385,7 @@ class LogPage { $this->doer = $doer; - $this->actionText = LogPage::actionText( $this->type, $action, $target, NULL, $params ); + $this->actionText = LogPage::actionText( $this->type, $action, $target, null, $params ); return $this->saveContent(); } diff --git a/includes/MagicWord.php b/includes/MagicWord.php index aad267bf35..60e3d9873f 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -343,7 +343,7 @@ class MagicWord { $matches = array(); $matchcount = preg_match( $this->getVariableStartToEndRegex(), $text, $matches ); if ( $matchcount == 0 ) { - return NULL; + return null; } else { # multiple matched parts (variable match); some will be empty because of # synonyms. The variable will be the second non-empty one so remove any diff --git a/includes/Math.php b/includes/Math.php index ea9ff58ac5..70f4b81de7 100644 --- a/includes/Math.php +++ b/includes/Math.php @@ -104,14 +104,14 @@ class MathRenderer { } else { $this->conservativeness = 0; } - $this->mathml = NULL; + $this->mathml = null; } else if ($retval == 'X') { - $this->html = NULL; + $this->html = null; $this->mathml = substr ($contents, 33); $this->conservativeness = 0; } else if ($retval == '+') { - $this->html = NULL; - $this->mathml = NULL; + $this->html = null; + $this->mathml = null; $this->conservativeness = 0; } else { $errbit = htmlspecialchars( substr($contents, 1) ); diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index 5e28ebe59d..39c82c9dc4 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -118,19 +118,19 @@ class MimeMagic { * Mapping of media types to arrays of mime types. * This is used by findMediaType and getMediaType, respectively */ - var $mMediaTypes= NULL; + var $mMediaTypes= null; /** Map of mime type aliases */ - var $mMimeTypeAliases= NULL; + var $mMimeTypeAliases= null; /** map of mime types to file extensions (as a space seprarated list) */ - var $mMimeToExt= NULL; + var $mMimeToExt= null; /** map of file extensions types to mime types (as a space seprarated list) */ - var $mExtToMime= NULL; + var $mExtToMime= null; /** IEContentAnalyzer instance */ @@ -328,7 +328,7 @@ class MimeMagic { */ function guessTypesForExtension( $ext ) { $m = $this->getTypesForExtension( $ext ); - if ( is_null( $m ) ) return NULL; + if ( is_null( $m ) ) return null; $m = trim( $m ); $m = preg_replace( '/\s.*$/', '', $m ); @@ -345,7 +345,7 @@ class MimeMagic { $ext = $this->getExtensionsForType( $mime ); if ( !$ext ) { - return NULL; //unknown + return null; //unknown } $ext = explode( ' ', $ext ); @@ -508,7 +508,7 @@ class MimeMagic { /* * look for shell scripts */ - $script_type = NULL; + $script_type = null; # detect by shebang if ( substr( $head, 0, 2) == "#!" ) { @@ -631,7 +631,7 @@ class MimeMagic { function detectMimeType( $file, $ext = true ) { global $wgMimeDetectorCommand; - $m = NULL; + $m = null; if ( $wgMimeDetectorCommand ) { $fn = wfEscapeShellArg( $file ); $m = `$wgMimeDetectorCommand $fn`; @@ -678,7 +678,7 @@ class MimeMagic { $m = strtolower( $m ); if ( strpos( $m, 'unknown' ) !== false ) { - $m = NULL; + $m = null; } else { wfDebug( __METHOD__.": magic mime type of $file: $m\n" ); return $m; @@ -723,7 +723,7 @@ class MimeMagic { * * @return (int?string?) a value to be used with the MEDIATYPE_xxx constants. */ - function getMediaType( $path = NULL, $mime = NULL ) { + function getMediaType( $path = null, $mime = null ) { if( !$mime && !$path ) return MEDIATYPE_UNKNOWN; # If mime type is unknown, guess it @@ -756,7 +756,7 @@ class MimeMagic { } # Check for entry for file extension - $e = NULL; + $e = null; if ( $path ) { $i = strrpos( $path, '.' ); $e = strtolower( $i ? substr( $path, $i + 1 ) : '' ); diff --git a/includes/Namespace.php b/includes/Namespace.php index a9601b4e8c..4efc7a8fb3 100644 --- a/includes/Namespace.php +++ b/includes/Namespace.php @@ -151,7 +151,7 @@ class MWNamespace { if ( array_key_exists( $name, $xNamespaces ) ) { return $xNamespaces[$name]; } else { - return NULL; + return null; } } diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 9d89ac3ea4..a50c882ee1 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -490,7 +490,7 @@ class QueryPage { */ function feedResult( $row ) { if( !isset( $row->title ) ) { - return NULL; + return null; } $title = Title::MakeTitle( intval( $row->namespace ), $row->title ); if( $title ) { @@ -509,7 +509,7 @@ class QueryPage { $this->feedItemAuthor( $row ), $comments); } else { - return NULL; + return null; } } diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 64ab5abdd0..f42c38e7b2 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -77,7 +77,7 @@ class RecentChange $dbr->freeResult( $res ); return self::newFromRow( $row ); } else { - return NULL; + return null; } } @@ -451,8 +451,8 @@ class RecentChange 'rc_ip' => $ip, 'rc_new' => 0, # obsolete 'rc_patrolled' => 1, - 'rc_old_len' => NULL, - 'rc_new_len' => NULL, + 'rc_old_len' => null, + 'rc_new_len' => null, 'rc_deleted' => 0, 'rc_logid' => 0, # notifyMove not used anymore 'rc_log_type' => null, @@ -519,8 +519,8 @@ class RecentChange 'rc_ip' => $ip, 'rc_patrolled' => 1, 'rc_new' => 0, # obsolete - 'rc_old_len' => NULL, - 'rc_new_len' => NULL, + 'rc_old_len' => null, + 'rc_new_len' => null, 'rc_deleted' => 0, 'rc_logid' => $newId, 'rc_log_type' => $type, @@ -581,7 +581,7 @@ class RecentChange * @return mixed */ public function getAttribute( $name ) { - return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : NULL; + return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : null; } public function getAttributes() { @@ -700,7 +700,7 @@ class RecentChange if( $new === 0 ) { $new = $this->mAttribs['rc_new_len']; } - if( $old === NULL || $new === NULL ) { + if( $old === null || $new === null ) { return ''; } return ChangesList::showCharacterDifference( $old, $new ); diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index b1a3796b2b..bdc8362e7c 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -475,7 +475,7 @@ class Sanitizer { $brace = '/>'; } else if( isset( $htmlsingle[$t] ) ) { # Hack to not close $htmlsingle tags - $brace = NULL; + $brace = null; } else if( isset( $tabletags[$t] ) && in_array($t ,$tagstack) ) { // New table tag but forgot to close the previous one diff --git a/includes/Skin.php b/includes/Skin.php index 2d428a17f2..0777292ad6 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -401,8 +401,8 @@ class Skin extends Linker { 'wgAction' => $wgRequest->getText( 'action', 'view' ), 'wgArticleId' => $wgTitle->getArticleId(), 'wgIsArticle' => $wgOut->isArticle(), - 'wgUserName' => $wgUser->isAnon() ? NULL : $wgUser->getName(), - 'wgUserGroups' => $wgUser->isAnon() ? NULL : $wgUser->getEffectiveGroups(), + 'wgUserName' => $wgUser->isAnon() ? null : $wgUser->getName(), + 'wgUserGroups' => $wgUser->isAnon() ? null : $wgUser->getEffectiveGroups(), 'wgUserLanguage' => $wgLang->getCode(), 'wgContentLanguage' => $wgContLang->getCode(), 'wgBreakFrames' => $wgBreakFrames, diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index e88b84e1fd..0a7085f1f3 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -300,7 +300,7 @@ class SkinTemplate extends Skin { $tpl->set( 'capitalizeallnouns', $wgLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '' ); $tpl->set( 'langname', $wgContLang->getLanguageName( $wgContLanguageCode ) ); $tpl->set( 'showjumplinks', $wgUser->getOption( 'showjumplinks' ) ); - $tpl->set( 'username', $wgUser->isAnon() ? NULL : $this->username ); + $tpl->set( 'username', $wgUser->isAnon() ? null : $this->username ); $tpl->setRef( 'userpage', $this->userpage ); $tpl->setRef( 'userpageurl', $this->userpageUrlDetails['href'] ); $tpl->set( 'userlang', $wgLang->getCode() ); diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index a7556d7394..39953c1a15 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -277,7 +277,7 @@ class SpecialPage { $bits = explode( '/', $alias, 2 ); $name = self::resolveAlias( $bits[0] ); if( !isset( $bits[1] ) ) { // bug 2087 - $par = NULL; + $par = null; } else { $par = $bits[1]; } @@ -394,7 +394,7 @@ class SpecialPage { } return self::$mList[$name]; } else { - return NULL; + return null; } } @@ -407,7 +407,7 @@ class SpecialPage { if ( $realName ) { return self::getPage( $realName ); } else { - return NULL; + return null; } } @@ -500,7 +500,7 @@ class SpecialPage { $bits = explode( '/', $title->getDBkey(), 2 ); $name = $bits[0]; if( !isset( $bits[1] ) ) { // bug 2087 - $par = NULL; + $par = null; } else { $par = $bits[1]; } @@ -703,18 +703,18 @@ Perhaps no page aliases are defined for it?" ); /**#@+ * Accessor and mutator */ - function name( $x = NULL ) { return wfSetVar( $this->mName, $x ); } - function restrictions( $x = NULL) { + function name( $x = null ) { return wfSetVar( $this->mName, $x ); } + function restrictions( $x = null) { # Use the one below this wfDeprecated( __METHOD__ ); return wfSetVar( $this->mRestriction, $x ); } - function restriction( $x = NULL) { return wfSetVar( $this->mRestriction, $x ); } - function listed( $x = NULL) { return wfSetVar( $this->mListed, $x ); } - function func( $x = NULL) { return wfSetVar( $this->mFunction, $x ); } - function file( $x = NULL) { return wfSetVar( $this->mFile, $x ); } - function includable( $x = NULL ) { return wfSetVar( $this->mIncludable, $x ); } - function including( $x = NULL ) { return wfSetVar( $this->mIncluding, $x ); } + function restriction( $x = null) { return wfSetVar( $this->mRestriction, $x ); } + function listed( $x = null) { return wfSetVar( $this->mListed, $x ); } + function func( $x = null) { return wfSetVar( $this->mFunction, $x ); } + function file( $x = null) { return wfSetVar( $this->mFile, $x ); } + function includable( $x = null ) { return wfSetVar( $this->mIncludable, $x ); } + function including( $x = null ) { return wfSetVar( $this->mIncluding, $x ); } /**#@-*/ /** diff --git a/includes/Title.php b/includes/Title.php index 939d92e2b6..1e702083e7 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -92,7 +92,7 @@ class Title { if( $t->secureAndSplit() ) return $t; else - return NULL; + return null; } /** @@ -146,7 +146,7 @@ class Title { } return $t; } else { - $ret = NULL; + $ret = null; return $ret; } } @@ -180,7 +180,7 @@ class Title { if( $t->secureAndSplit() ) { return $t; } else { - return NULL; + return null; } } @@ -197,7 +197,7 @@ class Title { if( $row !== false ) { $title = Title::newFromRow( $row ); } else { - $title = NULL; + $title = null; } return $title; } @@ -232,7 +232,7 @@ class Title { $t->mArticleID = isset($row->page_id) ? intval($row->page_id) : -1; $t->mLength = isset($row->page_len) ? intval($row->page_len) : -1; - $t->mRedirect = isset($row->page_is_redirect) ? (bool)$row->page_is_redirect : NULL; + $t->mRedirect = isset($row->page_is_redirect) ? (bool)$row->page_is_redirect : null; $t->mLatestID = isset($row->page_latest) ? $row->page_latest : false; return $t; @@ -278,7 +278,7 @@ class Title { if( $t->secureAndSplit() ) { return $t; } else { - return NULL; + return null; } } @@ -413,7 +413,7 @@ class Title { array( 'page_namespace','page_title' ), array( 'page_id' => $id ), __METHOD__ ); - if ( $s === false ) { return NULL; } + if ( $s === false ) { return null; } $n = self::makeName( $s->page_namespace, $s->page_title ); return $n; @@ -1871,7 +1871,7 @@ class Title { * Loads a string into mRestrictions array * @param $res \type{Resource} restrictions as an SQL result. */ - private function loadRestrictionsFromResultWrapper( $res, $oldFashionedRestrictions = NULL ) { + private function loadRestrictionsFromResultWrapper( $res, $oldFashionedRestrictions = null ) { $rows = array(); $dbr = wfGetDB( DB_SLAVE ); @@ -1882,7 +1882,7 @@ class Title { $this->loadRestrictionsFromRows( $rows, $oldFashionedRestrictions ); } - public function loadRestrictionsFromRows( $rows, $oldFashionedRestrictions = NULL ) { + public function loadRestrictionsFromRows( $rows, $oldFashionedRestrictions = null ) { $dbr = wfGetDB( DB_SLAVE ); $restrictionTypes = $this->getRestrictionTypes(); @@ -1896,7 +1896,7 @@ class Title { # Backwards-compatibility: also load the restrictions from the page record (old format). - if ( $oldFashionedRestrictions === NULL ) { + if ( $oldFashionedRestrictions === null ) { $oldFashionedRestrictions = $dbr->selectField( 'page', 'page_restrictions', array( 'page_id' => $this->getArticleId() ), __METHOD__ ); } @@ -1958,7 +1958,7 @@ class Title { /** * Load restrictions from the page_restrictions table */ - public function loadRestrictions( $oldFashionedRestrictions = NULL ) { + public function loadRestrictions( $oldFashionedRestrictions = null ) { if( !$this->mRestrictionsLoaded ) { if ($this->exists()) { $dbr = wfGetDB( DB_SLAVE ); @@ -3353,14 +3353,14 @@ class Title { public function getFirstRevision( $flags=0 ) { $db = ($flags & GAID_FOR_UPDATE) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); $pageId = $this->getArticleId($flags); - if( !$pageId ) return NULL; + if( !$pageId ) return null; $row = $db->selectRow( 'revision', '*', array( 'rev_page' => $pageId ), __METHOD__, array( 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 1 ) ); if( !$row ) { - return NULL; + return null; } else { return new Revision( $row ); } @@ -3539,7 +3539,7 @@ class Title { * @param Database $db, optional db * @return \type{\string} Last touched timestamp */ - public function getTouched( $db = NULL ) { + public function getTouched( $db = null ) { $db = isset($db) ? $db : wfGetDB( DB_SLAVE ); $touched = $db->selectField( 'page', 'page_touched', $this->pageCond(), __METHOD__ ); return $touched; @@ -3550,7 +3550,7 @@ class Title { * @param User $user * @return mixed string/NULL */ - public function getNotificationTimestamp( $user = NULL ) { + public function getNotificationTimestamp( $user = null ) { global $wgUser, $wgShowUpdatedMarker; // Assume current user if none given if( !$user ) $user = $wgUser; diff --git a/includes/User.php b/includes/User.php index 84b4dc2f65..ffe543331e 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2327,7 +2327,7 @@ class User { $dbw = wfGetDB( DB_MASTER ); $dbw->update( 'watchlist', array( /* SET */ - 'wl_notificationtimestamp' => NULL + 'wl_notificationtimestamp' => null ), array( /* WHERE */ 'wl_title' => $title->getDBkey(), 'wl_namespace' => $title->getNamespace(), @@ -2354,7 +2354,7 @@ class User { $dbw = wfGetDB( DB_MASTER ); $dbw->update( 'watchlist', array( /* SET */ - 'wl_notificationtimestamp' => NULL + 'wl_notificationtimestamp' => null ), array( /* WHERE */ 'wl_user' => $currentUser ), __METHOD__ diff --git a/includes/WatchedItem.php b/includes/WatchedItem.php index a2c1f03691..d1c152963a 100644 --- a/includes/WatchedItem.php +++ b/includes/WatchedItem.php @@ -62,7 +62,7 @@ class WatchedItem { 'wl_user' => $this->id, 'wl_namespace' => MWNamespace::getSubject($this->ns), 'wl_title' => $this->ti, - 'wl_notificationtimestamp' => NULL + 'wl_notificationtimestamp' => null ), __METHOD__, 'IGNORE' ); // Every single watched page needs now to be listed in watchlist; @@ -72,7 +72,7 @@ class WatchedItem { 'wl_user' => $this->id, 'wl_namespace' => MWNamespace::getTalk($this->ns), 'wl_title' => $this->ti, - 'wl_notificationtimestamp' => NULL + 'wl_notificationtimestamp' => null ), __METHOD__, 'IGNORE' ); wfProfileOut( __METHOD__ ); diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 22057d40d8..28472e6e9b 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -248,7 +248,7 @@ class WebRequest { * @param $default string: optional default (or NULL) * @return string */ - public function getVal( $name, $default = NULL ) { + public function getVal( $name, $default = null ) { $val = $this->getGPCVal( $this->data, $name, $default ); if( is_array( $val ) ) { $val = $default; @@ -281,7 +281,7 @@ class WebRequest { * @param $default array: optional default (or NULL) * @return array */ - public function getArray( $name, $default = NULL ) { + public function getArray( $name, $default = null ) { $val = $this->getGPCVal( $this->data, $name, $default ); if( is_null( $val ) ) { return null; @@ -300,7 +300,7 @@ class WebRequest { * @param $default array: option default (or NULL) * @return array of ints */ - public function getIntArray( $name, $default = NULL ) { + public function getIntArray( $name, $default = null ) { $val = $this->getArray( $name, $default ); if( is_array( $val ) ) { $val = array_map( 'intval', $val ); @@ -356,7 +356,7 @@ class WebRequest { public function getCheck( $name ) { # Checkboxes and buttons are only present when clicked # Presence connotes truth, abscense false - $val = $this->getVal( $name, NULL ); + $val = $this->getVal( $name, null ); return isset( $val ); } @@ -559,7 +559,7 @@ class WebRequest { */ public function getFileTempname( $key ) { if( !isset( $_FILES[$key] ) ) { - return NULL; + return null; } return $_FILES[$key]['tmp_name']; } @@ -601,7 +601,7 @@ class WebRequest { */ public function getFileName( $key ) { if( !isset( $_FILES[$key] ) ) { - return NULL; + return null; } $name = $_FILES[$key]['name']; diff --git a/includes/Wiki.php b/includes/Wiki.php index 631cd03931..0a6c263619 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -109,7 +109,7 @@ class MediaWiki { if( $wgRequest->getVal( 'printable' ) === 'yes' ) { $wgOut->setPrintable(); } - $ret = NULL; + $ret = null; if( $curid = $wgRequest->getInt( 'curid' ) ) { # URLs like this are generated by RC, because rc_title isn't always accurate $ret = Title::newFromID( $curid ); diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index 267df2a7af..ebfaf3e130 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -70,7 +70,7 @@ class ApiDelete extends ApiBase { if(!$titleObj->exists()) $this->dieUsageMsg(array('notanarticle')); - $reason = (isset($params['reason']) ? $params['reason'] : NULL); + $reason = (isset($params['reason']) ? $params['reason'] : null); if ($titleObj->getNamespace() == NS_FILE) { $retval = self::deleteFile($params['token'], $titleObj, $params['oldimage'], $reason, false); if(count($retval)) @@ -115,7 +115,7 @@ class ApiDelete extends ApiBase { * @param string $reason - Reason for the deletion. Autogenerated if NULL * @return Title::getUserPermissionsErrors()-like array */ - public static function delete(&$article, $token, &$reason = NULL) + public static function delete(&$article, $token, &$reason = null) { global $wgUser; if($article->isBigDeletion() && !$wgUser->isAllowed('bigdelete')) { @@ -149,7 +149,7 @@ class ApiDelete extends ApiBase { return array(array('cannotdelete', $article->mTitle->getPrefixedText())); } - public static function deleteFile($token, &$title, $oldimage, &$reason = NULL, $suppress = false) + public static function deleteFile($token, &$title, $oldimage, &$reason = null, $suppress = false) { $errors = self::getPermissionsError($title, $token); if (count($errors)) return $errors; diff --git a/includes/api/ApiFormatYaml_spyc.php b/includes/api/ApiFormatYaml_spyc.php index f16b2c8a66..e339534faa 100644 --- a/includes/api/ApiFormatYaml_spyc.php +++ b/includes/api/ApiFormatYaml_spyc.php @@ -114,7 +114,7 @@ class Spyc { if (is_array($value)) { // It has children. What to do? // Make it the right kind of item - $string = $this->_dumpNode($key,NULL,$indent); + $string = $this->_dumpNode($key,null,$indent); // Add the indent $indent += $this->_dumpIndent; // Yamlize the array diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index 0f0ecfe774..bfc35d6713 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -40,7 +40,7 @@ class ApiProtect extends ApiBase { global $wgUser, $wgRestrictionTypes, $wgRestrictionLevels; $params = $this->extractRequestParams(); - $titleObj = NULL; + $titleObj = null; if(!isset($params['title'])) $this->dieUsageMsg(array('missingparam', 'title')); if(!isset($params['token'])) diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 7381679313..bde712b73e 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -540,7 +540,7 @@ class ApiQueryInfo extends ApiQueryBase { public function getAllowedParams() { return array ( 'prop' => array ( - ApiBase :: PARAM_DFLT => NULL, + ApiBase :: PARAM_DFLT => null, ApiBase :: PARAM_ISMULTI => true, ApiBase :: PARAM_TYPE => array ( 'protection', @@ -551,7 +551,7 @@ class ApiQueryInfo extends ApiQueryBase { 'readable', )), 'token' => array ( - ApiBase :: PARAM_DFLT => NULL, + ApiBase :: PARAM_DFLT => null, ApiBase :: PARAM_ISMULTI => true, ApiBase :: PARAM_TYPE => array_keys($this->getTokenFunctions()) ), diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index a3b8a98a2f..143ec39a99 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -144,7 +144,7 @@ class ApiQueryUserInfo extends ApiQueryBase { public function getAllowedParams() { return array ( 'prop' => array ( - ApiBase :: PARAM_DFLT => NULL, + ApiBase :: PARAM_DFLT => null, ApiBase :: PARAM_ISMULTI => true, ApiBase :: PARAM_TYPE => array ( 'blockinfo', diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 7bc8cdb3ec..d697d87edd 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -210,7 +210,7 @@ if (!defined('MEDIAWIKI')) { public function getAllowedParams() { return array ( 'prop' => array ( - ApiBase :: PARAM_DFLT => NULL, + ApiBase :: PARAM_DFLT => null, ApiBase :: PARAM_ISMULTI => true, ApiBase :: PARAM_TYPE => array ( 'blockinfo', diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index b826c56424..8ef63aef81 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -39,7 +39,7 @@ class ApiRollback extends ApiBase { public function execute() { $params = $this->extractRequestParams(); - $titleObj = NULL; + $titleObj = null; if(!isset($params['title'])) $this->dieUsageMsg(array('missingparam', 'title')); if(!isset($params['user'])) diff --git a/includes/api/ApiUndelete.php b/includes/api/ApiUndelete.php index 9a1e9276dc..6c831f3c0e 100644 --- a/includes/api/ApiUndelete.php +++ b/includes/api/ApiUndelete.php @@ -40,7 +40,7 @@ class ApiUndelete extends ApiBase { global $wgUser; $params = $this->extractRequestParams(); - $titleObj = NULL; + $titleObj = null; if(!isset($params['title'])) $this->dieUsageMsg(array('missingparam', 'title')); if(!isset($params['token'])) diff --git a/includes/db/Database.php b/includes/db/Database.php index a5f85c0828..179fba5a6a 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -50,7 +50,7 @@ abstract class DatabaseBase { * Fail function, takes a Database as a parameter * Set to false for default, 1 for ignore errors */ - function failFunction( $function = NULL ) { + function failFunction( $function = null ) { return wfSetVar( $this->mFailFunction, $function ); } @@ -65,7 +65,7 @@ abstract class DatabaseBase { /** * Boolean, controls output of large amounts of debug information */ - function debug( $debug = NULL ) { + function debug( $debug = null ) { return wfSetBit( $this->mFlags, DBO_DEBUG, $debug ); } @@ -73,7 +73,7 @@ abstract class DatabaseBase { * Turns buffering of SQL result sets on (true) or off (false). * Default is "on" and it should not be changed without good reasons. */ - function bufferResults( $buffer = NULL ) { + function bufferResults( $buffer = null ) { if ( is_null( $buffer ) ) { return !(bool)( $this->mFlags & DBO_NOBUFFER ); } else { @@ -88,7 +88,7 @@ abstract class DatabaseBase { * code should use lastErrno() and lastError() to handle the * situation as appropriate. */ - function ignoreErrors( $ignoreErrors = NULL ) { + function ignoreErrors( $ignoreErrors = null ) { return wfSetBit( $this->mFlags, DBO_IGNORE, $ignoreErrors ); } @@ -96,14 +96,14 @@ abstract class DatabaseBase { * The current depth of nested transactions * @param $level Integer: , default NULL. */ - function trxLevel( $level = NULL ) { + function trxLevel( $level = null ) { return wfSetVar( $this->mTrxLevel, $level ); } /** * Number of errors logged, only useful when errors are ignored */ - function errorCount( $count = NULL ) { + function errorCount( $count = null ) { return wfSetVar( $this->mErrorCount, $count ); } @@ -114,19 +114,19 @@ abstract class DatabaseBase { /** * Properties passed down from the server info array of the load balancer */ - function getLBInfo( $name = NULL ) { + function getLBInfo( $name = null ) { if ( is_null( $name ) ) { return $this->mLBInfo; } else { if ( array_key_exists( $name, $this->mLBInfo ) ) { return $this->mLBInfo[$name]; } else { - return NULL; + return null; } } } - function setLBInfo( $name, $value = NULL ) { + function setLBInfo( $name, $value = null ) { if ( is_null( $value ) ) { $this->mLBInfo = $name; } else { @@ -304,7 +304,7 @@ abstract class DatabaseBase { global $wgOut, $wgDBprefix, $wgCommandLineMode; # Can't get a reference if it hasn't been set yet if ( !isset( $wgOut ) ) { - $wgOut = NULL; + $wgOut = null; } $this->mFailFunction = $failFunction; @@ -1018,7 +1018,7 @@ abstract class DatabaseBase { $table = $this->tableName( $table ); $res = $this->query( 'DESCRIBE '.$table, $fname ); if ( !$res ) { - return NULL; + return null; } $found = false; @@ -1040,7 +1040,7 @@ abstract class DatabaseBase { function indexExists( $table, $index, $fname = 'Database::indexExists' ) { $info = $this->indexInfo( $table, $index, $fname ); if ( is_null( $info ) ) { - return NULL; + return null; } else { return $info !== false; } @@ -1060,7 +1060,7 @@ abstract class DatabaseBase { $sql = 'SHOW INDEX FROM '.$table; $res = $this->query( $sql, $fname ); if ( !$res ) { - return NULL; + return null; } $result = array(); @@ -1115,7 +1115,7 @@ abstract class DatabaseBase { function indexUnique( $table, $index ) { $indexInfo = $this->indexInfo( $table, $index ); if ( !$indexInfo ) { - return NULL; + return null; } return !$indexInfo[0]->Non_unique; } @@ -1549,7 +1549,7 @@ abstract class DatabaseBase { * subclass will return an integer, and save the value for insertId() */ function nextSequenceValue( $seqName ) { - return NULL; + return null; } /** diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index 15d0b68a27..cc95b1706a 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -123,19 +123,19 @@ class DatabaseIbm_db2 extends DatabaseBase { */ /// Server port for uncataloged connections - protected $mPort = NULL; + protected $mPort = null; /// Whether connection is cataloged - protected $mCataloged = NULL; + protected $mCataloged = null; /// Schema for tables, stored procedures, triggers - protected $mSchema = NULL; + protected $mSchema = null; /// Whether the schema has been applied in this session protected $mSchemaSet = false; /// Result of last query - protected $mLastResult = NULL; + protected $mLastResult = null; /// Number of rows affected by last INSERT/UPDATE/DELETE - protected $mAffectedRows = NULL; + protected $mAffectedRows = null; /// Number of rows returned by last SELECT - protected $mNumRows = NULL; + protected $mNumRows = null; /// Connection config options - see constructor public $mConnOptions = array(); @@ -158,7 +158,7 @@ class DatabaseIbm_db2 extends DatabaseBase { protected $mMode = self::REGULAR_MODE; /// Last sequence value used for a primary key - protected $mInsertId = NULL; + protected $mInsertId = null; /* * These can be safely inherited @@ -415,7 +415,7 @@ class DatabaseIbm_db2 extends DatabaseBase { global $wgOut, $wgDBmwschema; # Can't get a reference if it hasn't been set yet if ( !isset( $wgOut ) ) { - $wgOut = NULL; + $wgOut = null; } $this->mOut =& $wgOut; $this->mFailFunction = $failFunction; @@ -646,7 +646,7 @@ class DatabaseIbm_db2 extends DatabaseBase { throw new DBUnexpectedError($this, 'SQL error: ' . htmlspecialchars( $error ) ); } $this->mLastResult = $ret; - $this->mAffectedRows = NULL; // Not calculated until asked for + $this->mAffectedRows = null; // Not calculated until asked for return $ret; } @@ -1004,7 +1004,7 @@ EOF; $this->freeResult( $res ); return $this->mInsertId; */ - return NULL; + return null; } /** @@ -1162,7 +1162,7 @@ EOF; // remove primary keys foreach ($args as $ai => $row) { foreach ($keys as $ki => $key) { - if ($row[$key] == NULL) { + if ($row[$key] == null) { unset($row[$key]); } } @@ -1476,7 +1476,7 @@ EOF; // db2_ping() doesn't exist // Emulate $this->close(); - if ($this->mCataloged == NULL) { + if ($this->mCataloged == null) { return false; } else if ($this->mCataloged) { @@ -1569,10 +1569,10 @@ WHERE si.name='$index' AND si.tbname='$table' AND sc.tbcreator='$this->mSchema' SQL; $res = $this->query( $sql, $fname ); if ( !$res ) { - return NULL; + return null; } $row = $this->fetchObject( $res ); - if ($row != NULL) return $row; + if ($row != null) return $row; else return false; } diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 923ffe4981..c5ff676f42 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -25,7 +25,7 @@ class DatabaseMssql extends DatabaseBase { $failFunction = false, $flags = 0, $tablePrefix = 'get from global') { global $wgOut, $wgDBprefix, $wgCommandLineMode; - if (!isset($wgOut)) $wgOut = NULL; # Can't get a reference if it hasn't been set yet + if (!isset($wgOut)) $wgOut = null; # Can't get a reference if it hasn't been set yet $this->mOut =& $wgOut; $this->mFailFunction = $failFunction; $this->mFlags = $flags; @@ -474,13 +474,13 @@ class DatabaseMssql extends DatabaseBase { function indexInfo( $table, $index, $fname = 'Database::indexInfo' ) { throw new DBUnexpectedError( $this, 'Database::indexInfo called which is not supported yet' ); - return NULL; + return null; $table = $this->tableName( $table ); $sql = 'SHOW INDEX FROM '.$table; $res = $this->query( $sql, $fname ); if ( !$res ) { - return NULL; + return null; } $result = array(); diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index d864570ac3..e1424b6e15 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -69,10 +69,10 @@ SQL; * @ingroup Database */ class DatabasePostgres extends DatabaseBase { - var $mInsertId = NULL; - var $mLastResult = NULL; - var $numeric_version = NULL; - var $mAffectedRows = NULL; + var $mInsertId = null; + var $mLastResult = null; + var $numeric_version = null; + var $mAffectedRows = null; function DatabasePostgres($server = false, $user = false, $password = false, $dbName = false, $failFunction = false, $flags = 0 ) @@ -578,7 +578,7 @@ class DatabasePostgres extends DatabaseBase { $sql = mb_convert_encoding($sql,'UTF-8'); } $this->mLastResult = pg_query( $this->mConn, $sql); - $this->mAffectedRows = NULL; // use pg_affected_rows(mLastResult) + $this->mAffectedRows = null; // use pg_affected_rows(mLastResult) return $this->mLastResult; } @@ -713,7 +713,7 @@ class DatabasePostgres extends DatabaseBase { $sql = "SELECT indexname FROM pg_indexes WHERE tablename='$table'"; $res = $this->query( $sql, $fname ); if ( !$res ) { - return NULL; + return null; } while ( $row = $this->fetchObject( $res ) ) { if ( $row->indexname == $this->indexName( $index ) ) { @@ -730,7 +730,7 @@ class DatabasePostgres extends DatabaseBase { ")'"; $res = $this->query( $sql, $fname ); if ( !$res ) - return NULL; + return null; while ($row = $this->fetchObject( $res )) return true; return false; @@ -1192,7 +1192,7 @@ SQL; $this->addQuotes($table), $this->addQuotes($trigger))); if (!$res) - return NULL; + return null; $rows = $res->numRows(); $this->freeResult( $res ); return $rows; @@ -1216,7 +1216,7 @@ SQL; $this->addQuotes($constraint)); $res = $this->query($SQL); if (!$res) - return NULL; + return null; $rows = $res->numRows(); $this->freeResult($res); return $rows; diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 745bc71e18..d4a2a50a56 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -126,9 +126,9 @@ class DatabaseSqlite extends DatabaseBase { function freeResult( $res ) { if ( $res instanceof ResultWrapper ) - $res->result = NULL; + $res->result = null; else - $res = NULL; + $res = null; } function fetchObject($res) { diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 0b8ef05a08..48065f8046 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -831,7 +831,7 @@ class LoadBalancer { } } - function waitTimeout( $value = NULL ) { + function waitTimeout( $value = null ) { return wfSetVar( $this->mWaitTimeout, $value ); } diff --git a/includes/filerepo/ArchivedFile.php b/includes/filerepo/ArchivedFile.php index 4e9d554a16..79050880b2 100644 --- a/includes/filerepo/ArchivedFile.php +++ b/includes/filerepo/ArchivedFile.php @@ -45,7 +45,7 @@ class ArchivedFile $this->description = ''; $this->user = 0; $this->user_text = ''; - $this->timestamp = NULL; + $this->timestamp = null; $this->deleted = 0; $this->dataLoaded = false; $this->exists = false; diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index c020f7ff37..a6169e3ea5 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -1195,7 +1195,7 @@ abstract class File { wfDebug(__METHOD__.": $path loaded, {$info['size']} bytes, {$info['mime']}.\n"); } else { - $info['mime'] = NULL; + $info['mime'] = null; $info['media_type'] = MEDIATYPE_UNKNOWN; $info['metadata'] = ''; $info['sha1'] = ''; diff --git a/includes/filerepo/Image.php b/includes/filerepo/Image.php index bc9442631f..08ce219a15 100644 --- a/includes/filerepo/Image.php +++ b/includes/filerepo/Image.php @@ -44,7 +44,7 @@ class Image extends LocalFile { } return $img; } else { - return NULL; + return null; } } diff --git a/includes/json/Services_JSON.php b/includes/json/Services_JSON.php index 23bf884ff3..78e3bec022 100644 --- a/includes/json/Services_JSON.php +++ b/includes/json/Services_JSON.php @@ -136,14 +136,14 @@ class Services_JSON $this->use = $use; } - private static $mHavePear = NULL; + private static $mHavePear = null; /** * Returns cached result of class_exists('pear'), to avoid calling AutoLoader numerous times * in cases when PEAR is not present. * @return boolean */ private static function pearInstalled() { - if ( self::$mHavePear === NULL ) { + if ( self::$mHavePear === null ) { self::$mHavePear = class_exists( 'pear' ); } return self::$mHavePear; diff --git a/includes/memcached-client.php b/includes/memcached-client.php index 94d4c147c6..d63a4b873a 100644 --- a/includes/memcached-client.php +++ b/includes/memcached-client.php @@ -1066,10 +1066,10 @@ class MWMemcached if (!is_resource($f)) { return; } - $n = stream_select($r=array($f), $w = NULL, $e = NULL, 0, 0); + $n = stream_select($r=array($f), $w = null, $e = null, 0, 0); while ($n == 1 && !feof($f)) { fread($f, 1024); - $n = stream_select($r=array($f), $w = NULL, $e = NULL, 0, 0); + $n = stream_select($r=array($f), $w = null, $e = null, 0, 0); } } diff --git a/includes/normal/Utf8Test.php b/includes/normal/Utf8Test.php index 353d11b5b2..4c78b3db5a 100644 --- a/includes/normal/Utf8Test.php +++ b/includes/normal/Utf8Test.php @@ -81,7 +81,7 @@ $longTests = array( # These tests are not in proper subsections $sectionTests = array( '3.4' ); -$section = NULL; +$section = null; $test = ''; $failed = 0; $success = 0; diff --git a/includes/normal/UtfNormal.php b/includes/normal/UtfNormal.php index 4f8b12935d..e1352fdbe0 100644 --- a/includes/normal/UtfNormal.php +++ b/includes/normal/UtfNormal.php @@ -25,13 +25,13 @@ require_once dirname(__FILE__).'/UtfNormalUtil.php'; global $utfCombiningClass, $utfCanonicalComp, $utfCanonicalDecomp; -$utfCombiningClass = NULL; -$utfCanonicalComp = NULL; -$utfCanonicalDecomp = NULL; +$utfCombiningClass = null; +$utfCanonicalComp = null; +$utfCanonicalDecomp = null; # Load compatibility decompositions on demand if they are needed. global $utfCompatibilityDecomp; -$utfCompatibilityDecomp = NULL; +$utfCompatibilityDecomp = null; /** * For using the ICU wrapper diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 34f8bff37a..30a80b4f24 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -1628,7 +1628,7 @@ class Parser wfProfileOut( __METHOD__."-misc" ); wfProfileIn( __METHOD__."-title" ); $nt = Title::newFromText( $this->mStripState->unstripNoWiki( $link ) ); - if ( $nt === NULL ) { + if ( $nt === null ) { $s .= $prefix . '[[' . $line; wfProfileOut( __METHOD__."-title" ); continue; @@ -2758,7 +2758,7 @@ class Parser $isLocalObj = false; # $text is a DOM node needing expansion in the current frame # Title object, where $text came from - $title = NULL; + $title = null; # $part1 is the bit before the first |, and must contain only title characters. # Various prefixes will be stripped from it later. @@ -4730,9 +4730,9 @@ class Parser /**#@+ * Accessor/mutator */ - function Title( $x = NULL ) { return wfSetVar( $this->mTitle, $x ); } - function Options( $x = NULL ) { return wfSetVar( $this->mOptions, $x ); } - function OutputType( $x = NULL ) { return wfSetVar( $this->mOutputType, $x ); } + function Title( $x = null ) { return wfSetVar( $this->mTitle, $x ); } + function Options( $x = null ) { return wfSetVar( $this->mOptions, $x ); } + function OutputType( $x = null ) { return wfSetVar( $this->mOutputType, $x ); } /**#@-*/ /**#@+ diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index dcc69347e7..952e9b22ec 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -76,7 +76,7 @@ class SearchEngine { # Exact match? No need to look further. $title = Title::newFromText( $term ); if (is_null($title)) - return NULL; + return null; if ( $title->getNamespace() == NS_SPECIAL || $title->isExternal() || $title->exists() ) { return $title; @@ -158,7 +158,7 @@ class SearchEngine { return SearchEngine::getNearMatch( $matches[1] ); } - return NULL; + return null; } public static function legalSearchChars() { diff --git a/includes/search/SearchSqlite.php b/includes/search/SearchSqlite.php index 0f11d442f7..b1cf6a6889 100644 --- a/includes/search/SearchSqlite.php +++ b/includes/search/SearchSqlite.php @@ -29,7 +29,7 @@ class SearchSqlite extends SearchEngine { var $strictMatching = true; // Cached because SearchUpdate keeps recreating our class - private static $fulltextSupported = NULL; + private static $fulltextSupported = null; /** * Creates an instance of this class @@ -44,7 +44,7 @@ class SearchSqlite extends SearchEngine { * @return Boolean */ function fulltextSearchSupported() { - if ( self::$fulltextSupported === NULL ) { + if ( self::$fulltextSupported === null ) { $res = $this->db->selectField( 'updatelog', 'ul_key', array( 'ul_key' => 'fts3' ), __METHOD__ ); self::$fulltextSupported = $res && $this->db->numRows( $res ) > 0; } diff --git a/includes/specials/SpecialAllpages.php b/includes/specials/SpecialAllpages.php index 89f5d343e5..a36cdca71c 100644 --- a/includes/specials/SpecialAllpages.php +++ b/includes/specials/SpecialAllpages.php @@ -450,7 +450,7 @@ class SpecialAllpages extends IncludableSpecialPage { if ( $t && $t->isLocal() ) { return array( $t->getNamespace(), $t->getDBkey(), $t->getText() ); } else if ( $t ) { - return NULL; + return null; } # try again, in case the problem was an empty pagename @@ -459,7 +459,7 @@ class SpecialAllpages extends IncludableSpecialPage { if ( $t && $t->isLocal() ) { return array( $t->getNamespace(), '', '' ); } else { - return NULL; + return null; } } } diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index fae82815b2..ce3c9c9825 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -400,7 +400,7 @@ class SpecialContributions extends SpecialPage { $comments ); } else { - return NULL; + return null; } } diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index d0423f2880..6469640289 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -51,7 +51,7 @@ class SpecialExport extends SpecialPage { $page = $wgRequest->getText( 'pages' ); $catname = $wgRequest->getText( 'catname' ); - if ( $catname !== '' && $catname !== NULL && $catname !== false ) { + if ( $catname !== '' && $catname !== null && $catname !== false ) { $t = Title::makeTitleSafe( NS_MAIN, $catname ); if ( $t ) { /** diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 17066caabf..15e155be18 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -546,7 +546,7 @@ class MovePageForm { } function showLogFragment( $title, &$out ) { - $out->addHTML( Xml::element( 'h2', NULL, LogPage::logName( 'move' ) ) ); + $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'move' ) ) ); LogEventsList::showLogExtract( $out, 'move', $title->getPrefixedText() ); } diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index 49938db619..903ddab0af 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -357,7 +357,7 @@ class SpecialNewpages extends SpecialPage { $this->feedItemAuthor( $row ), $comments); } else { - return NULL; + return null; } } diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 7fb0f0b506..a58c95dfdf 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -168,7 +168,7 @@ class SpecialSearch { # mirror Go/Search behaviour of original request .. $didYouMeanParams = array( 'search' => $textMatches->getSuggestionQuery() ); - if($this->fulltext != NULL) + if($this->fulltext != null) $didYouMeanParams['fulltext'] = $this->fulltext; $stParams = array_merge( diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 916f09235b..443b845762 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -285,7 +285,7 @@ class PageArchive { if( $row ) { return $this->getTextFromRow( $row ); } else { - return NULL; + return null; } } @@ -590,7 +590,7 @@ class UndeleteForm { if ( $this->mTarget !== "" ) { $this->mTargetObj = Title::newFromURL( $this->mTarget ); } else { - $this->mTargetObj = NULL; + $this->mTargetObj = null; } if( $this->mRestore || $this->mInvert ) { $timestamps = array(); diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 251231bd8c..d16c6c6522 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -129,7 +129,7 @@ class LoginForm { $u = $this->addNewaccountInternal(); - if ($u == NULL) { + if ($u == null) { return; } @@ -163,7 +163,7 @@ class LoginForm { # Create the account and abort if there's a problem doing so $u = $this->addNewAccountInternal(); - if( $u == NULL ) + if( $u == null ) return; # If we showed up language selection links, and one was in use, be diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 2bb89479d4..6aace666a0 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -589,7 +589,7 @@ abstract class UploadBase { $match = $magic->isMatchingExtension( $extension, $mime ); - if ( $match === NULL ) { + if ( $match === null ) { wfDebug( __METHOD__ . ": no file extension known for mime type $mime, passing file\n" ); return true; } elseif( $match === true ) { @@ -639,7 +639,7 @@ abstract class UploadBase { elseif( substr( $chunk, 0, 2 ) == "\xff\xfe" ) $enc = "UTF-16LE"; else - $enc = NULL; + $enc = null; if( $enc ) $chunk = iconv( $enc, "ASCII//IGNORE", $chunk ); @@ -762,7 +762,7 @@ abstract class UploadBase { if ( !$wgAntivirus ) { wfDebug( __METHOD__ . ": virus scanner disabled\n" ); - return NULL; + return null; } if ( !$wgAntivirusSetup[$wgAntivirus] ) { @@ -817,12 +817,12 @@ abstract class UploadBase { if ( $wgAntivirusRequired ) { return wfMsg( 'virus-scanfailed', array( $exitCode ) ); } else { - return NULL; + return null; } } else if ( $mappedCode === AV_SCAN_ABORTED ) { # scan failed because filetype is unknown (probably imune) wfDebug( __METHOD__ . ": unsupported file type $file (code $exitCode).\n" ); - return NULL; + return null; } else if ( $mappedCode === AV_NO_VIRUS ) { # no virus found wfDebug( __METHOD__ . ": file passed virus scan.\n" ); diff --git a/index.php b/index.php index 1cbba1e89f..ecaf210a5e 100644 --- a/index.php +++ b/index.php @@ -59,7 +59,7 @@ $title = $wgRequest->getVal( 'title' ); # Set title from request parameters $wgTitle = $mediaWiki->checkInitialQueries( $title, $action ); -if( $wgTitle === NULL ) { +if( $wgTitle === null ) { unset( $wgTitle ); } diff --git a/t/inc/Database.t b/t/inc/Database.t index 0d1579ca3f..9356248134 100644 --- a/t/inc/Database.t +++ b/t/inc/Database.t @@ -14,7 +14,7 @@ plan( 9 ); $db = new DatabaseMysql( $wgDBserver, $wgDBuser, $wgDBpassword ); -cmp_ok( $db->addQuotes( NULL ), '==', +cmp_ok( $db->addQuotes( null ), '==', 'NULL', 'Add quotes to NULL' ); cmp_ok( $db->addQuotes( 1234 ), '==', diff --git a/tests/DatabaseTest.php b/tests/DatabaseTest.php index db46ad60f5..2369277d19 100644 --- a/tests/DatabaseTest.php +++ b/tests/DatabaseTest.php @@ -10,7 +10,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase { function testAddQuotesNull() { $this->assertEquals( 'NULL', - $this->db->addQuotes( NULL ) ); + $this->db->addQuotes( null ) ); } function testAddQuotesInt() { -- 2.20.1