Add Git repository permission check to Admin Update page
This commit is contained in:
+5
-1
@@ -1600,8 +1600,12 @@ function handleUpdate(AdminAuth $auth, array $config): void
|
||||
$cmsVersion = is_array($verData) ? ($verData['version'] ?? '1.7.1') : '1.7.1';
|
||||
}
|
||||
|
||||
// Get git branch
|
||||
// Get git branch & check git permissions
|
||||
$gitBranch = 'main';
|
||||
$root = $config['codepress_root'];
|
||||
$gitDir = $root . '/.git';
|
||||
$isGitWritable = is_dir($gitDir) && (is_writable($gitDir) && (!is_dir($gitDir . '/objects') || is_writable($gitDir . '/objects')));
|
||||
|
||||
if (function_exists('exec')) {
|
||||
@exec('git rev-parse --abbrev-ref HEAD 2>&1', $branchOutput);
|
||||
if (!empty($branchOutput[0]) && strpos($branchOutput[0], 'fatal') === false) {
|
||||
|
||||
Reference in New Issue
Block a user