X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FTitle.php;h=edfdacacc0bd9a43bfb421f5e572725df7b17d38;hb=101556a17482f59ba6b6c07f3a9a747494520a9d;hp=2ebeb0d7566735c09290ffb1f009869c05af6df7;hpb=8ddf721b6feaf11c67aafc1445d255e68faa4007;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 2ebeb0d756..edfdacacc0 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -272,7 +272,7 @@ class Title implements LinkTarget { } try { - return Title::newFromTextThrow( strval( $text ), $defaultNamespace ); + return self::newFromTextThrow( strval( $text ), $defaultNamespace ); } catch ( MalformedTitleException $ex ) { return null; } @@ -411,7 +411,7 @@ class Title implements LinkTarget { __METHOD__ ); if ( $row !== false ) { - $title = Title::newFromRow( $row ); + $title = self::newFromRow( $row ); } else { $title = null; } @@ -439,7 +439,7 @@ class Title implements LinkTarget { $titles = []; foreach ( $res as $row ) { - $titles[] = Title::newFromRow( $row ); + $titles[] = self::newFromRow( $row ); } return $titles; } @@ -541,7 +541,7 @@ class Title implements LinkTarget { } $t = new Title(); - $t->mDbkeyform = Title::makeName( $ns, $title, $fragment, $interwiki, true ); + $t->mDbkeyform = self::makeName( $ns, $title, $fragment, $interwiki, true ); try { $t->secureAndSplit(); @@ -557,10 +557,10 @@ class Title implements LinkTarget { * @return Title The new object */ public static function newMainPage() { - $title = Title::newFromText( wfMessage( 'mainpage' )->inContentLanguage()->text() ); + $title = self::newFromText( wfMessage( 'mainpage' )->inContentLanguage()->text() ); // Don't give fatal errors if the message is broken if ( !$title ) { - $title = Title::newFromText( 'Main Page' ); + $title = self::newFromText( 'Main Page' ); } return $title; } @@ -933,7 +933,7 @@ class Title implements LinkTarget { */ public function getContentModel( $flags = 0 ) { if ( !$this->mForcedContentModel - && ( !$this->mContentModel || $flags === Title::GAID_FOR_UPDATE ) + && ( !$this->mContentModel || $flags === self::GAID_FOR_UPDATE ) && $this->getArticleID( $flags ) ) { $linkCache = LinkCache::singleton(); @@ -1096,7 +1096,7 @@ class Title implements LinkTarget { if ( $canonicalName ) { $localName = SpecialPageFactory::getLocalNameFor( $canonicalName, $par ); if ( $localName != $this->mDbkeyform ) { - return Title::makeTitle( NS_SPECIAL, $localName ); + return self::makeTitle( NS_SPECIAL, $localName ); } } } @@ -1195,7 +1195,7 @@ class Title implements LinkTarget { * @return bool */ public function isMainPage() { - return $this->equals( Title::newMainPage() ); + return $this->equals( self::newMainPage() ); } /** @@ -1313,7 +1313,7 @@ class Title implements LinkTarget { * @return Title The object for the talk page */ public function getTalkPage() { - return Title::makeTitle( MWNamespace::getTalk( $this->getNamespace() ), $this->getDBkey() ); + return self::makeTitle( MWNamespace::getTalk( $this->getNamespace() ), $this->getDBkey() ); } /** @@ -1328,7 +1328,7 @@ class Title implements LinkTarget { if ( $this->getNamespace() == $subjectNS ) { return $this; } - return Title::makeTitle( $subjectNS, $this->getDBkey() ); + return self::makeTitle( $subjectNS, $this->getDBkey() ); } /** @@ -1388,7 +1388,7 @@ class Title implements LinkTarget { if ( !$this->hasFragment() ) { return ''; } else { - return '#' . Title::escapeFragmentForURL( $this->getFragment() ); + return '#' . self::escapeFragmentForURL( $this->getFragment() ); } } @@ -1535,7 +1535,7 @@ class Title implements LinkTarget { * @since 1.20 */ public function getRootTitle() { - return Title::makeTitle( $this->getNamespace(), $this->getRootText() ); + return self::makeTitle( $this->getNamespace(), $this->getRootText() ); } /** @@ -1575,7 +1575,7 @@ class Title implements LinkTarget { * @since 1.20 */ public function getBaseTitle() { - return Title::makeTitle( $this->getNamespace(), $this->getBaseText() ); + return self::makeTitle( $this->getNamespace(), $this->getBaseText() ); } /** @@ -1611,7 +1611,7 @@ class Title implements LinkTarget { * @since 1.20 */ public function getSubpage( $text ) { - return Title::makeTitleSafe( $this->getNamespace(), $this->getText() . '/' . $text ); + return self::makeTitleSafe( $this->getNamespace(), $this->getText() . '/' . $text ); } /** @@ -2847,7 +2847,7 @@ class Title implements LinkTarget { $page_id = $row->pr_page; $page_ns = $row->page_namespace; $page_title = $row->page_title; - $sources[$page_id] = Title::makeTitle( $page_ns, $page_title ); + $sources[$page_id] = self::makeTitle( $page_ns, $page_title ); # Add groups needed for each restriction type if its not already there # Make sure this restriction type still exists @@ -3172,7 +3172,7 @@ class Title implements LinkTarget { if ( $limit > -1 ) { $options['LIMIT'] = $limit; } - $this->mSubpages = TitleArray::newFromResult( + return TitleArray::newFromResult( $dbr->select( 'page', [ 'page_id', 'page_namespace', 'page_title', 'page_is_redirect' ], $conds, @@ -3180,7 +3180,6 @@ class Title implements LinkTarget { $options ) ); - return $this->mSubpages; } /** @@ -3329,7 +3328,7 @@ class Title implements LinkTarget { * @return int Int or 0 if the page doesn't exist */ public function getLatestRevID( $flags = 0 ) { - if ( !( $flags & Title::GAID_FOR_UPDATE ) && $this->mLatestID !== false ) { + if ( !( $flags & self::GAID_FOR_UPDATE ) && $this->mLatestID !== false ) { return intval( $this->mLatestID ); } if ( !$this->getArticleID( $flags ) ) { @@ -3489,7 +3488,7 @@ class Title implements LinkTarget { if ( $res->numRows() ) { $linkCache = LinkCache::singleton(); foreach ( $res as $row ) { - $titleObj = Title::makeTitle( $row->page_namespace, $row->page_title ); + $titleObj = self::makeTitle( $row->page_namespace, $row->page_title ); if ( $titleObj ) { $linkCache->addGoodLinkObjFromRow( $titleObj, $row ); $retVal[] = $titleObj; @@ -3557,9 +3556,9 @@ class Title implements LinkTarget { $linkCache = LinkCache::singleton(); foreach ( $res as $row ) { if ( $row->page_id ) { - $titleObj = Title::newFromRow( $row ); + $titleObj = self::newFromRow( $row ); } else { - $titleObj = Title::makeTitle( $row->$blNamespace, $row->$blTitle ); + $titleObj = self::makeTitle( $row->$blNamespace, $row->$blTitle ); $linkCache->addBadLinkObj( $titleObj ); } $retVal[] = $titleObj; @@ -3615,7 +3614,7 @@ class Title implements LinkTarget { $retVal = []; foreach ( $res as $row ) { - $retVal[] = Title::makeTitle( $row->pl_namespace, $row->pl_title ); + $retVal[] = self::makeTitle( $row->pl_namespace, $row->pl_title ); } return $retVal; } @@ -3735,8 +3734,8 @@ class Title implements LinkTarget { * @return array|bool True on success, getUserPermissionsErrors()-like array on failure */ public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true, - array $changeTags = [] ) { - + array $changeTags = [] + ) { global $wgUser; $err = $this->isValidMoveOperation( $nt, $auth, $reason ); if ( is_array( $err ) ) { @@ -3773,8 +3772,8 @@ class Title implements LinkTarget { * no pages were moved */ public function moveSubpages( $nt, $auth = true, $reason = '', $createRedirect = true, - array $changeTags = [] ) { - + array $changeTags = [] + ) { global $wgMaximumMovedPages; // Check permissions if ( !$this->userCan( 'move-subpages' ) ) { @@ -3827,7 +3826,7 @@ class Title implements LinkTarget { } # T16385: we need makeTitleSafe because the new page names may # be longer than 255 characters. - $newSubpage = Title::makeTitleSafe( $newNs, $newPageName ); + $newSubpage = self::makeTitleSafe( $newNs, $newPageName ); $success = $oldSubpage->moveTo( $newSubpage, $auth, $reason, $createRedirect, $changeTags ); if ( $success === true ) { @@ -3989,7 +3988,7 @@ class Title implements LinkTarget { # Circular reference $stack[$parent] = []; } else { - $nt = Title::newFromText( $parent ); + $nt = self::newFromText( $parent ); if ( $nt ) { $stack[$parent] = $nt->getParentCategoryTree( $children + [ $parent => 1 ] ); }