First dev version v.0.1

This commit is contained in:
2025-10-21 17:53:37 +01:00
parent 8f319f4039
commit a09d4818b5
26 changed files with 1680 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
<?php
// includes/admin_actions.php
require_once __DIR__ . '/config.php';
session_start();
if (empty($_SESSION['is_admin'])) {
http_response_code(403);
exit('Access denied');
}
$action = $_GET['action'] ?? '';
switch ($action) {
case 'rebuild_gallery':
require_once __DIR__ . '/api.php';
echo "✅ Gallery cache rebuilt successfully.";
break;
case 'rebuild_exif':
require_once __DIR__ . '/exif_helper.php';
$dir = $CONFIG['gallery_dir'];
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
$count = 0;
foreach ($rii as $file) {
if ($file->isFile() && preg_match('/\.jpe?g$/i', $file->getFilename())) {
get_exif_cached($file->getPathname(), $CONFIG['exif_dir'], 0);
$count++;
}
}
echo "✅ Rebuilt EXIF cache for {$count} images.";
break;
case 'clean_thumbs':
$thumb_dir = $CONFIG['thumb_dir'];
$removed = 0;
foreach (glob($thumb_dir . '/*.jpg') as $t) {
unlink($t);
$removed++;
}
echo "🧹 Removed {$removed} thumbnails.";
break;
case 'restart_php':
shell_exec('pgrep php-fpm | xargs kill -USR2 2>/dev/null');
echo "🔄 PHP-FPM reload signal sent.";
break;
default:
echo "Unknown action.";
}