jenkins-bot has submitted this change and it was merged.
Change subject: adding a more appropriate user-agent
......................................................................
adding a more appropriate user-agent
Bug: 58651
Change-Id: Ic4007507a7278be4d00228ced1e6d1e197faad27
---
M GWToolset.php
M includes/Config.php
M includes/Constants.php
M includes/Handlers/UploadHandler.php
4 files changed, 13 insertions(+), 11 deletions(-)
Approvals:
BryanDavis: Looks good to me, approved
Gergő Tisza: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/GWToolset.php b/GWToolset.php
index bd9e1bc..9505e62 100644
--- a/GWToolset.php
+++ b/GWToolset.php
@@ -8,11 +8,18 @@
*/
namespace GWToolset;
+use GWToolset\Constants;
if ( !defined( 'MEDIAWIKI' ) ) {
echo 'This file is part of a MediaWiki extension; it is not a valid
entry point. To install this extension, follow the instructions in the INSTALL
file.';
exit();
}
+
+// set extension directory reference to this directory
+$wgGWToolsetDir = realpath( __DIR__ );
+
+// load extension constants
+require_once $wgGWToolsetDir . '/includes/Constants.php';
// register extension metadata with MediaWiki
$wgExtensionCredits['media'][] = array(
@@ -21,11 +28,8 @@
'name' => 'GWToolset',
'path' => __FILE__,
'url' => 'https://www.mediawiki.org/wiki/Extension:GWToolset',
- 'version' => '0.0.1-dev'
+ 'version' => Constants::EXTENSION_VERSION
);
-
-// set extension directory reference to this directory
-$wgGWToolsetDir = realpath( __DIR__ );
// define namespaces
// @see http://www.mediawiki.org/wiki/Manual:Using_custom_namespaces
@@ -48,7 +52,6 @@
// add autoloader classes
$wgAutoloadClasses = $wgAutoloadClasses + array(
'GWToolset\Config' => $wgGWToolsetDir . '/includes/Config.php',
- 'GWToolset\Constants' => $wgGWToolsetDir . '/includes/Constants.php',
'GWToolset\GWTException' => $wgGWToolsetDir .
'/includes/GWTException.php',
'GWToolset\Utils' => $wgGWToolsetDir . '/includes/Utils.php',
'GWToolset\Adapters\DataAdapterInterface' => $wgGWToolsetDir .
'/includes/Adapters/DataAdapterInterface.php',
diff --git a/includes/Config.php b/includes/Config.php
index dd719c9..bb94a55 100644
--- a/includes/Config.php
+++ b/includes/Config.php
@@ -50,11 +50,6 @@
public static $http_timeout = 1200;
/**
- * @var {string}
- */
- public static $http_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1;
rv:1.7.3) Gecko/20041001 Firefox/0.10.1';
-
- /**
* @var {int}
* 1.25e7 or 12,500,000 default
*/
diff --git a/includes/Constants.php b/includes/Constants.php
index 5c91817..d7e4dc9 100644
--- a/includes/Constants.php
+++ b/includes/Constants.php
@@ -12,6 +12,7 @@
class Constants {
const EXTENSION_NAME = 'GWToolset';
+ const EXTENSION_VERSION = '0.1.0';
const REQUIRED_MEDIAWIKI_VERSION = '1.22c';
const USE_FILEBACKEND = true;
diff --git a/includes/Handlers/UploadHandler.php
b/includes/Handlers/UploadHandler.php
index ef856a8..49b1e37 100644
--- a/includes/Handlers/UploadHandler.php
+++ b/includes/Handlers/UploadHandler.php
@@ -16,6 +16,7 @@
GWToolset\Helpers\FileChecks,
GWToolset\Helpers\WikiChecks,
GWToolset\Jobs\UploadMediafileJob,
+ Http,
MimeMagic,
MWException,
MWHttpRequest,
@@ -252,7 +253,9 @@
array(
'method' => 'HEAD',
'followRedirects' => true,
- 'userAgent' => Config::$http_agent
+ 'userAgent' => Http::userAgent() . ' ' .
+ Constants::EXTENSION_NAME . '/' .
+ Constants::EXTENSION_VERSION
)
);
--
To view, visit https://gerrit.wikimedia.org/r/103561
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic4007507a7278be4d00228ced1e6d1e197faad27
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Dan-nl <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits