Paladox has uploaded a new change for review. https://gerrit.wikimedia.org/r/210033
Change subject: Add extension.json, empty PHP entry point ...................................................................... Add extension.json, empty PHP entry point Bug: T87922 Change-Id: I7516f2a948f67d6b184d7214a8cfc159d9b177f1 --- M Graph.php A extension.json 2 files changed, 80 insertions(+), 94 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Graph refs/changes/33/210033/1 diff --git a/Graph.php b/Graph.php index efbf2ac..da818ee 100644 --- a/Graph.php +++ b/Graph.php @@ -1,96 +1,13 @@ <?php -/** - * Graph extension, visualizes arbitrary datasets in arbitrary ways in MediaWiki. - * - * @license MIT - * @file - * @ingroup Extensions - * - * @author Dan Andreescu, Yuri Astrakhan - */ - -if ( !defined( 'MEDIAWIKI' ) ) { - echo( "This file is an extension to the MediaWiki software and cannot be used on its own.\n" ); - die( 1 ); +if ( function_exists( 'wfLoadExtension' ) ) { + wfLoadExtension( 'Graph' ); + // Keep i18n globals so mergeMessageFileList.php doesn't break + $wgMessagesDirs['Graph'] = __DIR__ . '/i18n'; + /* wfWarn( + 'Deprecated PHP entry point used for Graph extension. Please use wfLoadExtension instead, ' . + 'see https://www.mediawiki.org/wiki/Extension_registration for more details.' + ); */ + return; +} else { + die( 'This version of the Graph extension requires MediaWiki 1.25+' ); } - -if ( version_compare( $wgVersion, '1.21', '<' ) ) { - die( "This extension requires MediaWiki 1.21+\n" ); -} - -$wgExtensionCredits['other'][] = array( - 'path' => __FILE__, - 'name' => 'Graph', - 'author' => array( 'Dan Andreescu', 'Yuri Astrakhan' ), - 'url' => 'https://www.mediawiki.org/wiki/Extension:Graph', - 'descriptionmsg' => 'graph-desc', - 'license-name' => 'MIT', -); - -$wgMessagesDirs['Graph'] = __DIR__ . DIRECTORY_SEPARATOR . 'i18n'; - -$graphBodyFile = __DIR__ . DIRECTORY_SEPARATOR . 'Graph.body.php'; -$wgAutoloadClasses['Graph\Singleton'] = $graphBodyFile; -$wgAutoloadClasses['Graph\Content'] = $graphBodyFile; -unset( $graphBodyFile ); - -/** @var false|string[] $wgGraphDataDomains a list of domains that the vega code is allowed to pull data from. - * If false, there are no restrictions. An empty list disables any external data (inline only). - * NOTE: Setting this value to anything other than 'false' will also enable safe mode formula/filter evaluation - */ -$wgGraphDataDomains = array(); - -/** @var false|string[] $wgGraphUrlBlacklist a list of regular expressions (JavaScript regex) - * All data URLs will be matched against this list, and the URL will be used only - * if it does not match any of the given regexes. - */ -$wgGraphUrlBlacklist = false; - -/** @var bool $wgGraphIsTrusted if false, passes Treat-as-Untrusted:1 header with all graph data requests - */ -$wgGraphIsTrusted = false; - -/** @var string|false $wgGraphImgServiceUrl A format string to form a backend service request for the img. - * For example: - * $wgGraphImgServiceUrl = "//graphoid.wikimedia.org/%1\$s/v1/png/%2\$s/%3\$s/%4\$s.png"; - * Which would produce this URL: - * //graphoid.wikimedia.org/mediawiki.org/v1/png/Extension:Graph/0/be66c7016b9de3188ef6a585950f10dc83239837.png - * /{domain}/v1/png/{title}/{revid}/{hash}.png - * Parameters will be supplied in this order: 1=server, 2=title, 3=revid, 4=graph-hash-id - * All parameters will be escaped with rawurlencode() - * If the value is false, no <noscript> urls will be generated - */ -$wgGraphImgServiceUrl = false; - -$wgHooks['ParserFirstCallInit'][] = 'Graph\Singleton::onParserFirstCallInit'; -$wgHooks['EditPage::showEditForm:initial'][] = 'Graph\Singleton::editPageShowEditFormInitial'; -$wgHooks['ParserAfterParse'][] = 'Graph\Singleton::onParserAfterParse'; - -$extGraphBoilerplate = array( - 'localBasePath' => __DIR__, - 'remoteExtPath' => 'Graph', - 'targets' => array( 'mobile', 'desktop' ), -); - -$wgResourceModules['ext.graph'] = array( - 'scripts' => array( - 'lib/d3.js', - 'lib/topojson.js', - 'lib/vega.js', - 'js/graph.js', - ), - 'styles' => array( - 'styles/common.less', - ), - 'dependencies' => array( - 'mediawiki.Uri', - ), -) + $extGraphBoilerplate; - -$wgResourceModules['ext.graph.editor'] = array( - 'scripts' => array( - 'js/graph.editor.js', - ) -) + $extGraphBoilerplate; - -unset( $extGraphBoilerplate ); diff --git a/extension.json b/extension.json new file mode 100644 index 0000000..284a2bf --- /dev/null +++ b/extension.json @@ -0,0 +1,69 @@ +{ + "name": "Graph", + "author": [ + "Dan Andreescu", + "Yuri Astrakhan" + ], + "url": "https://www.mediawiki.org/wiki/Extension:Graph", + "descriptionmsg": "graph-desc", + "license-name": "MIT", + "type": "other", + "MessagesDirs": { + "Graph": [ + "i18n" + ] + }, + "AutoloadClasses": { + "Graph\\Singleton": "Graph.body.php", + "Graph\\Content": "Graph.body.php" + }, + "ResourceModules": { + "ext.graph": { + "scripts": [ + "lib/d3.js", + "lib/topojson.js", + "lib/vega.js", + "js/graph.js" + ], + "styles": [ + "styles/common.less" + ], + "dependencies": [ + "mediawiki.Uri" + ], + "targets": [ + "mobile", + "desktop" + ] + }, + "ext.graph.editor": { + "scripts": [ + "js/graph.editor.js" + ], + "targets": [ + "mobile", + "desktop" + ] + } + }, + "ResourceFileModulePaths": { + "localBasePath": "", + "remoteExtPath": "Graph" + }, + "Hooks": { + "ParserFirstCallInit": [ + "Graph\\Singleton::onParserFirstCallInit" + ], + "EditPage::showEditForm:initial": [ + "Graph\\Singleton::editPageShowEditFormInitial" + ], + "ParserAfterParse": [ + "Graph\\Singleton::onParserAfterParse" + ] + }, + "config": { + "GraphUrlBlacklist": false, + "GraphIsTrusted": false, + "GraphImgServiceUrl": false + } +} -- To view, visit https://gerrit.wikimedia.org/r/210033 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7516f2a948f67d6b184d7214a8cfc159d9b177f1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Graph Gerrit-Branch: master Gerrit-Owner: Paladox <thomasmulhall...@yahoo.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits