Commit Graph

10 Commits

Author SHA1 Message Date
Divarion-D
b544357172 refactor(redis): add type hints, PHPDoc, null-safety and health-check ping 2026-04-11 22:06:04 +03:00
Divarion-D
475c493c35 refactor: eliminate proxy functions, migrate to direct class method calls
312 files changed, 2866 insertions(+), 24110 deletions(-)

Proxy function replacements (130+ functions):
- goHome() -> AdminHelpers::goHome()
- checkPermissions() -> PageAuthorization::checkPermissions()
- getBouquet/getCategory/etc -> Service::getById()
- deleteStream/deleteLine/etc -> Repository/Service::delete()
- APIRequest/systemapirequest -> ApiClient::request/systemRequest()
- prepareArray/preparecolumn -> QueryHelper methods
- confirmIDs/parserelease/etc -> AdminHelpers methods
- getSettings/clearSettingsCache -> SettingsManager methods
- destroySession -> SessionManager::clearContext()
- getMag/getEnigma/deleteMAG/etc -> MagService/EnigmaService
- getSeriesTrailer/getMovieTMDB/etc -> TMDbService methods

Removed legacy files:
- src/includes/admin.php (main proxy hub)
- src/includes/libs/ (35+ files moved to core/modules)
- src/includes/python/ (moved to bin/python)
- src/includes/api/ (moved to Controllers)
- src/includes/ts.php, reseller_api.php
- src/infrastructure/legacy/admin_proxies.php
- tools/run_scan.sh, update_redis_conf.sh

Additional fixes:
- SQL query placeholder migration (BouquetService, CategoryService)
- PHP 8.x null-safe access (live.php, server_view.php, stream.php)
- TmdbCron: extracted variable for repeated similar_text calls
2026-04-09 21:24:48 +03:00
Divarion-D
41ad8d854e fix(cron): fix post-install errors in cron jobs and watchdog
- Encryption::generateUniqueCode(): null-coalesce $pass to prevent
  md5(null) deprecation when live_streaming_pass is not yet set
- CacheCronJob: mkdir() with 0755 perms, recursive flag, and
  chown to xc_vm user — fixes Permission denied on tmp/cache/*
- WatchdogCommand: null-safe decode of watchdog_data — fixes
  array offset on null when server has no watchdog history
- ConnectionTracker: guard file_put_contents with is_dir() check
  to prevent writes when CACHE_TMP_PATH does not exist yet
- Dockerfile: install cron package and enable cron.service for
  systemd-based test container
2026-04-06 16:19:09 +03:00
Divarion-D
59ca08924c 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
872b297ef3 fix(php): fix null/undefined variable access across codebase 2026-04-05 22:09:22 +03:00
Divarion-D
1b118d0bbe 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
8752c602ef Refactor global variable usage and clean up code
- Updated multiple files to use global variables for `$db` and `$rSettings` instead of calling `SettingsManager::getAll()` repeatedly.
- Removed unnecessary variable assignments and improved code readability.
- Deleted unused scripts for cleaning and scanning PHP file headers.
- Removed a file containing PHP syntax errors.
- Adjusted various repository and service classes to streamline database interactions.
2026-03-08 16:19:30 +03:00
Divarion-D
b790e5282c Stage 8 has been completed 2026-03-07 21:53:45 +03:00
Divarion-D
ccf1291dc4 Stage 7 has been completed 2026-02-27 22:32:39 +03:00
Divarion-D
89ed319afc Refactor permission management and authentication processes
- Moved advanced permissions loading to a separate file for better organization and maintainability.
- Updated permission checks to utilize a centralized Authorization class for improved code clarity.
- Refactored login processes in both admin and reseller APIs to use a dedicated Authenticator class, streamlining the authentication logic.
- Introduced RedisManager for handling Redis connections and signal management.
- Adjusted error reporting settings in Logger to reduce verbosity in production.
- Enhanced playlist generation logic to correctly handle proxy IPs.
- Improved handling of optional parameters in streaming URL generation to prevent potential errors.
2026-02-20 21:53:34 +03:00