r97083 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97082‎ | r97083 | r97084 >
Date:18:37, 14 September 2011
Author:dantman
Status:ok
Tags:
Comment:
Paste mistake, these two oldid methods were next to each other but ended up with the robots stuff pasted in between accidentally.
Modified paths:
  • /branches/pageoutput/includes/view/ArticlePageView.php (modified) (history)

Diff [purge]

Index: branches/pageoutput/includes/view/ArticlePageView.php
@@ -30,6 +30,42 @@
3131 }
3232
3333 /**
 34+ * Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect
 35+ *
 36+ * @return int The old id for the request
 37+ */
 38+ public function getOldIDFromRequest() {
 39+ $this->mRedirectUrl = false;
 40+
 41+ $request = $this->getRequest();
 42+
 43+ $oldid = $request->getVal( 'oldid' );
 44+
 45+ if ( isset( $oldid ) ) {
 46+ $oldid = intval( $oldid );
 47+ if ( $rRequest->getVal( 'direction' ) == 'next' ) {
 48+ $nextid = $this->getTitle()->getNextRevisionID( $oldid );
 49+ if ( $nextid ) {
 50+ $oldid = $nextid;
 51+ } else {
 52+ $this->mRedirectUrl = $this->getTitle()->getFullURL( 'redirect=no' );
 53+ }
 54+ } elseif ( $request->getVal( 'direction' ) == 'prev' ) {
 55+ $previd = $this->getTitle()->getPreviousRevisionID( $oldid );
 56+ if ( $previd ) {
 57+ $oldid = $previd;
 58+ }
 59+ }
 60+ }
 61+
 62+ if ( !$oldid ) {
 63+ $oldid = 0;
 64+ }
 65+
 66+ return $oldid;
 67+ }
 68+
 69+ /**
3470 * Get the robot policy to be used for the current view
3571 * @return Array the policy that should be set
3672 */
@@ -130,42 +166,6 @@
131167 return $arr;
132168 }
133169
134 - /**
135 - * Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect
136 - *
137 - * @return int The old id for the request
138 - */
139 - public function getOldIDFromRequest() {
140 - $this->mRedirectUrl = false;
141 -
142 - $request = $this->getRequest();
143 -
144 - $oldid = $request->getVal( 'oldid' );
145 -
146 - if ( isset( $oldid ) ) {
147 - $oldid = intval( $oldid );
148 - if ( $rRequest->getVal( 'direction' ) == 'next' ) {
149 - $nextid = $this->getTitle()->getNextRevisionID( $oldid );
150 - if ( $nextid ) {
151 - $oldid = $nextid;
152 - } else {
153 - $this->mRedirectUrl = $this->getTitle()->getFullURL( 'redirect=no' );
154 - }
155 - } elseif ( $request->getVal( 'direction' ) == 'prev' ) {
156 - $previd = $this->getTitle()->getPreviousRevisionID( $oldid );
157 - if ( $previd ) {
158 - $oldid = $previd;
159 - }
160 - }
161 - }
162 -
163 - if ( !$oldid ) {
164 - $oldid = 0;
165 - }
166 -
167 - return $oldid;
168 - }
169 -
170170 /** PageView render and sub-areas of the rendering process **/
171171
172172 function render() {

Status & tagging log