X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FTitle.php;h=3de85e1bf64646f0a4480dea48dc5b1a0e5fb4b1;hb=ad6a6baa1d35e1b05b973fbebad4962fe190172d;hp=3da6ab95525376de9999ba1566bb29e71b16df3a;hpb=48ba60f482318674a5caac7c5399e40eb8fc3920;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 3da6ab9552..3de85e1bf6 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -108,7 +108,12 @@ class Title implements LinkTarget { /** @var array Array of groups allowed to edit this article */ public $mRestrictions = []; - /** @var string|bool */ + /** + * @var string|bool Comma-separated set of permission keys + * indicating who can move or edit the page from the page table, (pre 1.10) rows. + * Edit and move sections are separated by a colon + * Example: "edit=autoconfirmed,sysop:move=sysop" + */ protected $mOldRestrictions = false; /** @var bool Cascade restrictions on this page to included templates and images? */ @@ -776,6 +781,7 @@ class Title implements LinkTarget { * @return string Escaped string */ static function escapeFragmentForURL( $fragment ) { + wfDeprecated( __METHOD__, '1.30' ); # Note that we don't urlencode the fragment. urlencoded Unicode # fragments appear not to work in IE (at least up to 7) or in at least # one version of Opera 9.x. The W3C validator, for one, doesn't seem @@ -1463,7 +1469,9 @@ class Title implements LinkTarget { public function getFragmentForURL() { if ( !$this->hasFragment() ) { return ''; - } elseif ( $this->isExternal() && !$this->getTransWikiID() ) { + } elseif ( $this->isExternal() + && !self::getInterwikiLookup()->fetch( $this->mInterwiki )->isLocal() + ) { return '#' . Sanitizer::escapeIdForExternalInterwiki( $this->getFragment() ); } return '#' . Sanitizer::escapeIdForLink( $this->getFragment() ); @@ -3043,8 +3051,10 @@ class Title implements LinkTarget { * Public for usage by LiquidThreads. * * @param array $rows Array of db result objects - * @param string $oldFashionedRestrictions Comma-separated list of page - * restrictions from page table (pre 1.10) + * @param string $oldFashionedRestrictions Comma-separated set of permission keys + * indicating who can move or edit the page from the page table, (pre 1.10) rows. + * Edit and move sections are separated by a colon + * Example: "edit=autoconfirmed,sysop:move=sysop" */ public function loadRestrictionsFromRows( $rows, $oldFashionedRestrictions = null ) { $dbr = wfGetDB( DB_REPLICA ); @@ -3113,8 +3123,10 @@ class Title implements LinkTarget { /** * Load restrictions from the page_restrictions table * - * @param string $oldFashionedRestrictions Comma-separated list of page - * restrictions from page table (pre 1.10) + * @param string $oldFashionedRestrictions Comma-separated set of permission keys + * indicating who can move or edit the page from the page table, (pre 1.10) rows. + * Edit and move sections are separated by a colon + * Example: "edit=autoconfirmed,sysop:move=sysop" */ public function loadRestrictions( $oldFashionedRestrictions = null ) { if ( $this->mRestrictionsLoaded ) { @@ -3627,19 +3639,20 @@ class Title implements LinkTarget { $blNamespace = "{$prefix}_namespace"; $blTitle = "{$prefix}_title"; + $pageQuery = WikiPage::getQueryInfo(); $res = $db->select( - [ $table, 'page' ], + [ $table, 'nestpage' => $pageQuery['tables'] ], array_merge( [ $blNamespace, $blTitle ], - WikiPage::selectFields() + $pageQuery['fields'] ), [ "{$prefix}_from" => $id ], __METHOD__, $options, - [ 'page' => [ + [ 'nestpage' => [ 'LEFT JOIN', [ "page_namespace=$blNamespace", "page_title=$blTitle" ] - ] ] + ] ] + $pageQuery['joins'] ); $retVal = []; @@ -4192,13 +4205,15 @@ class Title implements LinkTarget { $pageId = $this->getArticleID( $flags ); if ( $pageId ) { $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_REPLICA ); - $row = $db->selectRow( 'revision', Revision::selectFields(), + $revQuery = Revision::getQueryInfo(); + $row = $db->selectRow( $revQuery['tables'], $revQuery['fields'], [ 'rev_page' => $pageId ], __METHOD__, [ 'ORDER BY' => 'rev_timestamp ASC, rev_id ASC', - 'IGNORE INDEX' => 'rev_timestamp', // See T159319 - ] + 'IGNORE INDEX' => [ 'revision' => 'rev_timestamp' ], // See T159319 + ], + $revQuery['joins'] ); if ( $row ) { return new Revision( $row ); @@ -4618,16 +4633,18 @@ class Title implements LinkTarget { * on the number of links. Typically called on create and delete. */ public function touchLinks() { - DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this, 'pagelinks' ) ); + DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this, 'pagelinks', 'page-touch' ) ); if ( $this->getNamespace() == NS_CATEGORY ) { - DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this, 'categorylinks' ) ); + DeferredUpdates::addUpdate( + new HTMLCacheUpdate( $this, 'categorylinks', 'category-touch' ) + ); } } /** * Get the last touched timestamp * - * @param IDatabase $db Optional db + * @param IDatabase|null $db * @return string|false Last-touched timestamp */ public function getTouched( $db = null ) {