jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/402596 )

Change subject: Using the extension registration (extension.json)
......................................................................


Using the extension registration (extension.json)

Bug: T184346
Change-Id: I70bdd3e21520e1f900fa29d4ea70dee2186916eb
---
M CongressLookup.php
A CongressLookupHooks.php
A extension.json
3 files changed, 91 insertions(+), 90 deletions(-)

Approvals:
  Fz-29: Looks good to me, but someone else must approve
  Florianschmidtwelzow: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/CongressLookup.php b/CongressLookup.php
index 54c6cf8..56507ed 100644
--- a/CongressLookup.php
+++ b/CongressLookup.php
@@ -1,91 +1,16 @@
 <?php
-/**
- * MediaWiki CongressLookup extension
- * http://www.mediawiki.org/wiki/Extension:CongressLookup
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to 
deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * This program is distributed WITHOUT ANY WARRANTY.
- */
-
-/**
- * @file
- * @ingroup Extensions
- * @author Ryan Kaldari
- */
-
-# Alert the user that this is not a valid entry point to MediaWiki if they try 
to access the special pages file directly.
-if ( !defined( 'MEDIAWIKI' ) ) {
-       echo <<<EOT
-To install this extension, put the following line in LocalSettings.php:
-require_once( "\$IP/extensions/CongressLookup/CongressLookup.php" );
-EOT;
-       exit( 1 );
-}
-
-// Extension credits that will show up on Special:Version
-$wgExtensionCredits['specialpage'][] = array(
-       'path' => __FILE__,
-       'name' => 'CongressLookup',
-       'version' => '1.1.0',
-       'url' => 'https://www.mediawiki.org/wiki/Extension:CongressLookup',
-       'author' => array( 'Ryan Kaldari' ),
-       'descriptionmsg' => 'congresslookup-desc',
-);
-
-// Configurable variables for caching the special page
-$wgCongressLookupSharedMaxAge = 1200; // 20 minutes server-side
-$wgCongressLookupMaxAge = 600; // 10 minutes client-side
-
-// Where to report errors (special page)
-$wgCongressLookupErrorPage = 'CongressFail';
-
-/**
- * Use black-on-white style or white-on-black
- * @var bool True = black on white style
- */
-$wgCongressLookupBlackOnWhite = false;
-
-$dir = dirname( __FILE__ ) . '/';
-
-//API
-$wgAutoloadClasses['ApiCongressLookup'] = $dir . 'ApiCongressLookup.php';
-$wgAPIModules['congresslookup'] = 'ApiCongressLookup';
-
-$wgAutoloadClasses['SpecialCongressLookup'] = $dir . 
'SpecialCongressLookup.php';
-$wgAutoloadClasses['SpecialCongressFail'] = $dir . 'SpecialCongressFail.php';
-$wgAutoloadClasses['CongressLookupDB'] = $dir . 'CongressLookup.db.php';
-$wgMessagesDirs['CongressLookup'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['CongressLookupAlias'] = $dir . 
'CongressLookup.alias.php';
-$wgSpecialPages['CongressLookup'] = 'SpecialCongressLookup';
-$wgSpecialPages['CongressFail'] = 'SpecialCongressFail';
-
-$wgHooks['LoadExtensionSchemaUpdates'][] = 'congressLookupSchemaUpdate';
-
-/**
- * LoadExtensionSchemaUpdates hook handler
- * This function makes sure that the database schema is up to date.
- * @param $updater DatabaseUpdater|null
- * @return true
- */
-function congressLookupSchemaUpdate( $updater = null ) {
-       if ( $updater === null ) {
-               global $wgExtNewTables;
-               $wgExtNewTables[] = array( 'cl_senate', dirname( __FILE__ ) . 
'/patches/CongressLookup.sql' );
-               $wgExtNewTables[] = array( 'cl_errors', dirname( __FILE__ ) . 
'/patches/CongressDataErrors.sql' );
-       } else {
-               $updater->addExtensionUpdate( array( 'addTable', 'cl_senate',
-                       dirname( __FILE__ ) . '/patches/CongressLookup.sql', 
true ) );
-               $updater->addExtensionUpdate( array( 'addTable', 'cl_errors',
-                       dirname( __FILE__ ) . 
'/patches/CongressDataErrors.sql', true ) );
-       }
-       return true;
-}
+// Warn users if they using the old entry point and a MediaWiki with the new 
extension registration
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'CongressLookup' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['CongressLookup'] = __DIR__ . '/i18n';
+       $wgExtensionMessagesFiles['CongressLookupAlias'] = __DIR__ . 
'/CongressLookup.alias.php';
+       wfWarn(
+               'Deprecated PHP entry point used for the CongressLookup 
extension. ' .
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );
+       return;
+} else {
+       die( 'This version of the CongressLookup extension requires MediaWiki 
1.25+' );
+}
\ No newline at end of file
diff --git a/CongressLookupHooks.php b/CongressLookupHooks.php
new file mode 100644
index 0000000..f973eab
--- /dev/null
+++ b/CongressLookupHooks.php
@@ -0,0 +1,25 @@
+<?php
+
+class CongressLookupHooks {
+
+       /**
+        * LoadExtensionSchemaUpdates hook handler
+        * This function makes sure that the database schema is up to date.
+        * @param $updater DatabaseUpdater|null
+        * @return true
+        */
+       public static function schemaUpdate( $updater = null ) {
+               if ( $updater === null ) {
+                       global $wgExtNewTables;
+                       $wgExtNewTables[] = array( 'cl_senate', dirname( 
__FILE__ ) . '/patches/CongressLookup.sql' );
+                       $wgExtNewTables[] = array( 'cl_errors', dirname( 
__FILE__ ) . '/patches/CongressDataErrors.sql' );
+               } else {
+                       $updater->addExtensionUpdate( array( 'addTable', 
'cl_senate',
+                               dirname( __FILE__ ) . 
'/patches/CongressLookup.sql', true ) );
+                       $updater->addExtensionUpdate( array( 'addTable', 
'cl_errors',
+                               dirname( __FILE__ ) . 
'/patches/CongressDataErrors.sql', true ) );
+               }
+               return true;
+       }
+
+}
\ No newline at end of file
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..8d35f5e
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,51 @@
+{
+       "name": "CongressLookup",
+       "version": "1.1.0",
+       "author": [
+               "Ryan Kaldari"
+       ],
+       "url": "https://www.mediawiki.org/wiki/Extension:CongressLookup";,
+       "descriptionmsg": "congresslookup-desc",
+       "license-name": "MIT",
+       "type": "specialpage",
+       "APIModules": {
+               "congresslookup": "ApiCongressLookup"
+       },
+       "SpecialPages": {
+               "CongressLookup": "SpecialCongressLookup",
+               "CongressFail": "SpecialCongressFail"
+       },
+       "MessagesDirs": {
+               "CongressLookup": [
+                       "i18n"
+               ]
+       },
+       "ExtensionMessagesFiles": {
+               "CongressLookupAlias": "CongressLookup.alias.php"
+       },
+       "AutoloadClasses": {
+               "ApiCongressLookup": "ApiCongressLookup.php",
+               "CongressLookupHooks": "CongressLookupHooks.php",
+               "SpecialCongressLookup": "SpecialCongressLookup.php",
+               "SpecialCongressFail": "SpecialCongressFail.php",
+               "CongressLookupDB": "CongressLookup.db.php"
+       },
+       "Hooks": {
+               "LoadExtensionSchemaUpdates": 
"CongressLookupHooks::schemaUpdate"
+       },
+       "config": {
+               "CongressLookupSharedMaxAge": {
+                       "value": 1200
+               },
+               "CongressLookupMaxAge": {
+                       "value": 600
+               },
+               "CongressLookupErrorPage": {
+                       "value": "CongressFail"
+               },
+               "CongressLookupBlackOnWhite": {
+                       "value": false
+               }
+       },
+       "manifest_version": 2
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I70bdd3e21520e1f900fa29d4ea70dee2186916eb
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/CongressLookup
Gerrit-Branch: master
Gerrit-Owner: LukBukkit <luk.buk...@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Fz-29 <f29ah...@gmail.com>
Gerrit-Reviewer: Gabrielchihonglee <chihonglee...@gmail.com>
Gerrit-Reviewer: Kaldari <rkald...@wikimedia.org>
Gerrit-Reviewer: Katie Horn <kh...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: LukBukkit <luk.buk...@gmail.com>
Gerrit-Reviewer: MarcoAurelio <maure...@tools.wmflabs.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to