r19092 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r19091‎ | r19092 | r19093 >
Date:22:21, 10 January 2007
Author:werdna
Status:old
Tags:
Comment:
Convert the pr_cascade field into a bit-field, so that it might be used later on to hold different values (i.e., an option for templates, an option for images)
Modified paths:
  • /branches/werdna/restrictions-separation/includes/ProtectionForm.php (modified) (history)
  • /branches/werdna/restrictions-separation/includes/Title.php (modified) (history)

Diff [purge]

Index: branches/werdna/restrictions-separation/includes/ProtectionForm.php
@@ -39,7 +39,7 @@
4040 // but the db allows multiples separated by commas.
4141 $this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
4242 }
43 - $this->mCascade = $this->mTitle->areRestrictionsCascading();
 43+ $this->mCascade = $this->mTitle->getRestrictionCascadingFlags() & 1;
4444 }
4545
4646 // The form will be available in read-only to show levels.
@@ -213,7 +213,9 @@
214214
215215 function buildCascadeInput() {
216216 $id = 'mwProtect-cascade';
217 - return wfCheckLabel( wfMsg( 'protect-cascade' ), $id, $id, $this->mCascade, array ());
 217+ $ci = wfCheckLabel( wfMsg( 'protect-cascade' ), $id, $id, $this->mCascade, array ());
 218+ $id = 'mwProtect-cascadeonly';
 219+ $ci .= wfCheckLabel( wfMsg( 'protect-cascadeonly' ), $id, $id, $this->mCascade, array ());
218220 }
219221
220222 function buildSubmit() {
Index: branches/werdna/restrictions-separation/includes/Title.php
@@ -50,7 +50,7 @@
5151 var $mArticleID; # Article ID, fetched from the link cache on demand
5252 var $mLatestID; # ID of most recent revision
5353 var $mRestrictions; # Array of groups allowed to edit this article
54 - var $mCascadeRestrictions;
 54+ var $mCascadeRestrictionFlags;
5555 var $mRestrictionsLoaded; # Boolean for initialisation on demand
5656 var $mPrefixedText; # Text form including namespace/interwiki, initialised on demand
5757 var $mDefaultNamespace; # Namespace index when there is no namespace
@@ -1383,12 +1383,12 @@
13841384 }
13851385 }
13861386
1387 - function areRestrictionsCascading() {
 1387+ function getRestrictionCascadingFlags() {
13881388 if (!$this->mRestrictionsLoaded) {
13891389 $this->loadRestrictions();
13901390 }
13911391
1392 - return $this->mCascadeRestrictions;
 1392+ return $this->mCascadeRestrictionFlags;
13931393 }
13941394
13951395 /**
@@ -1413,9 +1413,7 @@
14141414
14151415 $this->mRestrictions[$row->pr_type] = explode( ',', trim( $row->pr_level ) );
14161416
1417 - if ($row->pr_cascade) {
1418 - $this->mCascadeRestrictions = true;
1419 - }
 1417+ $this->mCascadeRestrictionFlags |= $row->pr_cascade;
14201418 }
14211419
14221420 $this->mRestrictionsLoaded = true;