use realpath for files

This commit is contained in:
int2001
2024-03-23 06:03:03 +00:00
parent 1b9c4f8f79
commit 47acab82d9
2 changed files with 5 additions and 5 deletions

View File

@@ -153,11 +153,11 @@ class Debug extends CI_Controller
public function selfupdate() {
if (file_exists('.git')) {
try {
$st=exec('touch ./.maintenance');
$st=exec('touch '.realpath(APPPATH.'../').'/.maintenance');
$st=exec('git stash push --include-untracked');
$st=exec('git pull --rebase');
$st=exec('git pull');
$st=exec('git stash pop');
$st=exec('rm ./.maintenance');
$st=exec('rm '.realpath(APPPATH.'../').'/.maintenance');
} catch (\Throwable $th) {
}
}

View File

@@ -204,7 +204,7 @@
</table>
</div>
</div>
<?php if (file_exists('.git')) { ?>
<?php if (file_exists(realpath(APPPATH.'../').'/.git')) { ?>
<?php
//Below is a failsafe where git commands fail
try {
@@ -217,7 +217,7 @@
$commitDate = trim(exec('git log --pretty="%ci" -n1 HEAD'));
$line = trim(exec('git log -n 1 --pretty=%D HEAD'));
$pieces = explode(', ', $line);
$lastFetch = trim(exec('stat -c %Y .git/FETCH_HEAD'));
$lastFetch = trim(exec('stat -c %Y '.realpath(APPPATH.'../').'/.git/FETCH_HEAD'));
//Below is a failsafe for systems without the stat command
try {
$dt = new DateTime("@$lastFetch");