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

Change subject: Convert WebChat to use extension registartion
......................................................................

Convert WebChat to use extension registartion

Original request submitted by Meneth on GitHub. 
https://github.com/wikimedia/mediawiki-extensions-WebChat/pull/1

Bug: T174456
Change-Id: Id44e0587956549e5f3d722aebbb474c23b9bbd12
---
M WebChat.php
A extension.json
2 files changed, 75 insertions(+), 52 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WebChat 
refs/changes/71/374571/1

diff --git a/WebChat.php b/WebChat.php
index e1a80b2..b32f2f3 100644
--- a/WebChat.php
+++ b/WebChat.php
@@ -15,55 +15,15 @@
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
  */
 
-// If this is run directly from the web die as this is not a valid entry point.
-if ( !defined( 'MEDIAWIKI' ) ) { die( 'Invalid entry point.' );
-}
-
-// Extension credits.
-$wgExtensionCredits[ 'specialpage' ][] = [
-       'path'           => __FILE__,
-       'name'           => 'WebChat',
-       'descriptionmsg' => 'webchat-desc',
-       'author'         => [ 'Robert Leverington', 'Marco 27' ],
-       'url'            => 'https://www.mediawiki.org/wiki/Extension:WebChat',
-       'version'        => '1.3.0',
-];
-
-$dir = __DIR__ . '/';
-
-// Register special page.
-$wgSpecialPages['WebChat'] = 'WebChat';
-$wgAutoloadClasses['WebChat'] = $dir . 'WebChat_body.php';
-
-// Extension messages.
-$wgMessagesDirs['WebChat'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['WebChatAlias'] = $dir . 'WebChat.alias.php';
-
-// Default configuration.
-$wgWebChatServer  = '';
-$wgWebChatChannel = '';
-$wgWebChatClient  = '';
-$wgWebChatClients = [
-       'Mibbit' => [
-               'url' => '//embed.mibbit.com/index.html',
-               'parameters' => [
-                       'noServerMotd' => 'true',
-                       'server'  => '$$$server$$$',
-                       'channel' => '$$$channel$$$',
-                       'nick'    => '$$$nick$$$',
-               ],
-       ],
-       'freenodeChat' => [
-               'url' => '//webchat.freenode.net/',
-               'parameters' => [
-                       'channels' => '$$$channel$$$',
-                       'nick'    => '$$$nick$$$',
-               ],
-       ]
-];
-
-// Default permissions.
-$wgAvailableRights[] = 'webchat';
-$wgGroupPermissions['*']['webchat'] = false;
-$wgGroupPermissions['user' ]['webchat'] = true;
-$wgGroupPermissions['sysop']['webchat'] = true;
+<?php
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'WebChat' );
+       wfWarn(
+               'Deprecated PHP entry point used for WebChat extension. ' .
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );
+       return;
+} else {
+       die( 'This version of the FooBar extension requires MediaWiki 1.29+' );
+}
\ No newline at end of file
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..544b67b
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,63 @@
+{
+       "name": "WebChat",
+       "version": "1.3.0",
+       "author": [
+               "Robert Leverington",
+               "Marco 27"
+       ],
+       "url": "https://www.mediawiki.org/wiki/Extension:WebChat";,
+       "descriptionmsg": "webchat-desc",
+       "type": "specialpage",
+       "GroupPermissions": {
+               "*": {
+                       "webchat": false
+               },
+               "user": {
+                       "webchat": true
+               },
+               "sysop": {
+                       "webchat": true
+               }
+       },
+       "AvailableRights": [
+               "webchat"
+       ],
+       "SpecialPages": {
+               "WebChat": "WebChat"
+       },
+       "MessagesDirs": {
+               "WebChat": [
+                       "i18n"
+               ]
+       },
+       "ExtensionMessagesFiles": {
+               "WebChatAlias": "WebChat.alias.php"
+       },
+       "AutoloadClasses": {
+               "WebChat": "WebChat_body.php"
+       },
+       "config": {
+               "WebChatServer": "",
+               "WebChatChannel": "",
+               "WebChatClient": "",
+               "WebChatClients": {
+                       "Mibbit": {
+                               "url": "//embed.mibbit.com/index.html",
+                               "parameters": {
+                                       "noServerMotd": "true",
+                                       "server": "$$$server$$$",
+                                       "channel": "$$$channel$$$",
+                                       "nick": "$$$nick$$$"
+                               }
+                       },
+                       "freenodeChat": {
+                               "url": "//webchat.freenode.net/",
+                               "parameters": {
+                                       "channels": "$$$channel$$$",
+                                       "nick": "$$$nick$$$"
+                               }
+                       }
+               }
+       },
+       "manifest_version": 2
+}
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id44e0587956549e5f3d722aebbb474c23b9bbd12
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WebChat
Gerrit-Branch: master
Gerrit-Owner: Reception123 <utilizator.receptie...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to