Samwilson has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/368129 )
Change subject: Switch to extension registration system ...................................................................... Switch to extension registration system This moves to the new-style extension registration and removes the old style. Also removes the Git submodule and adds that library as a (manual) Composer dependency. Bug: T171819 Change-Id: I46d1a2dd04903b7a3207b9c4a709b80214626fc5 --- D .gitmodules M FlickrAPI.hooks.php D FlickrAPI.php A composer.json A extension.json 5 files changed, 83 insertions(+), 47 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FlickrAPI refs/changes/29/368129/1 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 4414c1f..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "modules/phpflickr"] - path = modules/phpflickr - url = https://github.com/dan-coulter/phpflickr.git diff --git a/FlickrAPI.hooks.php b/FlickrAPI.hooks.php index 1a8645e..b9f420a 100644 --- a/FlickrAPI.hooks.php +++ b/FlickrAPI.hooks.php @@ -9,6 +9,17 @@ class FlickrAPIHooks { /** + * Hooked to ParserFirstCallInit. + * @link https://www.mediawiki.org/wiki/Manual:Hooks/ParserFirstCallInit + * @param Parser $parser + * @return bool + */ + public static function onParserFirstCallInit( Parser &$parser ) { + $parser->setHook( 'flickr', self::class.'::flickrAPITag' ); + return true; + } + + /** * Get output for the <flickr> tag * * @param string $optionsString diff --git a/FlickrAPI.php b/FlickrAPI.php deleted file mode 100644 index 9f13c70..0000000 --- a/FlickrAPI.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * FlickrAPI extension - * - * For more info see http://mediawiki.org/wiki/Extension:FlickrAPI - * - * @file - * @ingroup Extensions - * @author Ike Hecht, 2015 - * @license GNU General Public Licence 2.0 or later - */ - -$wgExtensionCredits['parserhook'][] = array( - 'path' => __FILE__, - 'name' => 'FlickrAPI', - 'author' => array( - 'Ike Hecht', - ), - 'version' => '1.0.0', - 'url' => 'https://www.mediawiki.org/wiki/Extension:FlickrAPI', - 'descriptionmsg' => 'flickrapi-desc', -); - -/* Setup */ - -// Register files -$wgAutoloadClasses['FlickrAPIHooks'] = __DIR__ . '/FlickrAPI.hooks.php'; -$wgAutoloadClasses['FlickrAPIUtils'] = __DIR__ . '/FlickrAPIUtils.php'; -$wgAutoloadClasses['FlickrAPICache'] = __DIR__ . '/FlickrAPICache.php'; -/** @todo Spit out better error message if phpflickr module doesn't exist */ -$wgAutoloadClasses['phpFlickr'] = __DIR__ . '/modules/phpflickr/phpFlickr.php'; - -$wgMessagesDirs['FlickrAPI'] = __DIR__ . '/i18n'; - -// Register hooks -$wgHooks['ParserFirstCallInit'][] = function ( &$parser ) { - $parser->setHook( 'flickr', 'FlickrAPIHooks::flickrAPITag' ); - return true; -}; - -/* Configuration */ -$wgFlickrAPIKey = ''; -$wgFlickrAPISecret = ''; -$wgFlickrAPIDefaults = array( 'type' => 'frameless', 'location' => 'right', 'size' => '-' ); diff --git a/composer.json b/composer.json new file mode 100755 index 0000000..5ef8acb --- /dev/null +++ b/composer.json @@ -0,0 +1,37 @@ +{ + "require": { + "dan-coulter/phpflickr": "dev-master" + }, + "require-dev": { + "jakub-onderka/php-parallel-lint": "^0.9", + "mediawiki/mediawiki-codesniffer": "^0.8" + }, + "scripts": { + "test": [ + "parallel-lint . --exclude node_modules --exclude vendor", + "phpcs -p -s" + ], + "fix": [ + "phpcbf" + ] + }, + "repositories": [ + { + "type": "package", + "package": { + "name": "dan-coulter/phpflickr", + "version": "dev-master", + "source": { + "url": "https://github.com/dan-coulter/phpflickr.git", + "type": "git", + "reference": "bc4f2092b15d347e3d40c19fe0dbff8759fc8e51" + }, + "autoload": { + "classmap": [ + "phpFlickr.php" + ] + } + } + } + ] +} diff --git a/extension.json b/extension.json new file mode 100755 index 0000000..5ca6384 --- /dev/null +++ b/extension.json @@ -0,0 +1,35 @@ +{ + "name": "FlickrAPI", + "version": "2.0.0", + "author": [ + "Ike Hecht", + "Sam Wilson" + ], + "url": "https://www.mediawiki.org/wiki/Extension:FlickrAPI", + "descriptionmsg": "flickrapi-desc", + "type": "parserhook", + "MessagesDirs": { + "FlickrAPI": [ + "i18n" + ] + }, + "AutoloadClasses": { + "FlickrAPIHooks": "FlickrAPI.hooks.php", + "FlickrAPIUtils": "FlickrAPIUtils.php", + "FlickrAPICache": "FlickrAPICache.php" + }, + "Hooks": { + "ParserFirstCallInit": "FlickrAPIHooks::onParserFirstCallInit" + }, + "config": { + "FlickrAPIKey": "", + "FlickrAPISecret": "", + "FlickrAPIDefaults": { + "type": "frameless", + "location": "right", + "size": "-" + } + }, + "load_composer_autoloader": true, + "manifest_version": 1 +} -- To view, visit https://gerrit.wikimedia.org/r/368129 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I46d1a2dd04903b7a3207b9c4a709b80214626fc5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/FlickrAPI Gerrit-Branch: master Gerrit-Owner: Samwilson <s...@samwilson.id.au> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits