feat: add admin-only git pull interface and remove auto-pull

- Add new `gitpull.php` page for manual git pull execution by administrators
- Remove automatic git pull on homepage visit to prevent unintended updates
- Include git pull link in admin navigation menu for easy access
- Secure interface with admin-only access and sudo credentials configuration
This commit is contained in:
2026-03-13 15:32:53 +08:00
parent 2a41341e51
commit 73049b71b6
3 changed files with 60 additions and 8 deletions

View File

@@ -3,14 +3,6 @@
$cache_time = 30;
$OJ_CACHE_SHARE = false;
// Auto git pull on homepage visit (at most once per 60 seconds)
$git_pull_lock = '/tmp/hustoj_git_pull.lock';
if (!file_exists($git_pull_lock) || (time() - filemtime($git_pull_lock)) > 60) {
touch($git_pull_lock);
$repo_dir = dirname(__DIR__);
exec("cd " . escapeshellarg($repo_dir) . " && git pull > /tmp/hustoj_git_pull.log 2>&1 &");
}
require_once( './include/cache_start.php' );
require_once( './include/db_info.inc.php' );
require_once( './include/memcache.php' );