SamanthaNguyen has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/392361 )
Change subject: Convert SystemGifts to use extension registration
......................................................................
Convert SystemGifts to use extension registration
Bug: T152865
Change-Id: Ia077907a113afeb9da91e45f8922af6be08df38c
---
M SocialProfile.php
D SystemGifts/SystemGifts.php
A SystemGifts/extension.json
M SystemGifts/i18n/en.json
M SystemGifts/i18n/qqq.json
5 files changed, 102 insertions(+), 106 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SocialProfile
refs/changes/61/392361/1
diff --git a/SocialProfile.php b/SocialProfile.php
index 15f5a28..7ea60c0 100644
--- a/SocialProfile.php
+++ b/SocialProfile.php
@@ -161,8 +161,10 @@
// Loader files
require_once( "$IP/extensions/SocialProfile/UserProfile/UserProfile.php" ); //
Profile page configuration loader file
require_once( "$IP/extensions/SocialProfile/UserGifts/Gifts.php" ); //
UserGifts (user-to-user gifting functionality) loader file
-require_once( "$IP/extensions/SocialProfile/SystemGifts/SystemGifts.php" ); //
SystemGifts (awards functionality) loader file
-wfLoadExtension( 'SocialProfile/UserActivity' ); // UserActivity - recent
social changes
+wfLoadExtensions( [
+ 'SocialProfile/SystemGifts', // SystemGifts (awards functionality)
+ 'SocialProfile/UserActivity' // UserActivity - recent social changes
+] );
$wgHooks['BeforePageDisplay'][] = 'SocialProfileHooks::onBeforePageDisplay';
$wgHooks['CanonicalNamespaces'][] =
'SocialProfileHooks::onCanonicalNamespaces';
diff --git a/SystemGifts/SystemGifts.php b/SystemGifts/SystemGifts.php
deleted file mode 100644
index 6979ae0..0000000
--- a/SystemGifts/SystemGifts.php
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-
-if ( !defined( 'MEDIAWIKI' ) ) {
- die();
-}
-
-global $IP, $wgAutoloadClasses, $wgAvailableRights, $wgGroupPermissions,
- $wgSpecialPages;
-
-$wgAvailableRights[] = 'awardsmanage';
-$wgGroupPermissions['staff']['awardsmanage'] = true;
-$wgGroupPermissions['sysop']['awardsmanage'] = true;
-
-$wgSystemGiftsDirectory = "$IP/extensions/SocialProfile/SystemGifts";
-
-$wgAutoloadClasses['SystemGifts'] =
"{$wgSystemGiftsDirectory}/SystemGiftsClass.php";
-$wgAutoloadClasses['UserSystemGifts'] =
"{$wgSystemGiftsDirectory}/UserSystemGiftsClass.php";
-$wgAutoloadClasses['UserSystemGiftsHooks'] =
"{$wgSystemGiftsDirectory}/UserSystemGiftsHooks.php";
-
-// Special Pages
-$wgAutoloadClasses['TopAwards'] = "{$wgSystemGiftsDirectory}/TopAwards.php";
-$wgSpecialPages['TopAwards'] = 'TopAwards';
-
-$wgAutoloadClasses['ViewSystemGifts'] =
"{$wgSystemGiftsDirectory}/SpecialViewSystemGifts.php";
-$wgSpecialPages['ViewSystemGifts'] = 'ViewSystemGifts';
-
-$wgAutoloadClasses['ViewSystemGift'] =
"{$wgSystemGiftsDirectory}/SpecialViewSystemGift.php";
-$wgSpecialPages['ViewSystemGift'] = 'ViewSystemGift';
-
-$wgAutoloadClasses['SystemGiftManager'] =
"{$wgSystemGiftsDirectory}/SpecialSystemGiftManager.php";
-$wgSpecialPages['SystemGiftManager'] = 'SystemGiftManager';
-
-$wgAutoloadClasses['SystemGiftManagerLogo'] =
"{$wgSystemGiftsDirectory}/SpecialSystemGiftManagerLogo.php";
-$wgSpecialPages['SystemGiftManagerLogo'] = 'SystemGiftManagerLogo';
-
-$wgAutoloadClasses['RemoveMasterSystemGift'] =
"{$wgSystemGiftsDirectory}/SpecialRemoveMasterSystemGift.php";
-$wgSpecialPages['RemoveMasterSystemGift'] = 'RemoveMasterSystemGift';
-
-$wgAutoloadClasses['PopulateAwards'] =
"{$wgSystemGiftsDirectory}/SpecialPopulateAwards.php";
-$wgSpecialPages['PopulateAwards'] = 'PopulateAwards';
-
-// i18n
-$wgMessagesDirs['SystemGifts'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['SystemGiftsAlias'] = __DIR__ .
'/SystemGifts.alias.php';
-
-// Register the CSS with ResourceLoader
-$wgResourceModules['ext.socialprofile.systemgifts.css'] = array(
- 'styles' => 'SystemGift.css',
- 'localBasePath' => __DIR__,
- 'remoteExtPath' => 'SocialProfile/SystemGifts',
- 'position' => 'top'
-);
-
-$wgResourceModules['ext.socialprofile.special.removemastersystemgift.css'] =
array(
- 'styles' => 'SpecialRemoveMasterSystemGift.css',
- 'localBasePath' => __DIR__,
- 'remoteExtPath' => 'SocialProfile/SystemGifts',
- 'position' => 'top'
-);
-
-$wgResourceModules['ext.socialprofile.special.systemgiftmanager.css'] = array(
- 'styles' => 'SpecialSystemGiftManager.css',
- 'localBasePath' => __DIR__,
- 'remoteExtPath' => 'SocialProfile/SystemGifts',
- 'position' => 'top'
-);
-
-$wgResourceModules['ext.socialprofile.special.systemgiftmanagerlogo.css'] =
array(
- 'styles' => 'SpecialSystemGiftManagerLogo.css',
- 'localBasePath' => __DIR__,
- 'remoteExtPath' => 'SocialProfile/SystemGifts',
- 'position' => 'top'
-);
-
-$wgResourceModules['ext.socialprofile.special.topawards.css'] = array(
- 'styles' => 'SpecialTopAwards.css',
- 'localBasePath' => __DIR__,
- 'remoteExtPath' => 'SocialProfile/SystemGifts',
- 'position' => 'top'
-);
-
-$wgResourceModules['ext.socialprofile.special.viewsystemgift.css'] = array(
- 'styles' => 'SpecialViewSystemGift.css',
- 'localBasePath' => __DIR__,
- 'remoteExtPath' => 'SocialProfile/SystemGifts',
- 'position' => 'top'
-);
-
-$wgResourceModules['ext.socialprofile.special.viewsystemgifts.css'] = array(
- 'styles' => 'SpecialViewSystemGifts.css',
- 'localBasePath' => __DIR__,
- 'remoteExtPath' => 'SocialProfile/SystemGifts',
- 'position' => 'top'
-);
-
-// Echo (Notifications) stuff
-$wgAutoloadClasses['EchoUserSystemGiftPresentationModel'] =
"{$wgSystemGiftsDirectory}/EchoUserSystemGiftPresentationModel.php";
-
-$wgHooks['BeforeCreateEchoEvent'][] =
'UserSystemGiftsHooks::onBeforeCreateEchoEvent';
-$wgHooks['EchoGetDefaultNotifiedUsers'][] =
'UserSystemGiftsHooks::onEchoGetDefaultNotifiedUsers';
-$wgHooks['EchoGetBundleRules'][] =
'UserSystemGiftsHooks::onEchoGetBundleRules';
-
-$wgDefaultUserOptions['echo-subscriptions-web-social-award'] = true;
-$wgDefaultUserOptions['echo-subscriptions-email-social-award'] = false;
diff --git a/SystemGifts/extension.json b/SystemGifts/extension.json
new file mode 100644
index 0000000..eebc98b
--- /dev/null
+++ b/SystemGifts/extension.json
@@ -0,0 +1,96 @@
+{
+ "name": "SystemGifts",
+ "author": [
+ "Aaron Wright",
+ "David Pean",
+ "Jack Phoenix"
+ ],
+ "license-name": "GPL-2.0+",
+ "descriptionmsg": "systemgifts-desc",
+ "type": "other",
+ "MessagesDirs": {
+ "SystemGifts": [
+ "i18n"
+ ]
+ },
+ "ExtensionMessagesFiles": {
+ "SystemGiftsAlias": "SystemGifts.alias.php"
+ },
+ "AutoloadClasses": {
+ "SystemGifts": "SystemGiftsClass.php",
+ "UserSystemGifts": "UserSystemGiftsClass.php",
+ "UserSystemGiftsHooks": "UserSystemGiftsHooks.php",
+ "TopAwards": "TopAwards.php",
+ "ViewSystemGifts": "SpecialViewSystemGifts.php",
+ "ViewSystemGift": "SpecialViewSystemGift.php",
+ "SystemGiftManager": "SpecialSystemGiftManager.php",
+ "SystemGiftManagerLogo": "SpecialSystemGiftManagerLogo.php",
+ "RemoveMasterSystemGift": "SpecialRemoveMasterSystemGift.php",
+ "PopulateAwards": "SpecialPopulateAwards.php",
+ "EchoUserSystemGiftPresentationModel":
"EchoUserSystemGiftPresentationModel.php"
+ },
+ "Hooks": {
+ "BeforeCreateEchoEvent":
"UserSystemGiftsHooks::onBeforeCreateEchoEvent",
+ "EchoGetDefaultNotifiedUsers":
"UserSystemGiftsHooks::onEchoGetDefaultNotifiedUsers",
+ "EchoGetBundleRules":
"UserSystemGiftsHooks::onEchoGetBundleRules"
+ },
+ "SpecialPages": {
+ "TopAwards": "TopAwards",
+ "ViewSystemGifts": "ViewSystemGifts",
+ "ViewSystemGift": "ViewSystemGift",
+ "SystemGiftManager": "SystemGiftManager",
+ "SystemGiftManagerLogo": "SystemGiftManagerLogo",
+ "RemoveMasterSystemGift": "RemoveMasterSystemGift",
+ "PopulateAwards": "PopulateAwards"
+ },
+ "DefaultUserOptions": {
+ "echo-subscriptions-web-social-award": true,
+ "echo-subscriptions-email-social-award": false
+ },
+ "AvailableRights": [
+ "awardsmanage"
+ ],
+ "GroupPermissions": {
+ "staff": {
+ "awardsmanage": true
+ },
+ "sysop": {
+ "awardsmanage": true
+ }
+ },
+ "ResourceModules": {
+ "ext.socialprofile.systemgifts.css": {
+ "styles": "SystemGift.css",
+ "position": "top"
+ },
+ "ext.socialprofile.special.removemastersystemgift.css": {
+ "styles": "SpecialRemoveMasterSystemGift.css",
+ "position": "top"
+ },
+ "ext.socialprofile.special.systemgiftmanager.css": {
+ "styles": "SpecialSystemGiftManager.css",
+ "position": "top"
+ },
+ "ext.socialprofile.special.systemgiftmanagerlogo.css": {
+ "styles": "SpecialSystemGiftManagerLogo.css",
+ "position": "top"
+ },
+ "ext.socialprofile.special.topawards.css": {
+ "styles": "SpecialTopAwards.css",
+ "position": "top"
+ },
+ "ext.socialprofile.special.viewsystemgift.css": {
+ "styles": "SpecialViewSystemGift.css",
+ "position": "top"
+ },
+ "ext.socialprofile.special.viewsystemgifts.css": {
+ "styles": "SpecialViewSystemGifts.css",
+ "position": "top"
+ }
+ },
+ "ResourceFileModulePaths": {
+ "localBasePath": "",
+ "remoteExtPath": "SocialProfile/SystemGifts"
+ },
+ "manifest_version": 1
+}
\ No newline at end of file
diff --git a/SystemGifts/i18n/en.json b/SystemGifts/i18n/en.json
index 305ba91..dacbed3 100644
--- a/SystemGifts/i18n/en.json
+++ b/SystemGifts/i18n/en.json
@@ -5,6 +5,7 @@
"Purodha"
]
},
+ "systemgifts-desc": "Allows sending, receiving, creating, and removing
system gifts",
"systemgiftmanager": "System gifts manager",
"ga-addnew": "+ Add new gift",
"ga-back-edit-gift": "Back to edit this gift",
diff --git a/SystemGifts/i18n/qqq.json b/SystemGifts/i18n/qqq.json
index a029462..406752c 100644
--- a/SystemGifts/i18n/qqq.json
+++ b/SystemGifts/i18n/qqq.json
@@ -7,6 +7,7 @@
"Umherirrender"
]
},
+ "systemgifts-desc":
"{{desc|name=SystemGifts|url=https://www.mediawiki.org/wiki/Extension:SocialProfile}}",
"systemgiftmanager": "Page title for system git manager pages.",
"ga-addnew": "Link to gift creation form.",
"ga-back-edit-gift": "Link to system gift edit screen after upload of
gift icon.",
--
To view, visit https://gerrit.wikimedia.org/r/392361
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia077907a113afeb9da91e45f8922af6be08df38c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SocialProfile
Gerrit-Branch: master
Gerrit-Owner: SamanthaNguyen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits