function getBaseRevision() {
if ( !$this->mBaseRevision ) {
$db = wfGetDB( DB_MASTER );
- $baseRevision = Revision::loadFromTimestamp(
+ $this->mBaseRevision = Revision::loadFromTimestamp(
$db, $this->mTitle, $this->edittime );
- return $this->mBaseRevision = $baseRevision;
- } else {
- return $this->mBaseRevision;
}
+ return $this->mBaseRevision;
}
/**
}
wfProfileOut( __METHOD__ );
- return self::$accesskeycache[$name] = $accesskey;
+ self::$accesskeycache[$name] = $accesskey;
+ return self::$accesskeycache[$name];
}
/**
# alone to cache the result. There's no point in having it hanging
# around uninitialized in every Title object; therefore we only add it
# if needed and don't declare it statically.
- if ( isset( $this->mHasSubpages ) ) {
- return $this->mHasSubpages;
+ if ( !isset( $this->mHasSubpages ) ) {
+ $this->mHasSubpages = false;
+ $subpages = $this->getSubpages( 1 );
+ if ( $subpages instanceof TitleArray ) {
+ $this->mHasSubpages = (bool)$subpages->count();
+ }
}
- $subpages = $this->getSubpages( 1 );
- if ( $subpages instanceof TitleArray ) {
- return $this->mHasSubpages = (bool)$subpages->count();
- }
- return $this->mHasSubpages = false;
+ return $this->mHasSubpages;
}
/**
if ( $limit > -1 ) {
$options['LIMIT'] = $limit;
}
- return $this->mSubpages = TitleArray::newFromResult(
+ $this->mSubpages = TitleArray::newFromResult(
$dbr->select( 'page',
array( 'page_id', 'page_namespace', 'page_title', 'page_is_redirect' ),
$conds,
$options
)
);
+ return $this->mSubpages;
}
/**
*/
public function getArticleID( $flags = 0 ) {
if ( $this->getNamespace() < 0 ) {
- return $this->mArticleID = 0;
+ $this->mArticleID = 0;
+ return $this->mArticleID;
}
$linkCache = LinkCache::singleton();
if ( $flags & self::GAID_FOR_UPDATE ) {
}
# Calling getArticleID() loads the field from cache as needed
if ( !$this->getArticleID( $flags ) ) {
- return $this->mRedirect = false;
+ $this->mRedirect = false;
+ return $this->mRedirect;
}
$linkCache = LinkCache::singleton();
# LinkCache as appropriate, or use $flags = Title::GAID_FOR_UPDATE. If that flag is
# set, then LinkCache will definitely be up to date here, since getArticleID() forces
# LinkCache to refresh its data from the master.
- return $this->mRedirect = false;
+ $this->mRedirect = false;
+ return $this->mRedirect;
}
$this->mRedirect = (bool)$cached;
}
# Calling getArticleID() loads the field from cache as needed
if ( !$this->getArticleID( $flags ) ) {
- return $this->mLength = 0;
+ $this->mLength = 0;
+ return $this->mLength;
}
$linkCache = LinkCache::singleton();
$cached = $linkCache->getGoodLinkFieldObj( $this, 'length' );
if ( $cached === null ) {
# Trust LinkCache's state over our own, as for isRedirect()
- return $this->mLength = 0;
+ $this->mLength = 0;
+ return $this->mLength;
}
$this->mLength = intval( $cached );
}
# Calling getArticleID() loads the field from cache as needed
if ( !$this->getArticleID( $flags ) ) {
- return $this->mLatestID = 0;
+ $this->mLatestID = 0;
+ return $this->mLatestID;
}
$linkCache = LinkCache::singleton();
$linkCache->addLinkObj( $this );
$cached = $linkCache->getGoodLinkFieldObj( $this, 'revision' );
if ( $cached === null ) {
# Trust LinkCache's state over our own, as for isRedirect()
- return $this->mLatestID = 0;
+ $this->mLatestID = 0;
+ return $this->mLatestID;
}
$this->mLatestID = intval( $cached );
return $this->mNotificationTimestamp[$uid];
}
if ( !$uid || !$wgShowUpdatedMarker || !$user->isAllowed( 'viewmywatchlist' ) ) {
- return $this->mNotificationTimestamp[$uid] = false;
+ $this->mNotificationTimestamp[$uid] = false;
+ return $this->mNotificationTimestamp[$uid];
}
// Don't cache too much!
if ( count( $this->mNotificationTimestamp ) >= self::CACHE_MAX ) {
if ( $from == $to ) {
return null;
}
- return $this->mRedirectTarget = Title::makeTitle( NS_FILE, $to );
+ $this->mRedirectTarget = Title::makeTitle( NS_FILE, $to );
+ return $this->mRedirectTarget;
}
/**
}
$hash = $this->mFile->getSha1();
if ( !( $hash ) ) {
- return $this->mDupes = array();
+ $this->mDupes = array();
+ return $this->mDupes;
}
$dupes = RepoGroup::singleton()->findBySha1( $hash );
// Remove duplicates with self and non matching file sizes
// rd_fragment and rd_interwiki were added later, populate them if empty
if ( $row && !is_null( $row->rd_fragment ) && !is_null( $row->rd_interwiki ) ) {
- return $this->mRedirectTarget = Title::makeTitle(
+ $this->mRedirectTarget = Title::makeTitle(
$row->rd_namespace, $row->rd_title,
$row->rd_fragment, $row->rd_interwiki );
+ return $this->mRedirectTarget;
}
// This page doesn't have an entry in the redirect table
- return $this->mRedirectTarget = $this->insertRedirect();
+ $this->mRedirectTarget = $this->insertRedirect();
+ return $this->mRedirectTarget;
}
/**
$count = count( explode( ',', $params[$paramStart] ) );
$newParams[4] = $this->context->getLanguage()->formatNum( $count );
- return $this->parsedParametersDeleteLog = $newParams;
+ $this->parsedParametersDeleteLog = $newParams;
+ return $this->parsedParametersDeleteLog;
} else {
- return $this->parsedParametersDeleteLog = array_slice( $params, 0, 3 );
+ $this->parsedParametersDeleteLog = array_slice( $params, 0, 3 );
+ return $this->parsedParametersDeleteLog;
}
}
- return $this->parsedParametersDeleteLog = $params;
+ $this->parsedParametersDeleteLog = $params;
+ return $this->parsedParametersDeleteLog;
}
protected function parseBitField( $string ) {
// Bad things happens if the numbers are not in correct order
ksort( $params );
- return $this->parsedParameters = $params;
+ $this->parsedParameters = $params;
+ return $this->parsedParameters;
}
/**
}
if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
- return $this->revert = '';
+ $this->revert = '';
+ return $this->revert;
}
$title = $this->entry->getTarget();
public static function inDebugMode() {
global $wgRequest, $wgResourceLoaderDebug;
static $retval = null;
- if ( !is_null( $retval ) ) {
- return $retval;
+ if ( is_null( $retval ) ) {
+ $retval = $wgRequest->getFuzzyBool( 'debug',
+ $wgRequest->getCookie( 'resourceLoaderDebug', '', $wgResourceLoaderDebug ) );
}
- return $retval = $wgRequest->getFuzzyBool( 'debug',
- $wgRequest->getCookie( 'resourceLoaderDebug', '', $wgResourceLoaderDebug ) );
+ return $retval;
}
/**
// If a module is nothing but a list of dependencies, we need to avoid
// giving max() an empty array
if ( count( $files ) === 0 ) {
+ $this->modifiedTime[$context->getHash()] = 1;
wfProfileOut( __METHOD__ );
- return $this->modifiedTime[$context->getHash()] = 1;
+ return $this->modifiedTime[$context->getHash()];
}
wfProfileIn( __METHOD__ . '-filemtime' );
$module = $loader->getModule( $name );
$time = max( $time, $module->getModifiedTime( $context ) );
}
- return $this->modifiedTime[$hash] = $time;
+ $this->modifiedTime[$hash] = $time;
+ return $this->modifiedTime[$hash];
}
/* Methods */
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
$hash = $context->getHash();
- if ( isset( $this->modifiedTime[$hash] ) ) {
- return $this->modifiedTime[$hash];
+ if ( !isset( $this->modifiedTime[$hash] ) ) {
+ global $wgUser;
+ $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX, $wgUser->getTouched() );
}
- global $wgUser;
- return $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX, $wgUser->getTouched() );
+ return $this->modifiedTime[$hash];
}
/**
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
$hash = $context->getHash();
- if ( isset( $this->modifiedTime[$hash] ) ) {
- return $this->modifiedTime[$hash];
+ if ( !isset( $this->modifiedTime[$hash] ) ) {
+ global $wgUser;
+ $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX, $wgUser->getTouched() );
}
- global $wgUser;
- return $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX, $wgUser->getTouched() );
+ return $this->modifiedTime[$hash];
}
/**
# exclamation mark, so restrict file name to 240 bytes.
if ( strlen( $this->mFilteredName ) > 240 ) {
$this->mTitleError = self::FILENAME_TOO_LONG;
- return $this->mTitle = null;
+ $this->mTitle = null;
+ return $this->mTitle;
}
/**
$nt = Title::makeTitleSafe( NS_FILE, $this->mFilteredName );
if ( is_null( $nt ) ) {
$this->mTitleError = self::ILLEGAL_FILENAME;
- return $this->mTitle = null;
+ $this->mTitle = null;
+ return $this->mTitle;
}
$this->mFilteredName = $nt->getDBkey();
if ( $this->mFinalExtension == '' ) {
$this->mTitleError = self::FILETYPE_MISSING;
- return $this->mTitle = null;
+ $this->mTitle = null;
+ return $this->mTitle;
} elseif ( $blackListedExtensions ||
( $wgCheckFileExtensions && $wgStrictFileExtensions &&
!$this->checkFileExtensionList( $ext, $wgFileExtensions ) ) ) {
$this->mBlackListedExtensions = $blackListedExtensions;
$this->mTitleError = self::FILETYPE_BADTYPE;
- return $this->mTitle = null;
+ $this->mTitle = null;
+ return $this->mTitle;
}
// Windows may be broken with special characters, see bug XXX
if ( wfIsWindows() && !preg_match( '/^[\x0-\x7f]*$/', $nt->getText() ) ) {
$this->mTitleError = self::WINDOWS_NONASCII_FILENAME;
- return $this->mTitle = null;
+ $this->mTitle = null;
+ return $this->mTitle;
}
# If there was more than one "extension", reassemble the base
if ( strlen( $partname ) < 1 ) {
$this->mTitleError = self::MIN_LENGTH_PARTNAME;
- return $this->mTitle = null;
+ $this->mTitle = null;
+ return $this->mTitle;
}
- return $this->mTitle = $nt;
+ $this->mTitle = $nt;
+ return $this->mTitle;
}
/**
$ret = $wgRequest->getVal( 'uselang' );
}
- return $this->mURLVariant = $this->validateVariant( $ret );
+ $this->mURLVariant = $this->validateVariant( $ret );
+ return $this->mURLVariant;
}
/**
$ret = $wgUser->getOption( 'language' );
}
- return $this->mUserVariant = $this->validateVariant( $ret );
+ $this->mUserVariant = $this->validateVariant( $ret );
+ return $this->mUserVariant;
}
/**