summaryrefslogtreecommitdiff
path: root/classes/pref/prefs.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/pref/prefs.php')
-rw-r--r--classes/pref/prefs.php27
1 files changed, 3 insertions, 24 deletions
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index 565ddaded..5fe4f1bbf 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -1099,29 +1099,6 @@ class Pref_Prefs extends Handler_Protected {
set_pref(Prefs::_ENABLED_PLUGINS, $plugins);
}
- function _get_version_from_git(string $dir) {
- $descriptorspec = [
- 1 => ["pipe", "w"], // STDOUT
- 2 => ["pipe", "w"], // STDERR
- ];
-
- $proc = proc_open("git --no-pager log --pretty=\"%ct %h\" -n1 HEAD",
- $descriptorspec, $pipes, $dir);
-
- if (is_resource($proc)) {
- $stdout = stream_get_contents($pipes[1]);
- $stderr = stream_get_contents($pipes[2]);
- $status = proc_close($proc);
-
- if ($status == 0) {
- list($timestamp, $commit) = explode(" ", $stdout);
- return trim(strftime("%y.%m", (int)$timestamp) . "-$commit");
- } else {
- return T_sprintf("Git error [RC=%d]: %s", $status, $stderr);
- }
- }
- }
-
function _get_plugin_version(Plugin $plugin) {
$about = $plugin->about();
@@ -1137,7 +1114,9 @@ class Pref_Prefs extends Handler_Protected {
}
if (is_dir("$plugin_dir/.git")) {
- return T_sprintf("v%s, by %s", $this->_get_version_from_git($plugin_dir), $about[2]);
+ $ver = Config::get_version_from_git($plugin_dir);
+
+ return $ver["status"] == 0 ? T_sprintf("v%s, by %s", $ver["version"], $about[2]) : $ver["version"];
}
}
}