2 Star 0 Fork 0

mirrors_svgdotjs/svgdotjs.github.io

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
version.php 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
<?php
global $availableVersions;
$availableVersions = getAvailableVersions();
$newestVersion = getNewestVersion();
global $currentVersion;
$currentVersion = getCurrentVersion();
define( 'DOCS_VERSION', $currentVersion );
function getAvailableVersions() {
$commandBranches = 'git branch --list "*source*" -r --no-color';
$branches = [];
$retValue = 0;
exec($commandBranches, $branches, $retValue);
if ($retValue != 0) {
die("Could not fetch branch names. Is git installed? Output was: \n".implode("\n", $output));
}
return array_map('getVersionFromBranchName', $branches);
}
function getNewestVersion() {
$commandHead = 'git branch --list "*source*" -r --no-color --points-at HEAD';
return getVersionFromBranchName(exec($commandHead));
}
function getCurrentVersion() {
$commandHead = 'git rev-parse --abbrev-ref HEAD';
return getVersionFromBranchName(exec($commandHead));
}
function getVersionFromBranchName($branch) {
$parts = explode('/', $branch);
$source = array_pop($parts);
$parts = explode('-', $branch);
$version = array_pop($parts);
return $version;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_svgdotjs/svgdotjs.github.io.git
git@gitee.com:mirrors_svgdotjs/svgdotjs.github.io.git
mirrors_svgdotjs
svgdotjs.github.io
svgdotjs.github.io
source-3.1

搜索帮助