*/
public function getCanonicalURL( $query = '', $variant = false ) {
global $wgCanonicalServer;
- $url = $wgCanonicalServer . $this->getLocalURL( $query, $variant ) . $this->getFragmentForURL();
- wfRunHooks( 'GetCanonicalURL', array( &$this, &$url, $query ) );
+ $url = wfExpandUrl( $this->getLocalURL( $query, $variant ) . $this->getFragmentForURL(), PROTO_CANONICAL );
+ wfRunHooks( '', array( &$this, &$url, $query ) );
return $url;
}
*/
public function resetArticleID( $newid ) {
$linkCache = LinkCache::singleton();
- $linkCache->clearBadLink( $this->getPrefixedDBkey() );
+ $linkCache->clearLink( $this );
if ( $newid === false ) {
$this->mArticleID = -1;
array( 'gtl_from_wiki' => wfGetID(),
'gtl_from_page' => $newid ),
__METHOD__ );
- }
+ }
}
# Save a null revision in the page's history notifying of the move
&& $this->getDBkey() === $title->getDBkey();
}
+ /**
+ * Check if this title is a subpage of another title
+ *
+ * @param $title Title
+ * @return Bool
+ */
+ public function isSubpageOf( Title $title ) {
+ return $this->getInterwiki() === $title->getInterwiki()
+ && $this->getNamespace() == $title->getNamespace()
+ && strpos( $this->getDBkey(), $title->getDBkey() . '/' ) === 0;
+ }
+
/**
* Callback for usort() to do title sorts by (namespace, title)
*