45b15c7fd5
Complete implementation of automated GitHub repository synchronization: - Webhook-based auto-sync from GitHub - Multi-repository support with branch selection - Web dashboard for management - Manual sync and rollback functionality - Comprehensive logging and monitoring Located in /gitpusher/ subdirectory as standalone application.
45 lines
999 B
PHP
45 lines
999 B
PHP
<?php
|
|
/**
|
|
* Log API
|
|
* Retrieves log entries
|
|
*/
|
|
|
|
require_once '../../src/ConfigManager.php';
|
|
require_once '../../src/Logger.php';
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
|
|
http_response_code(405);
|
|
echo json_encode(['error' => 'Method not allowed']);
|
|
exit;
|
|
}
|
|
|
|
$configManager = new ConfigManager();
|
|
$logger = new Logger($configManager);
|
|
|
|
// Get query parameters
|
|
$limit = isset($_GET['limit']) ? (int)$_GET['limit'] : 100;
|
|
$offset = isset($_GET['offset']) ? (int)$_GET['offset'] : 0;
|
|
$repoId = $_GET['repo_id'] ?? null;
|
|
$type = $_GET['type'] ?? null;
|
|
|
|
// Get logs based on filters
|
|
if ($repoId) {
|
|
$logs = $logger->getByRepository($repoId, $limit);
|
|
} elseif ($type) {
|
|
$logs = $logger->getByType($type, $limit);
|
|
} else {
|
|
$logs = $logger->getAll($limit, $offset);
|
|
}
|
|
|
|
// Get statistics
|
|
$stats = $logger->getStats();
|
|
|
|
echo json_encode([
|
|
'success' => true,
|
|
'logs' => $logs,
|
|
'stats' => $stats,
|
|
'count' => count($logs)
|
|
]);
|