var $mHasSubpage; // /< Whether a page has any subpages
// @}
-
/**
* Constructor
*/
public function getContentModel() {
if ( !$this->mContentModel ) {
$linkCache = LinkCache::singleton();
+ $linkCache->addLinkObj( $this );
$this->mContentModel = $linkCache->getGoodLinkFieldObj( $this, 'model' );
}
* Used for the title field in <a> tags.
*
* @return String the text, including any prefixes
+ * @deprecated since 1.19
*/
public function getEscapedText() {
wfDeprecated( __METHOD__, '1.19' );
* @param $query string
* @param $query2 bool|string
* @return String the URL
+ * @deprecated since 1.19
*/
public function escapeLocalURL( $query = '', $query2 = false ) {
wfDeprecated( __METHOD__, '1.19' );
*
* @see self::getLocalURL
* @return String the URL
+ * @deprecated since 1.19
*/
public function escapeFullURL( $query = '', $query2 = false ) {
wfDeprecated( __METHOD__, '1.19' );
* @see self::getLocalURL
* @since 1.18
* @return string
+ * @deprecated since 1.19
*/
public function escapeCanonicalURL( $query = '', $query2 = false ) {
wfDeprecated( __METHOD__, '1.19' );
* @return Bool
*/
public function isRedirect( $flags = 0 ) {
- if ( !is_null( $this->mRedirect ) ) {
+ if ( !( $flags & Title::GAID_FOR_UPDATE ) && !is_null( $this->mRedirect ) ) {
return $this->mRedirect;
}
- # Calling getArticleID() loads the field from cache as needed
+
if ( !$this->getArticleID( $flags ) ) {
return $this->mRedirect = false;
}
$linkCache = LinkCache::singleton();
+ $linkCache->addLinkObj( $this );
$cached = $linkCache->getGoodLinkFieldObj( $this, 'redirect' );
+
if ( $cached === null ) {
- // TODO: check the assumption that the cache actually knows about this title
- // and handle this, such as get the title from the database.
- // See https://bugzilla.wikimedia.org/show_bug.cgi?id=37209
- wfDebug( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() );
- wfDebug( wfBacktrace() );
+ // Should not happen
+ throw new MWException( "LinkCache doesn't know redirect status of this title: " . $this->getPrefixedDBkey() );
}
$this->mRedirect = (bool)$cached;
* @return Int
*/
public function getLength( $flags = 0 ) {
- if ( $this->mLength != -1 ) {
+ if ( !( $flags & Title::GAID_FOR_UPDATE ) && $this->mLength != -1 ) {
return $this->mLength;
}
- # Calling getArticleID() loads the field from cache as needed
+
if ( !$this->getArticleID( $flags ) ) {
return $this->mLength = 0;
}
+
$linkCache = LinkCache::singleton();
+ $linkCache->addLinkObj( $this );
$cached = $linkCache->getGoodLinkFieldObj( $this, 'length' );
- if ( $cached === null ) { # check the assumption that the cache actually knows about this title
- # XXX: this does apparently happen, see https://bugzilla.wikimedia.org/show_bug.cgi?id=37209
- # as a stop gap, perhaps log this, but don't throw an exception?
- wfDebug( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() );
- wfDebug( wfBacktrace() );
+
+ if ( $cached === null ) {
+ // Should not happen
+ throw new MWException( "LinkCache doesn't know redirect status of this title: " . $this->getPrefixedDBkey() );
}
$this->mLength = intval( $cached );
if ( !( $flags & Title::GAID_FOR_UPDATE ) && $this->mLatestID !== false ) {
return intval( $this->mLatestID );
}
- # Calling getArticleID() loads the field from cache as needed
+
if ( !$this->getArticleID( $flags ) ) {
return $this->mLatestID = 0;
}
+
$linkCache = LinkCache::singleton();
$linkCache->addLinkObj( $this );
$cached = $linkCache->getGoodLinkFieldObj( $this, 'revision' );
- if ( $cached === null ) { # check the assumption that the cache actually knows about this title
- # XXX: this does apparently happen, see https://bugzilla.wikimedia.org/show_bug.cgi?id=37209
- # as a stop gap, perhaps log this, but don't throw an exception?
- throw new MWException( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() );
+
+ if ( $cached === null ) {
+ // Should not happen
+ throw new MWException( "LinkCache doesn't know latest revision ID of this title: " . $this->getPrefixedDBkey() );
}
$this->mLatestID = intval( $cached );
strpos( $dbkey, '.' ) !== false &&
(
$dbkey === '.' || $dbkey === '..' ||
- strpos( $dbkey, './' ) === 0 ||
+ strpos( $dbkey, './' ) === 0 ||
strpos( $dbkey, '../' ) === 0 ||
strpos( $dbkey, '/./' ) !== false ||
- strpos( $dbkey, '/../' ) !== false ||
+ strpos( $dbkey, '/../' ) !== false ||
substr( $dbkey, -2 ) == '/.' ||
substr( $dbkey, -3 ) == '/..'
)
return $retVal;
}
-
/**
* Get a list of URLs to purge from the Squid cache when this
* page changes
$isKnown = null;
/**
- * Allows overriding default behaviour for determining if a page exists.
+ * Allows overriding default behavior for determining if a page exists.
* If $isKnown is kept as null, regular checks happen. If it's
* a boolean, this value is returned by the isKnown method.
*
// Use always content language to avoid loading hundreds of languages
// to get the link color.
global $wgContLang;
- list( $name, $lang ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->getText() ) );
+ list( $name, ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->getText() ) );
$message = wfMessage( $name )->inLanguage( $wgContLang )->useDatabase( false );
return $message->exists();
}