[MediaWiki-commits] [Gerrit] mediawiki...timeline[master]: Convert to extension registration
jenkins-bot has submitted this change and it was merged. Change subject: Convert to extension registration .. Convert to extension registration Bug: T88064 Change-Id: Ib1d8743204a3799c16001dc9e55fe64435f49f71 --- M Timeline.body.php M Timeline.php A TimelineSettings.php A extension.json 4 files changed, 88 insertions(+), 65 deletions(-) Approvals: Jforrester: Looks good to me, approved jenkins-bot: Verified diff --git a/Timeline.body.php b/Timeline.body.php index 1491590..0c539a9 100644 --- a/Timeline.body.php +++ b/Timeline.body.php @@ -3,6 +3,14 @@ class Timeline { + public static function registerExtension() { + global $wgTimelineSettings; + $wgTimelineSettings = new TimelineSettings; + $wgTimelineSettings->ploticusCommand = "/usr/bin/ploticus"; + $wgTimelineSettings->perlCommand = "/usr/bin/perl"; + $wgTimelineSettings->timelineFile = __DIR__ . "/EasyTimeline.pl"; + } + /** * @param $parser Parser * @return bool diff --git a/Timeline.php b/Timeline.php index 303ca2d..bc0e649 100644 --- a/Timeline.php +++ b/Timeline.php @@ -1,69 +1,16 @@ - * @license GNU General Public License version 2 - * @link http://www.mediawiki.org/wiki/Extension:EasyTimeline Documentation - */ -$wgExtensionCredits['parserhook'][] = array( - 'path' => __FILE__, - 'name' => 'EasyTimeline', - 'author' => 'Erik Zachte', - 'url' => 'https://www.mediawiki.org/wiki/Extension:EasyTimeline', - 'descriptionmsg' => 'timeline-desc', - 'license-name' => 'GPL-2.0', -); - -class TimelineSettings { - public $ploticusCommand, $perlCommand; - - // Update this timestamp to force older rendered timelines - // to be generated when the page next gets rendered. - // Can help to resolve old image-generation bugs. - public $epochTimestamp = '2012010100'; - - // Path to the EasyTimeline.pl perl file, which is used to actually generate the timelines. - public $timelineFile; - - // Font name. - // Documentation on how Ploticus handles fonts is available at - // http://ploticus.sourceforge.net/doc/fonts.html section "What fonts are available?" - // and below. If using a TrueType font, the file with .ttf extension - // must be available in path specified by environment variable $GDFONTPATH; - // some other font types are available (see the docs linked above). - // - // Use the fontname 'ascii' to use the internal Ploticus font that does not require - // an external font file. Defaults to FreeSans for backwards compatibility. - // - // Note: according to Ploticus docs, font names with a space may be problematic. - public $fontFile = 'FreeSans'; - - // The name of the FileBackend to use for timeline (see $wgFileBackends) - public $fileBackend = ''; +if ( function_exists( 'wfLoadExtension' ) ) { + wfLoadExtension( 'Timeline' ); + // Keep i18n globals so mergeMessageFileList.php doesn't break + $wgMessagesDirs['Timeline'] = __DIR__ . '/i18n'; +/* wfWarn( + 'Deprecated PHP entry point used for Timeline extension. Please use wfLoadExtension instead, ' . + 'see https://www.mediawiki.org/wiki/Extension_registration for more details.' + ); +*/ + return; +} else { + die( 'This version of the Timeline extension requires MediaWiki 1.28+' ); } -$wgTimelineSettings = new TimelineSettings; -$wgTimelineSettings->ploticusCommand = "/usr/bin/ploticus"; -$wgTimelineSettings->perlCommand = "/usr/bin/perl"; -$wgTimelineSettings->timelineFile = __DIR__ . "/EasyTimeline.pl"; - -$wgHooks['ParserFirstCallInit'][] = 'Timeline::onParserFirstCallInit'; -$wgMessagesDirs['Timeline'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['Timeline'] = __DIR__ . '/Timeline.i18n.php'; -$wgAutoloadClasses['Timeline'] = __DIR__ . '/Timeline.body.php'; - -$wgResourceModules['ext.timeline.styles'] = array( - 'localBasePath' => __DIR__, - 'remoteExtPath' => 'timeline', - 'styles' => array( - 'resources/ext.timeline.styles/timeline.css', - ), - 'position' => 'top', - 'targets' => array( 'mobile', 'desktop' ), -); diff --git a/TimelineSettings.php b/TimelineSettings.php new file mode 100644 index 000..ce6d393 --- /dev/null +++ b/TimelineSettings.php @@ -0,0 +1,25 @@ +http://ploticus.sourceforge.net/doc/fonts.html section "What fonts are available?" + // and below. If using a TrueType font, the file with .ttf extension + // must be available in path specified by environment variable $GDFONTPATH; + // some other font types are available (see the docs linked above). + // + // Use the fontname 'ascii' to use the internal Ploticus font that does not require + // an external font file
[MediaWiki-commits] [Gerrit] mediawiki...timeline[master]: Convert to extension registration
Reedy has uploaded a new change for review. https://gerrit.wikimedia.org/r/303248 Change subject: Convert to extension registration .. Convert to extension registration Bug: T88064 Change-Id: Ib1d8743204a3799c16001dc9e55fe64435f49f71 --- M Timeline.body.php M Timeline.php A TimelineSettings.php A extension.json 4 files changed, 88 insertions(+), 65 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/timeline refs/changes/48/303248/1 diff --git a/Timeline.body.php b/Timeline.body.php index 1491590..0c539a9 100644 --- a/Timeline.body.php +++ b/Timeline.body.php @@ -3,6 +3,14 @@ class Timeline { + public static function registerExtension() { + global $wgTimelineSettings; + $wgTimelineSettings = new TimelineSettings; + $wgTimelineSettings->ploticusCommand = "/usr/bin/ploticus"; + $wgTimelineSettings->perlCommand = "/usr/bin/perl"; + $wgTimelineSettings->timelineFile = __DIR__ . "/EasyTimeline.pl"; + } + /** * @param $parser Parser * @return bool diff --git a/Timeline.php b/Timeline.php index 303ca2d..bc0e649 100644 --- a/Timeline.php +++ b/Timeline.php @@ -1,69 +1,16 @@ - * @license GNU General Public License version 2 - * @link http://www.mediawiki.org/wiki/Extension:EasyTimeline Documentation - */ -$wgExtensionCredits['parserhook'][] = array( - 'path' => __FILE__, - 'name' => 'EasyTimeline', - 'author' => 'Erik Zachte', - 'url' => 'https://www.mediawiki.org/wiki/Extension:EasyTimeline', - 'descriptionmsg' => 'timeline-desc', - 'license-name' => 'GPL-2.0', -); - -class TimelineSettings { - public $ploticusCommand, $perlCommand; - - // Update this timestamp to force older rendered timelines - // to be generated when the page next gets rendered. - // Can help to resolve old image-generation bugs. - public $epochTimestamp = '2012010100'; - - // Path to the EasyTimeline.pl perl file, which is used to actually generate the timelines. - public $timelineFile; - - // Font name. - // Documentation on how Ploticus handles fonts is available at - // http://ploticus.sourceforge.net/doc/fonts.html section "What fonts are available?" - // and below. If using a TrueType font, the file with .ttf extension - // must be available in path specified by environment variable $GDFONTPATH; - // some other font types are available (see the docs linked above). - // - // Use the fontname 'ascii' to use the internal Ploticus font that does not require - // an external font file. Defaults to FreeSans for backwards compatibility. - // - // Note: according to Ploticus docs, font names with a space may be problematic. - public $fontFile = 'FreeSans'; - - // The name of the FileBackend to use for timeline (see $wgFileBackends) - public $fileBackend = ''; +if ( function_exists( 'wfLoadExtension' ) ) { + wfLoadExtension( 'Timeline' ); + // Keep i18n globals so mergeMessageFileList.php doesn't break + $wgMessagesDirs['Timeline'] = __DIR__ . '/i18n'; +/* wfWarn( + 'Deprecated PHP entry point used for Timeline extension. Please use wfLoadExtension instead, ' . + 'see https://www.mediawiki.org/wiki/Extension_registration for more details.' + ); +*/ + return; +} else { + die( 'This version of the Timeline extension requires MediaWiki 1.28+' ); } -$wgTimelineSettings = new TimelineSettings; -$wgTimelineSettings->ploticusCommand = "/usr/bin/ploticus"; -$wgTimelineSettings->perlCommand = "/usr/bin/perl"; -$wgTimelineSettings->timelineFile = __DIR__ . "/EasyTimeline.pl"; - -$wgHooks['ParserFirstCallInit'][] = 'Timeline::onParserFirstCallInit'; -$wgMessagesDirs['Timeline'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['Timeline'] = __DIR__ . '/Timeline.i18n.php'; -$wgAutoloadClasses['Timeline'] = __DIR__ . '/Timeline.body.php'; - -$wgResourceModules['ext.timeline.styles'] = array( - 'localBasePath' => __DIR__, - 'remoteExtPath' => 'timeline', - 'styles' => array( - 'resources/ext.timeline.styles/timeline.css', - ), - 'position' => 'top', - 'targets' => array( 'mobile', 'desktop' ), -); diff --git a/TimelineSettings.php b/TimelineSettings.php new file mode 100644 index 000..ce6d393 --- /dev/null +++ b/TimelineSettings.php @@ -0,0 +1,25 @@ +http://ploticus.sourceforge.net/doc/fonts.html section "What fonts are available?" + // and below. If using a TrueType font, the file with .ttf extension + // must be available in path specified by environment variable $GDFONTPATH; + // some other font types are available (see the docs linked above). + // + // Use the fontname 'ascii' to use the internal Ploticus font that