about summary refs log tree commit diff stats
path: root/classes/Config.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/Config.php')
-rw-r--r--classes/Config.php91
1 files changed, 0 insertions, 91 deletions
diff --git a/classes/Config.php b/classes/Config.php
index b0a6e12..3898503 100644
--- a/classes/Config.php
+++ b/classes/Config.php
@@ -104,97 +104,6 @@ class Config {
         $this->reload();
     }
 
-    /* package maintainers who don't use git: if version_static.txt exists in tt-rss root
-        directory, its contents are displayed instead of git commit-based version, this could be generated
-        based on source git tree commit used when creating the package */
-
-    /** @return string|array<string, mixed> */
-    static function get_version(bool $as_string = true) : mixed {
-        return self::get_instance()->_get_version($as_string);
-    }
-
-    /** @return string|array<string, mixed> */
-    private function _get_version(bool $as_string = true) : mixed {
-        $root_dir = dirname(__DIR__);
-
-        if (empty($this->version)) {
-            $this->version["status"] = -1;
-
-            if (getenv("CI_COMMIT_SHORT_SHA") && getenv("CI_COMMIT_TIMESTAMP")) {
-
-                $this->version["branch"] = getenv("CI_COMMIT_BRANCH");
-                $this->version["timestamp"] = strtotime(getenv("CI_COMMIT_TIMESTAMP"));
-                $this->version["version"] = sprintf("%s-%s", date("y.m", $this->version["timestamp"]), getenv("CI_COMMIT_SHORT_SHA"));
-                $this->version["commit"] = getenv("CI_COMMIT_SHORT_SHA");
-                $this->version["status"] = 0;
-
-            } else if (PHP_OS === "Darwin") {
-                $this->version["version"] = "UNKNOWN (Unsupported, Darwin)";
-            } else if (file_exists("$root_dir/version_static.txt")) {
-                $this->version["version"] = trim(file_get_contents("$root_dir/version_static.txt")) . " (Unsupported)";
-            } else if (is_dir("$root_dir/.git")) {
-                $this->version = self::get_version_from_git($root_dir);
-
-                if ($this->version["status"] != 0) {
-                    user_error("Unable to determine version: " . $this->version["version"], E_USER_WARNING);
-
-                    $this->version["version"] = "UNKNOWN (Unsupported, Git error)";
-                }
-            } else {
-                $this->version["version"] = "UNKNOWN (Unsupported)";
-            }
-        }
-
-        return $as_string ? $this->version["version"] : $this->version;
-    }
-
-    /** @return array<string, mixed> */
-    static function get_version_from_git(string $dir) : array {
-        $descriptorspec = [
-            1 => ["pipe", "w"], // STDOUT
-            2 => ["pipe", "w"], // STDERR
-        ];
-
-        $rv = [
-            "status" => -1,
-            "version" => "",
-            "commit" => "",
-            "branch" => "",
-            "timestamp" => 0,
-        ];
-
-        $proc = proc_open("git --no-pager log --pretty=\"version-%ct-%h\" -n1 HEAD",
-                        $descriptorspec, $pipes, $dir);
-
-        if (is_resource($proc)) {
-            $stdout = trim(stream_get_contents($pipes[1]));
-            $stderr = trim(stream_get_contents($pipes[2]));
-            $status = proc_close($proc);
-
-            $rv["status"] = $status;
-
-            list($check, $timestamp, $commit) = explode("-", $stdout);
-
-            if ($check == "version") {
-
-                $rv["version"] = strftime("%y.%m", (int)$timestamp) . "-$commit";
-                $rv["commit"] = $commit;
-                $rv["timestamp"] = $timestamp;
-
-                // proc_close() may return -1 even if command completed successfully
-                // so if it looks like we got valid data, we ignore it
-
-                if ($rv["status"] == -1)
-                    $rv["status"] = 0;
-
-            } else {
-                $rv["version"] = T_sprintf("Git error [RC=%d]: %s", $status, $stderr);
-            }
-        }
-
-        return $rv;
-    }
-
     static function get_migrations() : Db_Migrations {
         return self::get_instance()->_get_migrations();
     }