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" );
/** 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 = '';
*
* @param $x Mixed: FIXME
*/
- public function forUpdate( $x = NULL ) {
+ public function forUpdate( $x = null ) {
return wfSetVar( $this->mForUpdate, $x );
}
} else {
$titleObj = Title::newFromRedirect( $text );
}
- return $titleObj !== NULL;
+ return $titleObj !== null;
}
/**
'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,
* @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
*/
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 );
/**
* 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?
$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
if ( $db !== false ) {
return $db->ignoreErrors( $newstate );
} else {
- return NULL;
+ return null;
}
}
/** 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.
/** 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
* 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
/** 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;
# 102 => "Aide",
# 103 => "Discussion_Aide"
# );
-$wgExtraNamespaces = NULL;
+$wgExtraNamespaces = null;
/**
* Namespace aliases
'subnet' => null,
),
'mailpassword' => array(
- 'anon' => NULL,
+ 'anon' => null,
),
'emailuser' => array(
'user' => null,
* @param $fname String:
* @param $action Mixed: , default NULL.
*/
- function debug( $in, $fname, $action = NULL ) {
+ function debug( $in, $fname, $action = null ) {
if ( !$this->log ) {
return;
}
* "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;
} elseif( array_key_exists( '*/*', $avail ) ) {
return '*/*';
} else {
- return NULL;
+ return null;
}
}
}
}
$bestq = 0;
- $besttype = NULL;
+ $besttype = null;
foreach( array_keys( $combine ) as $type ) {
if( $combine[$type] > $bestq ) {
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;
$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
}
/**
* 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 );
}
if ( array_key_exists( $dbkey, $this->mGoodLinkFields ) ) {
return $this->mGoodLinkFields[$dbkey][$field];
} else {
- return NULL;
+ return null;
}
}
* @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(
* @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 );
* @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__ );
* @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:
*
* @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
* @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;
$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();
}
$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
} 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) );
* 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
*/
*/
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 );
$ext = $this->getExtensionsForType( $mime );
if ( !$ext ) {
- return NULL; //unknown
+ return null; //unknown
}
$ext = explode( ' ', $ext );
/*
* look for shell scripts
*/
- $script_type = NULL;
+ $script_type = null;
# detect by shebang
if ( substr( $head, 0, 2) == "#!" ) {
function detectMimeType( $file, $ext = true ) {
global $wgMimeDetectorCommand;
- $m = NULL;
+ $m = null;
if ( $wgMimeDetectorCommand ) {
$fn = wfEscapeShellArg( $file );
$m = `$wgMimeDetectorCommand $fn`;
$m = strtolower( $m );
if ( strpos( $m, 'unknown' ) !== false ) {
- $m = NULL;
+ $m = null;
} else {
wfDebug( __METHOD__.": magic mime type of $file: $m\n" );
return $m;
*
* @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
}
# Check for entry for file extension
- $e = NULL;
+ $e = null;
if ( $path ) {
$i = strrpos( $path, '.' );
$e = strtolower( $i ? substr( $path, $i + 1 ) : '' );
if ( array_key_exists( $name, $xNamespaces ) ) {
return $xNamespaces[$name];
} else {
- return NULL;
+ return null;
}
}
*/
function feedResult( $row ) {
if( !isset( $row->title ) ) {
- return NULL;
+ return null;
}
$title = Title::MakeTitle( intval( $row->namespace ), $row->title );
if( $title ) {
$this->feedItemAuthor( $row ),
$comments);
} else {
- return NULL;
+ return null;
}
}
$dbr->freeResult( $res );
return self::newFromRow( $row );
} else {
- return NULL;
+ return null;
}
}
'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,
'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,
* @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() {
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 );
$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
'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,
$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() );
$bits = explode( '/', $alias, 2 );
$name = self::resolveAlias( $bits[0] );
if( !isset( $bits[1] ) ) { // bug 2087
- $par = NULL;
+ $par = null;
} else {
$par = $bits[1];
}
}
return self::$mList[$name];
} else {
- return NULL;
+ return null;
}
}
if ( $realName ) {
return self::getPage( $realName );
} else {
- return NULL;
+ return null;
}
}
$bits = explode( '/', $title->getDBkey(), 2 );
$name = $bits[0];
if( !isset( $bits[1] ) ) { // bug 2087
- $par = NULL;
+ $par = null;
} else {
$par = $bits[1];
}
/**#@+
* 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 ); }
/**#@-*/
/**
if( $t->secureAndSplit() )
return $t;
else
- return NULL;
+ return null;
}
/**
}
return $t;
} else {
- $ret = NULL;
+ $ret = null;
return $ret;
}
}
if( $t->secureAndSplit() ) {
return $t;
} else {
- return NULL;
+ return null;
}
}
if( $row !== false ) {
$title = Title::newFromRow( $row );
} else {
- $title = NULL;
+ $title = null;
}
return $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;
if( $t->secureAndSplit() ) {
return $t;
} else {
- return NULL;
+ return null;
}
}
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;
* 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 );
$this->loadRestrictionsFromRows( $rows, $oldFashionedRestrictions );
}
- public function loadRestrictionsFromRows( $rows, $oldFashionedRestrictions = NULL ) {
+ public function loadRestrictionsFromRows( $rows, $oldFashionedRestrictions = null ) {
$dbr = wfGetDB( DB_SLAVE );
$restrictionTypes = $this->getRestrictionTypes();
# 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__ );
}
/**
* 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 );
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 );
}
* @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;
* @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;
$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(),
$dbw = wfGetDB( DB_MASTER );
$dbw->update( 'watchlist',
array( /* SET */
- 'wl_notificationtimestamp' => NULL
+ 'wl_notificationtimestamp' => null
), array( /* WHERE */
'wl_user' => $currentUser
), __METHOD__
'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;
'wl_user' => $this->id,
'wl_namespace' => MWNamespace::getTalk($this->ns),
'wl_title' => $this->ti,
- 'wl_notificationtimestamp' => NULL
+ 'wl_notificationtimestamp' => null
), __METHOD__, 'IGNORE' );
wfProfileOut( __METHOD__ );
* @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;
* @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;
* @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 );
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 );
}
*/
public function getFileTempname( $key ) {
if( !isset( $_FILES[$key] ) ) {
- return NULL;
+ return null;
}
return $_FILES[$key]['tmp_name'];
}
*/
public function getFileName( $key ) {
if( !isset( $_FILES[$key] ) ) {
- return NULL;
+ return null;
}
$name = $_FILES[$key]['name'];
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 );
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))
* @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')) {
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;
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
global $wgUser, $wgRestrictionTypes, $wgRestrictionLevels;
$params = $this->extractRequestParams();
- $titleObj = NULL;
+ $titleObj = null;
if(!isset($params['title']))
$this->dieUsageMsg(array('missingparam', 'title'));
if(!isset($params['token']))
public function getAllowedParams() {
return array (
'prop' => array (
- ApiBase :: PARAM_DFLT => NULL,
+ ApiBase :: PARAM_DFLT => null,
ApiBase :: PARAM_ISMULTI => true,
ApiBase :: PARAM_TYPE => array (
'protection',
'readable',
)),
'token' => array (
- ApiBase :: PARAM_DFLT => NULL,
+ ApiBase :: PARAM_DFLT => null,
ApiBase :: PARAM_ISMULTI => true,
ApiBase :: PARAM_TYPE => array_keys($this->getTokenFunctions())
),
public function getAllowedParams() {
return array (
'prop' => array (
- ApiBase :: PARAM_DFLT => NULL,
+ ApiBase :: PARAM_DFLT => null,
ApiBase :: PARAM_ISMULTI => true,
ApiBase :: PARAM_TYPE => array (
'blockinfo',
public function getAllowedParams() {
return array (
'prop' => array (
- ApiBase :: PARAM_DFLT => NULL,
+ ApiBase :: PARAM_DFLT => null,
ApiBase :: PARAM_ISMULTI => true,
ApiBase :: PARAM_TYPE => array (
'blockinfo',
public function execute() {
$params = $this->extractRequestParams();
- $titleObj = NULL;
+ $titleObj = null;
if(!isset($params['title']))
$this->dieUsageMsg(array('missingparam', 'title'));
if(!isset($params['user']))
global $wgUser;
$params = $this->extractRequestParams();
- $titleObj = NULL;
+ $titleObj = null;
if(!isset($params['title']))
$this->dieUsageMsg(array('missingparam', 'title'));
if(!isset($params['token']))
* 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 );
}
/**
* Boolean, controls output of large amounts of debug information
*/
- function debug( $debug = NULL ) {
+ function debug( $debug = null ) {
return wfSetBit( $this->mFlags, DBO_DEBUG, $debug );
}
* 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 {
* 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 );
}
* 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 );
}
/**
* 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 {
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;
$table = $this->tableName( $table );
$res = $this->query( 'DESCRIBE '.$table, $fname );
if ( !$res ) {
- return NULL;
+ return null;
}
$found = false;
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;
}
$sql = 'SHOW INDEX FROM '.$table;
$res = $this->query( $sql, $fname );
if ( !$res ) {
- return NULL;
+ return null;
}
$result = array();
function indexUnique( $table, $index ) {
$indexInfo = $this->indexInfo( $table, $index );
if ( !$indexInfo ) {
- return NULL;
+ return null;
}
return !$indexInfo[0]->Non_unique;
}
* subclass will return an integer, and save the value for insertId()
*/
function nextSequenceValue( $seqName ) {
- return NULL;
+ return null;
}
/**
*/
/// 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();
protected $mMode = self::REGULAR_MODE;
/// Last sequence value used for a primary key
- protected $mInsertId = NULL;
+ protected $mInsertId = null;
/*
* These can be safely inherited
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;
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;
}
$this->freeResult( $res );
return $this->mInsertId;
*/
- return NULL;
+ return null;
}
/**
// remove primary keys
foreach ($args as $ai => $row) {
foreach ($keys as $ki => $key) {
- if ($row[$key] == NULL) {
+ if ($row[$key] == null) {
unset($row[$key]);
}
}
// db2_ping() doesn't exist
// Emulate
$this->close();
- if ($this->mCataloged == NULL) {
+ if ($this->mCataloged == null) {
return false;
}
else if ($this->mCataloged) {
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;
}
$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;
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();
* @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 )
$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;
}
$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 ) ) {
")'";
$res = $this->query( $sql, $fname );
if ( !$res )
- return NULL;
+ return null;
while ($row = $this->fetchObject( $res ))
return true;
return false;
$this->addQuotes($table),
$this->addQuotes($trigger)));
if (!$res)
- return NULL;
+ return null;
$rows = $res->numRows();
$this->freeResult( $res );
return $rows;
$this->addQuotes($constraint));
$res = $this->query($SQL);
if (!$res)
- return NULL;
+ return null;
$rows = $res->numRows();
$this->freeResult($res);
return $rows;
function freeResult( $res ) {
if ( $res instanceof ResultWrapper )
- $res->result = NULL;
+ $res->result = null;
else
- $res = NULL;
+ $res = null;
}
function fetchObject($res) {
}
}
- function waitTimeout( $value = NULL ) {
+ function waitTimeout( $value = null ) {
return wfSetVar( $this->mWaitTimeout, $value );
}
$this->description = '';
$this->user = 0;
$this->user_text = '';
- $this->timestamp = NULL;
+ $this->timestamp = null;
$this->deleted = 0;
$this->dataLoaded = false;
$this->exists = false;
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'] = '';
}
return $img;
} else {
- return NULL;
+ return null;
}
}
$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;
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);
}
}
# These tests are not in proper subsections
$sectionTests = array( '3.4' );
-$section = NULL;
+$section = null;
$test = '';
$failed = 0;
$success = 0;
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
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;
$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.
/**#@+
* 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 ); }
/**#@-*/
/**#@+
# 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;
return SearchEngine::getNearMatch( $matches[1] );
}
- return NULL;
+ return null;
}
public static function legalSearchChars() {
var $strictMatching = true;
// Cached because SearchUpdate keeps recreating our class
- private static $fulltextSupported = NULL;
+ private static $fulltextSupported = null;
/**
* Creates an instance of this class
* @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;
}
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
if ( $t && $t->isLocal() ) {
return array( $t->getNamespace(), '', '' );
} else {
- return NULL;
+ return null;
}
}
}
$comments
);
} else {
- return NULL;
+ return null;
}
}
$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 ) {
/**
}
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() );
}
$this->feedItemAuthor( $row ),
$comments);
} else {
- return NULL;
+ return null;
}
}
# 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(
if( $row ) {
return $this->getTextFromRow( $row );
} else {
- return NULL;
+ return null;
}
}
if ( $this->mTarget !== "" ) {
$this->mTargetObj = Title::newFromURL( $this->mTarget );
} else {
- $this->mTargetObj = NULL;
+ $this->mTargetObj = null;
}
if( $this->mRestore || $this->mInvert ) {
$timestamps = array();
$u = $this->addNewaccountInternal();
- if ($u == NULL) {
+ if ($u == null) {
return;
}
# 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
$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 ) {
elseif( substr( $chunk, 0, 2 ) == "\xff\xfe" )
$enc = "UTF-16LE";
else
- $enc = NULL;
+ $enc = null;
if( $enc )
$chunk = iconv( $enc, "ASCII//IGNORE", $chunk );
if ( !$wgAntivirus ) {
wfDebug( __METHOD__ . ": virus scanner disabled\n" );
- return NULL;
+ return null;
}
if ( !$wgAntivirusSetup[$wgAntivirus] ) {
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" );
# Set title from request parameters
$wgTitle = $mediaWiki->checkInitialQueries( $title, $action );
-if( $wgTitle === NULL ) {
+if( $wgTitle === null ) {
unset( $wgTitle );
}
$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 ), '==',
function testAddQuotesNull() {
$this->assertEquals(
'NULL',
- $this->db->addQuotes( NULL ) );
+ $this->db->addQuotes( null ) );
}
function testAddQuotesInt() {