* @param $text String Text with possible redirect
* @return Array of Titles, with the destination last
* @deprecated since 1.WD, use Content::getRedirectChain instead.
- * @todo: migrate this logic into WikitextContent!
*/
public static function newFromRedirectArray( $text ) {
$content = ContentHandler::makeContent( $text, null, CONTENT_MODEL_WIKITEXT );
*/
public function isConversionTable() {
return $this->getNamespace() == NS_MEDIAWIKI &&
- strpos( $this->getText(), 'Conversiontable' ) !== false;
+ strpos( $this->getText(), 'Conversiontable/' ) === 0;
}
/**
$linkCache = LinkCache::singleton();
$cached = $linkCache->getGoodLinkFieldObj( $this, 'redirect' );
- assert( $cached !== null ); # assert the assumption that the cache actually knows about this title #XXX breaks stuff #TODO: use exception
+ 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() );
+ }
$this->mRedirect = (bool)$cached;
}
$linkCache = LinkCache::singleton();
$cached = $linkCache->getGoodLinkFieldObj( $this, 'length' );
- assert( $cached !== null ); # assert the assumption that the cache actually knows about this title #TODO: use exception
+ 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() );
+ }
$this->mLength = intval( $cached );
}
$linkCache = LinkCache::singleton();
$cached = $linkCache->getGoodLinkFieldObj( $this, 'revision' );
- assert( $cached !== null ); # assert the assumption that the cache actually knows about this title #TODO: use exception
+ 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() );
+ }
$this->mLatestID = intval( $cached );