jenkins-bot has submitted this change and it was merged.

Change subject: Kill off TimelineSettings class
......................................................................


Kill off TimelineSettings class

Change-Id: Ibe556adea897b7ef1c614bad7d02fafb0caba646
---
M Timeline.body.php
D TimelineSettings.php
M extension.json
M install-ploticus.sh
4 files changed, 29 insertions(+), 39 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Timeline.body.php b/Timeline.body.php
index 0c539a9..0b811a8 100644
--- a/Timeline.body.php
+++ b/Timeline.body.php
@@ -31,7 +31,8 @@
         */
        public static function renderTimeline( $timelinesrc, array $args, 
$parser, $frame ) {
                global $wgUploadDirectory, $wgUploadPath, $wgArticlePath, 
$wgTmpDirectory, $wgRenderHashAppend;
-               global $wgTimelineSettings;
+               global $wgTimelineFileBackend, $wgTimelineEpochTimestamp, 
$wgTimelinePerlCommand, $wgTimelineFile;
+               global $wgtimelineFontFile;
 
                $parser->getOutput()->addModuleStyles( 'ext.timeline.styles' );
 
@@ -39,8 +40,8 @@
                $svg2png = ( $method == 'svg2png' );
 
                // Get the backend to store plot data and pngs
-               if ( $wgTimelineSettings->fileBackend != '' ) {
-                       $backend = FileBackendGroup::singleton()->get( 
$wgTimelineSettings->fileBackend );
+               if ( $wgTimelineFileBackend != '' ) {
+                       $backend = FileBackendGroup::singleton()->get( 
$wgTimelineFileBackend );
                } else {
                        $backend = new FSFileBackend(
                                [
@@ -67,7 +68,7 @@
                $previouslyRendered = $backend->fileExists( [ 'src' => 
"{$fname}.png" ] );
                if ( $previouslyRendered ) {
                        $timestamp = $backend->getFileTimestamp( [ 'src' => 
"{$fname}.png" ] );
-                       $expired = ( $timestamp < 
$wgTimelineSettings->epochTimestamp );
+                       $expired = ( $timestamp < $wgTimelineEpochTimestamp );
                } else {
                        $expired = false;
                }
@@ -91,16 +92,13 @@
 
                                // Get command for ploticus to read the user 
input and output an error,
                                // map, and rendering (png or gif) file under 
the same dir as the temp file.
-                               $cmdline = wfEscapeShellArg(
-                                       $wgTimelineSettings->perlCommand,
-                                               
$wgTimelineSettings->timelineFile
-                                       )
+                               $cmdline = wfEscapeShellArg( 
$wgTimelinePerlCommand, $wgTimelineTimelineFile )
                                        . ( $svg2png ? " -s " : "" )
                                        . " -i " . wfEscapeShellArg( $tmpPath )
-                                       . " -m -P " . wfEscapeShellArg( 
$wgTimelineSettings->ploticusCommand )
+                                       . " -m -P " . wfEscapeShellArg( 
$wgTimelinePloticusCommand )
                                        . " -T " . wfEscapeShellArg( 
$wgTmpDirectory )
                                        . " -A " . wfEscapeShellArg( 
$wgArticlePath )
-                                       . " -f " . wfEscapeShellArg( 
$wgTimelineSettings->fontFile )
+                                       . " -f " . wfEscapeShellArg( 
$wgTimelineFontFile )
                                ;
 
                                // Actually run the command...
diff --git a/TimelineSettings.php b/TimelineSettings.php
deleted file mode 100644
index ce6d393..0000000
--- a/TimelineSettings.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-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 = '20120101000000';
-       // 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 = '';
-}
diff --git a/extension.json b/extension.json
index 7021180..f5049e8 100644
--- a/extension.json
+++ b/extension.json
@@ -5,15 +5,13 @@
        "descriptionmsg": "timeline-desc",
        "license-name": "GPL-2.0",
        "type": "parserhook",
-       "callback": "Timeline::registerExtension",
        "MessagesDirs": {
                "Timeline": [
                        "i18n"
                ]
        },
        "AutoloadClasses": {
-               "Timeline": "Timeline.body.php",
-               "TimelineSettings": "TimelineSettings.php"
+               "Timeline": "Timeline.body.php"
        },
        "ResourceModules": {
                "ext.timeline.styles": {
@@ -37,6 +35,25 @@
        "config": {
                "TimelineSettings": {
                        "value": null
+               },
+               "TimelinePloticusCommand": {
+                       "value": "/usr/bin/ploticus"
+               },
+               "TimelinePerlCommand": {
+                       "value": "/usr/bin/perl"
+               },
+               "TimelineFile": {
+                       "value": "EasyTimeline.pl",
+                       "path": true
+               },
+               "TimelineEpochTimestamp": {
+                       "value": "20120101000000"
+               },
+               "TimelineFontFile": {
+                       "value": "FreeSans"
+               },
+               "TimelineFileBackend": {
+                       "value": ""
                }
        },
        "manifest_version": 2
diff --git a/install-ploticus.sh b/install-ploticus.sh
index 9a4f3f7..83ee67d 100755
--- a/install-ploticus.sh
+++ b/install-ploticus.sh
@@ -36,4 +36,4 @@
 echo 'Done. Please add the following line to your LocalSettings.php'
 echo 'to let MediaWiki know where the binary is located:'
 
-echo "  \$wgTimelineSettings->ploticusCommand = \"$(pwd)/pl\";"
+echo "  \$wgTimelinePloticusCommand = \"$(pwd)/pl\";"

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe556adea897b7ef1c614bad7d02fafb0caba646
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/timeline
Gerrit-Branch: master
Gerrit-Owner: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.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