diff --git a/includes/Parameters.php b/includes/Parameters.php
index 1702add9..cfe4c6fd 100644
--- a/includes/Parameters.php
+++ b/includes/Parameters.php
@@ -995,31 +995,31 @@ public function _scroll( $option ) {
// If scrolling is active we adjust the values for certain other parameters based on URL arguments
if ( $option === true ) {
- global $wgRequest;
+ $request = RequestContext::getMain()->getRequest();
// The 'findTitle' option has argument over the 'fromTitle' argument.
- $titlegt = $wgRequest->getVal( 'DPL_findTitle', '' );
+ $titlegt = $request->getVal( 'DPL_findTitle', '' );
if ( !empty( $titlegt ) ) {
$titlegt = '=_' . ucfirst( $titlegt );
} else {
- $titlegt = $wgRequest->getVal( 'DPL_fromTitle', '' );
+ $titlegt = $request->getVal( 'DPL_fromTitle', '' );
$titlegt = ucfirst( $titlegt );
}
$this->setParameter( 'titlegt', str_replace( ' ', '_', $titlegt ) );
// Lets get the 'toTitle' argument.
- $titlelt = $wgRequest->getVal( 'DPL_toTitle', '' );
+ $titlelt = $request->getVal( 'DPL_toTitle', '' );
$titlelt = ucfirst( $titlelt );
$this->setParameter( 'titlelt', str_replace( ' ', '_', $titlelt ) );
// Make sure the 'scrollDir' arugment is captured. This is mainly used for the Variables extension and in the header/footer replacements.
- $this->setParameter( 'scrolldir', $wgRequest->getVal( 'DPL_scrollDir', '' ) );
+ $this->setParameter( 'scrolldir', $request->getVal( 'DPL_scrollDir', '' ) );
// Also set count limit from URL if not otherwise set.
- $this->_count( $wgRequest->getInt( 'DPL_count' ) );
+ $this->_count( $request->getInt( 'DPL_count' ) );
}
// We do not return false since they could have just left it out. Who knows why they put the parameter in the list in the first place.
diff --git a/includes/Parse.php b/includes/Parse.php
index 882fb756..60befd1b 100644
--- a/includes/Parse.php
+++ b/includes/Parse.php
@@ -8,6 +8,7 @@
use MediaWiki\MediaWikiServices;
use MWException;
use Parser;
+use RequestContext;
use Title;
use WebRequest;
use Wikimedia\Rdbms\IDatabase;
@@ -97,13 +98,11 @@ class Parse {
];
public function __construct() {
- global $wgRequest;
-
$this->DB = wfGetDB( DB_REPLICA, 'dpl' );
$this->parameters = new Parameters();
$this->logger = new Logger();
$this->tableNames = Query::getTableNames();
- $this->request = $wgRequest;
+ $this->request = RequestContext::getMain()->getRequest();
}
/**
diff --git a/includes/UpdateArticle.php b/includes/UpdateArticle.php
index 04f7c029..02b4e378 100644
--- a/includes/UpdateArticle.php
+++ b/includes/UpdateArticle.php
@@ -218,9 +218,6 @@ public static function updateArticleByRule( $title, $text, $rulesText ) {
}
// deal with template parameters =================================================
-
- global $wgRequest;
-
$user = RequestContext::getMain()->getUser();
if ( $template != '' ) {
@@ -331,7 +328,9 @@ public static function updateArticleByRule( $title, $text, $rulesText ) {
if ( $call >= $matchCount ) {
break;
}
- $myValue = $wgRequest->getVal( urlencode( $call . '_' . $parm ), '' );
+
+ $request = RequestContext::getMain()->getRequest();
+ $myValue = $request->getVal( urlencode( $call . '_' . $parm ), '' );
}
$myOptional = array_key_exists( $nr, $optional );
@@ -354,7 +353,9 @@ public static function updateArticleByRule( $title, $text, $rulesText ) {
if ( $exec == 'set' ) {
return self::doUpdateArticle( $title, $text, $summary );
} elseif ( $exec == 'preview' ) {
- global $wgScriptPath, $wgRequest;
+ global $wgScriptPath;
+
+ $request = RequestContext::getMain()->getRequest();
$titleX = Title::newFromText( $title );
$articleX = new Article( $titleX );
@@ -371,7 +372,7 @@ public static function updateArticleByRule( $title, $text, $rulesText ) {
-
+