Skip to content

Commit 6741b58

Browse files
committed
get minimum php requirements from composer.json
1 parent 78220d5 commit 6741b58

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

helper.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class helper_plugin_upgrade extends DokuWiki_Plugin
2020
public $tgzdir;
2121
/** @var string URL to the VERSION file of the new DokuWiki release */
2222
public $tgzversion;
23+
/** @var string URL to the composer.json file of the new DokuWiki release */
24+
protected string $composer;
2325
/** @var string URL to the plugin.info.txt file of the upgrade plugin */
2426
public $pluginversion;
2527

@@ -36,6 +38,7 @@ public function __construct()
3638
$this->tgzfile = $conf['tmpdir'] . '/dokuwiki-upgrade.tgz';
3739
$this->tgzdir = $conf['tmpdir'] . '/dokuwiki-upgrade/';
3840
$this->tgzversion = "https://raw.githubusercontent.com/splitbrain/dokuwiki/$branch/VERSION";
41+
$this->composer = "https://raw.githubusercontent.com/splitbrain/dokuwiki/$branch/composer.json";
3942
$this->pluginversion = "https://raw.githubusercontent.com/splitbrain/dokuwiki-plugin-upgrade/master/plugin.info.txt";
4043
}
4144

@@ -112,7 +115,9 @@ public function checkVersions()
112115
}
113116

114117
// check if PHP is up to date
115-
$minphp = '7.2'; // FIXME get this from the composer file upstream
118+
$json = $http->get($this->composer);
119+
$data = json_decode($json, true);
120+
$minphp = $data['config']['platform']['php'];
116121
if (version_compare(phpversion(), $minphp, '<')) {
117122
$this->log('error', $this->getLang('vs_php'), $minphp, phpversion());
118123
$ok = false;
@@ -402,7 +407,7 @@ protected function recursiveDelete($dir)
402407
/**
403408
* Log a message
404409
*
405-
* @param string ...$level, $msg
410+
* @param string ...$level , $msg
406411
*/
407412
protected function log()
408413
{

0 commit comments

Comments
 (0)