Commit Graph
9 Commits
Author SHA1 Message Date
Divarion-D 84cbb82b5e fix(cli): improve MonitorCommand failure handling and process kill
- Use >= instead of == for stop_failures threshold (prevents skipping
  the exact failure count if incremented past it)
- Add retry with sleep on stream start failure before goto label76
- Replace shell_exec('kill -9 `ps ...`') with safer xargs pipeline
  that handles empty PID lists gracefully (xargs -r)
2026-03-17 20:46:31 +03:00
Divarion-D 3d5fff4d7d fix(startup): clear and warm autoloader cache on startup
- Call XC_Autoloader::clearCache() + warmCache() at the start of execute()
- Ensures fresh class map after updates before cron installation
2026-03-16 22:33:32 +03:00
Divarion-D 62a8c2880c fix(logging): add caller file tracking to FileLogger, improve ErrorsCronJob
- FileLogger::log(): capture caller file via debug_backtrace()
- FileLogger: add 'file' field to log entries
- Database: pass exception line number to FileLogger::log()
- ErrorsCronJob: support both legacy (log_message/log_extra) and current
  (message/extra) log formats for backward compatibility
- ErrorsCronJob: extract log fields into typed local variables
2026-03-16 22:33:32 +03:00
Divarion-D 272847cf7e refactor(console): replace manual registration with auto-discovery
- console.php: scan cli/Commands/ and cli/CronJobs/ via glob + reflection
- console.php: load module commands via ModuleLoader::registerAllCommands()
- Remove ~150 lines of manual require_once + register calls
- CommandRegistry: update docblock to reflect auto-discovery approach
- New commands are discovered automatically by implementing CommandInterface
2026-03-16 22:33:32 +03:00
Divarion-D 1cdd594c3e refactor(cli): move module commands from cli/ to modules/
- Move PlexCronJob, PlexItemCommand → modules/plex/
- Move TmdbCronJob, TmdbPopularCronJob → modules/tmdb/
- Move WatchCronJob, WatchItemCommand → modules/watch/
- Delete originals from cli/Commands/ and cli/CronJobs/
- Module commands now registered via ModuleInterface::registerCommands()
- TmdbCronJob: use require_once __DIR__ for module-local includes
2026-03-16 22:33:32 +03:00
Divarion-D 2f593e2c83 fix: guard igbinary_unserialize against Redis false returns
Redis::get() returns false when a key does not exist.
igbinary_unserialize(false) produces a PHP warning and returns false,
which can cause unexpected behavior or fatal errors on the streaming
hot path.

All 5 call sites now check for false before deserializing:
- ConnectionTracker::getConnection()
- ConnectionTracker::closeConnection() (internal lookup)
- ConnectionLimiter::closeConnection()
- reseller_api_actions.php (line_activity kill)
- UsersCronJob (mGet bulk deserialize via array_map)
2026-03-15 12:27:28 +03:00
Divarion-D 98ad8e609c fix: use require_once for tmdb.php to prevent duplicate class declarations
tmdb.php defines the TMDB class. Multiple code paths can include it
(cron jobs, episode import, watch folder). Using require instead of
require_once causes "Cannot declare class TMDB" fatal errors when
the file is loaded more than once in the same process.
2026-03-15 12:23:51 +03:00
Divarion-D 4cf4c3a82d fix: suppress exec/shell_exec warnings and guard null references
DaemonTrait: added @ to shell_exec calls that may fail on restricted
systems (e.g. when /proc is unavailable).

ProcessManager::isNginxRunning(): suppressed exec warning when pgrep
is not available.

Database::query(): guarded explode on debugString output to prevent
undefined offset when Sent SQL section is missing.

UpdateCronJob: added null check for $gitRelease to prevent fatal error
when GitHubReleases service fails to initialize.
2026-03-15 12:23:08 +03:00
Divarion-D 038a7de356 feat: Migrate legacy CLI scripts to console.php and extract streaming middleware
CLI consolidation:
- Delete 13 legacy CLI scripts from includes/cli/ (ondemand, proxy, queue, record, scanner, signals, startup, thumbnail, tools, update, watchdog, plex_item, watch_item)
- Convert status and tools entry points to thin proxies that delegate to console.php
- Update all shell_exec() calls across admin controllers, views, and API layer to use console.php command syntax instead of direct CLI file paths
- Update src/service to launch daemons via console.php (signals, watchdog, queue, cache_handler, startup)
- Update Python src/update script to call console.php update instead of includes/cli/update.php
- Update test_installer to use console.php startup

Streaming deduplication:
- Extract StreamAuthMiddleware — common response headers and token decryption shared by live/vod/timeshift
- Extract ShutdownHandler — unified shutdown logic replacing 3 duplicate function shutdown() blocks
- Refactor live.php, vod.php, timeshift.php to use new middleware classes
- Add streaming micro-router to www/stream/index.php as fallback entry point

Routing fixes:
- Fix admin index.php redirect to use relative path (supports access code prefixes)
- Add access code root redirect in public/index.php to prevent broken CSS/JS asset resolution
- Fix init.php for CLI compatibility: guard $_SERVER access, define PHP_ERRORS safely

Migrations:
- 001_update_crontab_filenames.sql — strip .php suffix from crontab filenames
- Fix cache.php view query to match new filename format (cache_engine instead of cache_engine.php)
2026-03-14 23:57:33 +03:00