X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FTitle.php;h=3ed6b8bb6e14ee728b65a1ea80febf89947ead7d;hb=d4a1177aa66759a5cf05887830435bb9e50f7780;hp=13a6f56206dc12c063c112ebe892820d3d3fcde9;hpb=32b80f38ffc0baeabfff203bd6095a844da31048;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 13a6f56206..3ed6b8bb6e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2549,6 +2549,29 @@ class Title implements LinkTarget { * protection, or false if there's none. */ public function getTitleProtection() { + $protection = $this->getTitleProtectionInternal(); + if ( $protection ) { + if ( $protection['permission'] == 'sysop' ) { + $protection['permission'] = 'editprotected'; // B/C + } + if ( $protection['permission'] == 'autoconfirmed' ) { + $protection['permission'] = 'editsemiprotected'; // B/C + } + } + return $protection; + } + + /** + * Fetch title protection settings + * + * To work correctly, $this->loadRestrictions() needs to have access to the + * actual protections in the database without munging 'sysop' => + * 'editprotected' and 'autoconfirmed' => 'editsemiprotected'. Other + * callers probably want $this->getTitleProtection() instead. + * + * @return array|bool + */ + protected function getTitleProtectionInternal() { // Can't protect pages in special namespaces if ( $this->getNamespace() < 0 ) { return false; @@ -2576,12 +2599,6 @@ class Title implements LinkTarget { // fetchRow returns false if there are no rows. $row = $dbr->fetchRow( $res ); if ( $row ) { - if ( $row['permission'] == 'sysop' ) { - $row['permission'] = 'editprotected'; // B/C - } - if ( $row['permission'] == 'autoconfirmed' ) { - $row['permission'] = 'editsemiprotected'; // B/C - } $row['expiry'] = $dbr->decodeExpiry( $row['expiry'] ); } $this->mTitleProtection = $row; @@ -2979,7 +2996,7 @@ class Title implements LinkTarget { $this->loadRestrictionsFromRows( $rows, $oldFashionedRestrictions ); } else { - $title_protection = $this->getTitleProtection(); + $title_protection = $this->getTitleProtectionInternal(); if ( $title_protection ) { $now = wfTimestampNow();