r53728 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53727‎ | r53728 | r53729 >
Date:21:56, 24 July 2009
Author:demon
Status:deferred
Tags:
Comment:
Kill off a lot of direct calls to $wgRequest->data. This is bad form and will break when I eventually fix WebRequest.
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormUtils.inc (modified) (history)
  • /trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.php (modified) (history)
  • /trunk/extensions/uniwiki/Layouts/Layouts.php (modified) (history)

Diff [purge]

Index: trunk/extensions/uniwiki/GenericEditPage/GenericEditPage.php
@@ -179,7 +179,7 @@
180180
181181 /* add any categories that may have been passed with the
182182 * GET request as if they started out on the page */
183 - $data = $wgRequest->data;
 183+ $data = $wgRequest->getValues();
184184 foreach ( $data as $key => $value ) {
185185 if ( $key == 'category' ) {
186186 $category = substr ( $value, 9 ); // value = category-categoryname
@@ -699,7 +699,7 @@
700700
701701 function UW_GenericEditPage_combineBeforeSave ( &$editpage_Obj ) {
702702 global $wgRequest, $wgSwitchMode;
703 - $data = $wgRequest->data;
 703+ $data = $wgRequest->getValues();
704704
705705 /* if this request was triggered by the user
706706 * pressing the "switch mode" button, then
Index: trunk/extensions/uniwiki/Layouts/Layouts.php
@@ -75,9 +75,9 @@
7676 /* don't hijack the request if we are
7777 * in the middle of switching modes,
7878 * previewing, or showing changes */
79 - if ( isset( $wgRequest->data['switch-mode'] )
80 - || isset( $wgRequest->data['wpTextbox1'] )
81 - || isset( $wgRequest->data['section-0'] ) )
 79+ if ( $wgRequest->getVal('switch-mode')
 80+ || $wgRequest->getVal('wpTextbox1')
 81+ || $wgRequest->getVal('section-0' ) )
8282 return true;
8383
8484 /* if this page is new,
@@ -86,7 +86,7 @@
8787 * and we are not submitting the form (either saving OR preview)
8888 * and we're NOT editing an old revision */
8989 if ( $article->getID() === 0
90 - && ( !isset( $wgRequest->data['oldid'] ) || $article->fetchContent( $wgRequest->data['oldid'] ) === false )
 90+ && ( $wgRequest->getVal('oldid') || $article->fetchContent( $wgRequest->getVal('oldid') ) === false )
9191 && ( $wgRequest->getVal ( "layout" ) === NULL )
9292 && in_array ( $article->mTitle->getNamespace(), $wgLayoutWhiteList )
9393 && ( $wgRequest->getVal( "action" ) != "submit" ) )
Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.inc
@@ -573,7 +573,7 @@
574574 elseif (($wgTitle->getText() == 'AddData' || $wgTitle->getText() == 'EditData')
575575 && $wgTitle->getNamespace() == NS_SPECIAL) {
576576 global $wgRequest;
577 - $title_components = split('/', $wgRequest->data['title']);
 577+ $title_components = split('/', $wgRequest->getVal('title'));
578578 if (count($title_components) >= 2) {
579579 $add_page_title = Title::makeTitleSafe(NS_SPECIAL, 'AddPage');
580580 $cancel = $sk->makeKnownLink($add_page_title->getPrefixedText() . '/' . $title_components[1], $label);

Status & tagging log