Hopefully fixed update
This commit is contained in:
@ -1,13 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
$mode = $_GET['mode'] ?? 'git'; // Future-proof!
|
$mode = $_GET['mode'] ?? 'git';
|
||||||
|
$repoPath = '/usr/thos';
|
||||||
|
|
||||||
|
function forceGitUpdate($path) {
|
||||||
|
$output = [];
|
||||||
|
|
||||||
|
$output[] = shell_exec("git -C $path fetch origin 2>&1");
|
||||||
|
$output[] = shell_exec("git -C $path reset --hard origin/main 2>&1");
|
||||||
|
|
||||||
|
$output[] = shell_exec("git -C $path clean -fd 2>&1");
|
||||||
|
|
||||||
|
return implode("\n", $output);
|
||||||
|
}
|
||||||
|
|
||||||
if ($mode === 'git') {
|
if ($mode === 'git') {
|
||||||
$output = shell_exec("git -C /usr/thos pull 2>&1");
|
echo "🔄 Forcing full git reset and update...\n\n";
|
||||||
echo "✅ Git update applied:\n$output";
|
echo forceGitUpdate($repoPath);
|
||||||
} elseif ($mode === 'curl') {
|
} elseif ($mode === 'curl') {
|
||||||
// Placeholder for future upgrade logic
|
echo "🔧 Running installer...\n\n";
|
||||||
$output = shell_exec("curl -s https://your.url/thos-update.sh | sudo bash 2>&1");
|
echo shell_exec("curl -s https://surillya.com/thos/thos.sh | sudo bash 2>&1");
|
||||||
echo "🔧 Installer run:\n$output";
|
|
||||||
} else {
|
} else {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
echo "❌ Unknown update mode";
|
echo "❌ Unknown update mode";
|
||||||
|
Reference in New Issue
Block a user