Refactor various components for improved error handling and code clarity

- Added checks for file existence before unlinking files in CacheHandlerCommand and CacheEngineCronJob.
- Suppressed errors for exec and shell_exec calls in WatchdogCommand, DaemonTrait, and SystemInfo.
- Enhanced bouquet map retrieval in BouquetService and CacheEngineCronJob to handle potential unserialization issues.
- Improved error handling in RootMysqlCronJob for MySQLD log parsing.
- Updated UserRepository to safely retrieve user IDs and user info from files, ensuring file existence checks.
- Refactored EpisodeService to handle stream sources and subtitles more robustly, including fallback mechanisms.
- Adjusted API responses in PlayerApiController and admin views to ensure consistent data handling.
- Enhanced server and line management views to prevent potential errors with undefined variables and arrays.
- General code cleanup and consistency improvements across various files.
This commit is contained in:
Divarion-D
2026-04-23 21:28:51 +03:00
parent f8f9d91e23
commit 6d11302d73
21 changed files with 239 additions and 126 deletions
+28 -10
View File
@@ -134,16 +134,20 @@ class UserRepository {
if ($rCached) {
if (empty($rPassword) && empty($rUserID) && strlen($rUsername) == 32) {
if ($rSettings['case_sensitive_line']) {
$rUserID = intval(file_get_contents(LINES_TMP_PATH . 'line_t_' . $rUsername));
$rTokenPath = LINES_TMP_PATH . 'line_t_' . $rUsername;
$rUserID = (file_exists($rTokenPath) ? intval(file_get_contents($rTokenPath)) : 0);
} else {
$rUserID = intval(file_get_contents(LINES_TMP_PATH . 'line_t_' . strtolower($rUsername)));
$rTokenPath = LINES_TMP_PATH . 'line_t_' . strtolower($rUsername);
$rUserID = (file_exists($rTokenPath) ? intval(file_get_contents($rTokenPath)) : 0);
}
} else {
if (!empty($rUsername) && !empty($rPassword)) {
if ($rSettings['case_sensitive_line']) {
$rUserID = intval(file_get_contents(LINES_TMP_PATH . 'line_c_' . $rUsername . '_' . $rPassword));
$rCachePath = LINES_TMP_PATH . 'line_c_' . $rUsername . '_' . $rPassword;
$rUserID = (file_exists($rCachePath) ? intval(file_get_contents($rCachePath)) : 0);
} else {
$rUserID = intval(file_get_contents(LINES_TMP_PATH . 'line_c_' . strtolower($rUsername) . '_' . strtolower($rPassword)));
$rCachePath = LINES_TMP_PATH . 'line_c_' . strtolower($rUsername) . '_' . strtolower($rPassword);
$rUserID = (file_exists($rCachePath) ? intval(file_get_contents($rCachePath)) : 0);
}
} else {
if (empty($rUserID)) {
@@ -153,7 +157,12 @@ class UserRepository {
}
if ($rUserID) {
$rUserInfo = igbinary_unserialize(file_get_contents(LINES_TMP_PATH . 'line_i_' . $rUserID));
$rInfoPath = LINES_TMP_PATH . 'line_i_' . $rUserID;
if (file_exists($rInfoPath)) {
$rUserInfo = igbinary_unserialize(file_get_contents($rInfoPath));
} else {
return false;
}
}
} else {
if (empty($rPassword) && empty($rUserID) && strlen($rUsername) == 32) {
@@ -309,16 +318,20 @@ class UserRepository {
if ($rCached) {
if (empty($rPassword) && empty($rUserID) && strlen($rUsername) == 32) {
if ($rSettings['case_sensitive_line']) {
$rUserID = intval(file_get_contents(LINES_TMP_PATH . 'line_t_' . $rUsername));
$rTokenPath = LINES_TMP_PATH . 'line_t_' . $rUsername;
$rUserID = (file_exists($rTokenPath) ? intval(file_get_contents($rTokenPath)) : 0);
} else {
$rUserID = intval(file_get_contents(LINES_TMP_PATH . 'line_t_' . strtolower($rUsername)));
$rTokenPath = LINES_TMP_PATH . 'line_t_' . strtolower($rUsername);
$rUserID = (file_exists($rTokenPath) ? intval(file_get_contents($rTokenPath)) : 0);
}
} else {
if (!empty($rUsername) && !empty($rPassword)) {
if ($rSettings['case_sensitive_line']) {
$rUserID = intval(file_get_contents(LINES_TMP_PATH . 'line_c_' . $rUsername . '_' . $rPassword));
$rCachePath = LINES_TMP_PATH . 'line_c_' . $rUsername . '_' . $rPassword;
$rUserID = (file_exists($rCachePath) ? intval(file_get_contents($rCachePath)) : 0);
} else {
$rUserID = intval(file_get_contents(LINES_TMP_PATH . 'line_c_' . strtolower($rUsername) . '_' . strtolower($rPassword)));
$rCachePath = LINES_TMP_PATH . 'line_c_' . strtolower($rUsername) . '_' . strtolower($rPassword);
$rUserID = (file_exists($rCachePath) ? intval(file_get_contents($rCachePath)) : 0);
}
} else {
if (!empty($rUserID)) {
@@ -329,7 +342,12 @@ class UserRepository {
}
if (!$rUserID) {
} else {
$rUserInfo = igbinary_unserialize(file_get_contents(LINES_TMP_PATH . 'line_i_' . $rUserID));
$rInfoPath = LINES_TMP_PATH . 'line_i_' . $rUserID;
if (file_exists($rInfoPath)) {
$rUserInfo = igbinary_unserialize(file_get_contents($rInfoPath));
} else {
return false;
}
}
} else {
if (empty($rPassword) && empty($rUserID) && strlen($rUsername) == 32) {