Skip to content

Commit

Permalink
get minimum php requirements from composer.json
Browse files Browse the repository at this point in the history
  • Loading branch information
splitbrain committed Feb 6, 2024
1 parent 78220d5 commit 6741b58
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class helper_plugin_upgrade extends DokuWiki_Plugin
public $tgzdir;
/** @var string URL to the VERSION file of the new DokuWiki release */
public $tgzversion;
/** @var string URL to the composer.json file of the new DokuWiki release */
protected string $composer;

Check failure on line 24 in helper.php

View workflow job for this annotation

GitHub Actions / all / test-stable / PHP 7.3 DokuWiki stable

syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
/** @var string URL to the plugin.info.txt file of the upgrade plugin */
public $pluginversion;

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

Expand Down Expand Up @@ -112,7 +115,9 @@ public function checkVersions()
}

// check if PHP is up to date
$minphp = '7.2'; // FIXME get this from the composer file upstream
$json = $http->get($this->composer);
$data = json_decode($json, true);
$minphp = $data['config']['platform']['php'];
if (version_compare(phpversion(), $minphp, '<')) {
$this->log('error', $this->getLang('vs_php'), $minphp, phpversion());
$ok = false;
Expand Down Expand Up @@ -402,7 +407,7 @@ protected function recursiveDelete($dir)
/**
* Log a message
*
* @param string ...$level, $msg
* @param string ...$level , $msg
*/
protected function log()
{
Expand Down

0 comments on commit 6741b58

Please sign in to comment.