MaxSem has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/369588 )

Change subject: Namespace this extension
......................................................................

Namespace this extension

Change-Id: I2f3e8dd47a50c6163ad33d94421819f4d572ca06
---
D GlobalPreferences.php
M extension.json
R includes/GlobalPreferences.php
R includes/Hooks.php
R includes/SpecialGlobalPreferences.php
5 files changed, 37 insertions(+), 39 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalPreferences 
refs/changes/88/369588/1

diff --git a/GlobalPreferences.php b/GlobalPreferences.php
deleted file mode 100644
index b1a1a0e..0000000
--- a/GlobalPreferences.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * Implements global preferences for MediaWiki
- *
- * @author Kunal Mehta <[email protected]>
- * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
- * @file
- * @ingroup Extensions
- *
- * Partially based off of work by Werdna
- * https://www.mediawiki.org/wiki/Special:Code/MediaWiki/49790
- */
-
-if ( function_exists( 'wfLoadExtension' ) ) {
-       wfLoadExtension( 'GlobalPreferences' );
-       // Keep i18n globals so mergeMessageFileList.php doesn't break
-       $wgMessagesDirs['GlobalPreferences'] = __DIR__ . '/i18n';
-       $wgExtensionMessagesFiles['GlobalPreferencesAlias'] = __DIR__ . 
'/GlobalPreferences.alias.php';
-       wfWarn(
-               'Deprecated PHP entry point used for GlobalPreferences 
extension. '
-               . 'Please use wfLoadExtension instead, '
-               . 'see https://www.mediawiki.org/wiki/Extension_registration 
for more details.'
-       );
-       return true;
-} else {
-       die( 'This version of the GlobalPreferences extension requires 
MediaWiki 1.25+' );
-}
diff --git a/extension.json b/extension.json
index 2bc56f7..8245339 100644
--- a/extension.json
+++ b/extension.json
@@ -12,7 +12,7 @@
                "GlobalPreferencesDB": null
        },
        "SpecialPages": {
-               "GlobalPreferences": "SpecialGlobalPreferences"
+               "GlobalPreferences": 
"GlobalPreferences\\SpecialGlobalPreferences"
        },
        "MessagesDirs": {
                "GlobalPreferences": [
@@ -23,26 +23,26 @@
                "GlobalPreferencesAlias": "GlobalPreferences.alias.php"
        },
        "AutoloadClasses": {
-               "GlobalPreferences": "GlobalPreferences.body.php",
-               "GlobalPreferencesHooks": "GlobalPreferences.hooks.php",
-               "SpecialGlobalPreferences": "SpecialGlobalPreferences.php"
+               "GlobalPreferences\\GlobalPreferences": 
"includes/GlobalPreferences.php",
+               "GlobalPreferences\\Hooks": "includes/Hooks.php",
+               "GlobalPreferences\\SpecialGlobalPreferences": 
"includes/SpecialGlobalPreferences.php"
        },
        "Hooks": {
                "UserLoadOptions": [
-                       "GlobalPreferencesHooks::onUserLoadOptions"
+                       "GlobalPreferences\\Hooks::onUserLoadOptions"
                ],
                "UserSaveOptions": [
-                       "GlobalPreferencesHooks::onUserSaveOptions"
+                       "GlobalPreferences\\Hooks::onUserSaveOptions"
                ],
                "PreferencesFormPreSave": [
-                       "GlobalPreferencesHooks::onPreferencesFormPreSave"
+                       "GlobalPreferences\\Hooks::onPreferencesFormPreSave"
                ],
                "LoadExtensionSchemaUpdates": [
-                       "GlobalPreferencesHooks::onLoadExtensionSchemaUpdates"
+                       "GlobalPreferences\\Hooks::onLoadExtensionSchemaUpdates"
                ]
        },
        "ExtensionFunctions": [
-               "GlobalPreferencesHooks::onExtensionFunctions"
+               "GlobalPreferences\\Hooks::onExtensionFunctions"
        ],
        "ResourceFileModulePaths": {
                "localBasePath": "resources",
diff --git a/GlobalPreferences.body.php b/includes/GlobalPreferences.php
similarity index 94%
rename from GlobalPreferences.body.php
rename to includes/GlobalPreferences.php
index d681ac5..fd5c6b8 100644
--- a/GlobalPreferences.body.php
+++ b/includes/GlobalPreferences.php
@@ -10,6 +10,15 @@
  * Partially based off of work by Werdna
  * https://www.mediawiki.org/wiki/Special:Code/MediaWiki/49790
  */
+
+namespace GlobalPreferences;
+
+use CentralIdLookup;
+use IContextSource;
+use RequestContext;
+use User;
+use Wikimedia\Rdbms\Database;
+
 class GlobalPreferences {
 
        /**
@@ -82,6 +91,7 @@
        /**
         * Convenience function to check if we're on the local
         * prefs page
+        *
         * @param IContextSource $context The context to use; if not set main 
request context is used.
         * @return bool
         */
diff --git a/GlobalPreferences.hooks.php b/includes/Hooks.php
similarity index 96%
rename from GlobalPreferences.hooks.php
rename to includes/Hooks.php
index fecc178..1f57698 100644
--- a/GlobalPreferences.hooks.php
+++ b/includes/Hooks.php
@@ -1,6 +1,14 @@
 <?php
 
-class GlobalPreferencesHooks {
+namespace GlobalPreferences;
+
+use DatabaseUpdater;
+use Linker;
+use PreferencesForm;
+use SpecialPage;
+use User;
+
+class Hooks {
 
        /**
         * "bad" preferences that we should remove from
@@ -35,7 +43,7 @@
        public static function onExtensionFunctions() {
                global $wgHooks;
                // Register this as late as possible!
-               $wgHooks['GetPreferences'][] = 
'GlobalPreferencesHooks::onGetPreferences';
+               $wgHooks['GetPreferences'][] = self::class . 
'::onGetPreferences';
        }
 
        /**
diff --git a/SpecialGlobalPreferences.php 
b/includes/SpecialGlobalPreferences.php
similarity index 91%
rename from SpecialGlobalPreferences.php
rename to includes/SpecialGlobalPreferences.php
index 33ef788..8c41fdf 100644
--- a/SpecialGlobalPreferences.php
+++ b/includes/SpecialGlobalPreferences.php
@@ -1,5 +1,13 @@
 <?php
 
+namespace GlobalPreferences;
+
+use ErrorPageError;
+use PermissionsError;
+use SpecialPage;
+use SpecialPreferences;
+use UserNotLoggedIn;
+
 class SpecialGlobalPreferences extends SpecialPreferences {
        function __construct() {
                SpecialPage::__construct( 'GlobalPreferences' );

-- 
To view, visit https://gerrit.wikimedia.org/r/369588
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2f3e8dd47a50c6163ad33d94421819f4d572ca06
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalPreferences
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to