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

Change subject: Converting LastModified to extension registration. I haven't 
really done this before so I'm not sure if everything is correctly done.
......................................................................

Converting LastModified to extension registration. I haven't really done
this before so I'm not sure if everything is correctly done.

Change-Id: I8832c46522fe79035495e08bf498793e17252cb8
Bug-Id: T173998
---
M LastModified.php
A extension.json
2 files changed, 54 insertions(+), 50 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LastModified 
refs/changes/03/373503/1

diff --git a/LastModified.php b/LastModified.php
index 8841e87..80aeddc 100644
--- a/LastModified.php
+++ b/LastModified.php
@@ -17,57 +17,17 @@
  * @author             Katie Horn <kh...@wikimedia.org>, Jeremy Postlethwaite 
<jpostlethwa...@wikimedia.org>
  */
 
-# 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/LastModified/LastModified.php" );
-EOT;
-       exit( 1 );
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'LastModified' );
+       $wgMessageDirs['LastModified'] = __DIR__ . '/i18n';
+       wfWarn(
+               'Deprecated PHP entry point used for LastModified extension. ' .
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );
+} else {
+       die( 'This version of the LastModified extension requires MediaWiki 
1.29+' );
 }
-
-// Extension credits that will show up on Special:Version
-$wgExtensionCredits['other'][] = array(
-       'path' => __FILE__,
-       'name' => 'LastModified',
-       'version' => '1.1.0',
-       'url' => 'https://www.mediawiki.org/wiki/Extension:LastModified',
-       'author' => array( 'Katie Horn', 'Jeremy Postlethwaite' ),
-       'descriptionmsg' => 'lastmodified-desc',
-);
-
-$dir = dirname( __FILE__ ) . '/';
-
-$wgMessagesDirs['LastModified'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['LastModified'] = $dir . 'LastModified.i18n.php';
-
-/**
- * ADDITIONAL MAGICAL GLOBALS
- */
-
-// Resource modules
-$wgResourceTemplate = array(
-       'localBasePath' => $dir . 'modules',
-       'remoteExtPath' => 'LastModified/modules',
-);
-
-$wgResourceModules['last.modified'] = array(
-       'scripts' => 'lastmodified.js',
-       'position' => 'top',
-       'dependencies' => array( 'mediawiki.jqueryMsg' ),
-       'messages' => array(
-               'lastmodified-seconds',
-               'lastmodified-hours',
-               'lastmodified-minutes',
-               'lastmodified-hours',
-               'lastmodified-days',
-               'lastmodified-months',
-               'lastmodified-years',
-               'lastmodified-title-tag',
-       ),
-) + $wgResourceTemplate;
-
-$wgHooks['BeforePageDisplay'][] = 'fnLastModified';
 
 /**
  * This variable controls the display range.
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..8f0275c
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,44 @@
+"name": "LastModified",
+       "version": "1.1.0",
+       "author": [
+               "Katie Horn",
+               "[https://www.mediawiki.org/wiki/User:Jpostlethwaite Jeremy 
Postlethwaite]",
+       ],
+       "url": "https://www.mediawiki.org/wiki/Extension:LastModified";,
+       "descriptionmsg": "lastmodified-desc",
+       "license-name": "GPL-2.0+",
+       "MessagesDirs": {
+               "LastModified": [
+                       "i18n"
+               ]
+       },
+       "config": {
+               "LastModifiedRange": {
+                       "value": "0",
+                       "description": "Change the display range (or timelimit) 
used by the extension"
+               },
+       },
+       "Hooks": {
+               "fnLastModified": "LastModifiedHooks::BeforePageDisplay",
+               "userCan": "AccessControlHooks::onUserCan",
+               "UnknownAction": "AccessControlHooks::onUnknownAction"
+       },
+       "ResourceModules": {
+               "scripts": [
+                               "lastmodified.js",
+                       ],
+               "position": "top",
+               "dependencies": [
+               "mediawiki.jqueryMsg"
+               ],
+               "messages": [
+               "lastmodified-seconds",
+               "lastmodified-minutes",
+               "lastmodified-hours",
+               "lastmodified-days",
+               "lastmodified-months",
+               "lastmodified-years",
+               "lastmodified-title-tag",
+       ],
+       }
+       "manifest_version": 2
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8832c46522fe79035495e08bf498793e17252cb8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LastModified
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