r85695 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85694‎ | r85695 | r85696 >
Date:21:38, 8 April 2011
Author:aaron
Status:ok
Tags:
Comment:
Pushed preloadSettings() up to generic form class
Modified paths:
  • /trunk/extensions/FlaggedRevs/business/FRGenericSubmitForm.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/business/PageStabilityForm.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/actions/Stabilization_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/business/FRGenericSubmitForm.php
@@ -67,6 +67,29 @@
6868 }
6969
7070 /*
 71+ * Preload existing params from a DB (e.g. for GET request).
 72+ * @return mixed (true on success, error string on failure)
 73+ */
 74+ public function preload() {
 75+ if ( !$this->inputLock ) {
 76+ throw new MWException( __CLASS__ . " input fields not set yet.\n");
 77+ }
 78+ $status = $this->doCheckTarget();
 79+ if ( $status !== true ) {
 80+ return $status; // bad target
 81+ }
 82+ return $this->doPreloadParameters();
 83+ }
 84+
 85+ /*
 86+ * Preload existing params from a DB (e.g. for GET request).
 87+ * @return mixed (true on success, error string on failure)
 88+ */
 89+ protected function doPreloadParameters() {
 90+ return true;
 91+ }
 92+
 93+ /*
7194 * Check that the target is valid (e.g. from GET/POST request)
7295 * @param int $flags ON_SUBMISSION (set on submit)
7396 * @return mixed (true on success, error string on failure)
Index: trunk/extensions/FlaggedRevs/business/PageStabilityForm.php
@@ -122,26 +122,19 @@
123123 * Preload existing page settings (e.g. from GET request).
124124 * @return mixed (true on success, error string on failure)
125125 */
126 - public function preloadSettings() {
127 - if ( !$this->inputLock ) {
128 - throw new MWException( __CLASS__ . " input fields not set yet.\n");
129 - }
130 - $status = $this->doCheckTarget();
131 - if ( $status !== true ) {
132 - return $status; // bad target
133 - }
 126+ public function doPreloadParameters() {
134127 if ( $this->oldConfig['expiry'] == Block::infinity() ) {
135128 $this->expirySelection = 'infinite'; // no settings set OR indefinite
136129 } else {
137130 $this->expirySelection = 'existing'; // settings set and NOT indefinite
138131 }
139 - return $this->reallyPreloadSettings(); // load the params...
 132+ return $this->reallyDoPreloadParameters(); // load the params...
140133 }
141134
142135 /*
143136 * @return mixed (true on success, error string on failure)
144137 */
145 - protected function reallyPreloadSettings() {
 138+ protected function reallyDoPreloadParameters() {
146139 return true;
147140 }
148141
@@ -372,7 +365,7 @@
373366 $this->trySet( $this->override, $value );
374367 }
375368
376 - protected function reallyPreloadSettings() {
 369+ protected function reallyDoPreloadParameters() {
377370 $this->override = $this->oldConfig['override'];
378371 $this->autoreview = $this->oldConfig['autoreview'];
379372 $this->watchThis = $this->page->userIsWatching();
@@ -471,7 +464,7 @@
472465
473466 // Assumes $wgFlaggedRevsProtection is on
474467 class PageStabilityProtectForm extends PageStabilityForm {
475 - protected function reallyPreloadSettings() {
 468+ protected function reallyDoPreloadParameters() {
476469 $this->autoreview = $this->oldConfig['autoreview']; // protect level
477470 $this->watchThis = $this->page->userIsWatching();
478471 return true;
Index: trunk/extensions/FlaggedRevs/specialpages/actions/Stabilization_body.php
@@ -77,7 +77,7 @@
7878 }
7979 # Form GET request...
8080 } else {
81 - $form->preloadSettings();
 81+ $form->preload();
8282 $this->showForm();
8383 }
8484 }

Status & tagging log