Commit Graph
7 Commits
Author SHA1 Message Date
Divarion-D 48b3fbf0ca fix: Redis null-safety guards
- ConnectionTracker: null checks for RedisManager::instance()
- UsersCronJob: safe array access for getConnections()
- table.php: null coalesce for rFailsPS + Redis fallback
2026-04-13 21:51:08 +03:00
Divarion-D 1b73fa69d6 fix(cron): null-safe guards for LB server environment
- ServersCronJob: guard against null watchdog_data from json_decode,
  use ?? [] for cpu_average_array access
- UsersCronJob: safe json_decode for php_pids — check is_array()
  before array_map to prevent TypeError on null
- CacheCronJob: suppress mkdir errors with @, check is_dir() before
  chown/chgrp to handle permission-denied on LB servers
2026-04-12 15:22:07 +03:00
Divarion-D f8f465209c fix(streaming): add null coalescing guards for undefined array keys 2026-04-11 22:06:04 +03:00
Divarion-D 738973c5db docs(php): add standardized file headers across codebase
- Add @author, @copyright, @link, @version, @license to 399 PHP files
- MERGE mode: inject metadata into 243 existing docblocks (preserving docs)
- INSERT mode: create new docblocks for 156 files without headers
- Skip 3 files that already had correct headers
- Exclude third-party libs (TMDb, mobiledetect, Dropbox, etc.)
- Exclude bin/, ministra/, content/, tmp/, resources/, module views
- Update tools/add_headers.php to v2 with MERGE strategy
2026-04-05 22:38:36 +03:00
Divarion-D 02549fe824 fix(php): fix null/undefined variable access across codebase 2026-04-05 22:09:22 +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 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