1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00

Refactor Video Status Constants

- Updated references from Video::$status* to Video::STATUS_* for consistency across multiple files.
- Ensured that all instances of video status checks and assignments utilize the new constant format.
- This change improves code readability and maintainability by standardizing the way video statuses are referenced throughout the codebase.
This commit is contained in:
Daniel Neto 2025-07-11 12:52:02 -03:00
parent 0c05672df9
commit 8db8d44a92
32 changed files with 442 additions and 401 deletions

View file

@ -458,10 +458,10 @@ if (empty($advancedCustom)) {
$statusSearchFilter = array();
}
if (AVideoPlugin::isEnabled('FansSubscriptions')) {
$statusSearchFilter[] = Video::$statusFansOnly;
$statusSearchFilter[] = Video::STATUS_FANS_ONLY;
}
if (AVideoPlugin::isEnabled('SendRecordedToEncoder')) {
$statusSearchFilter[] = Video::$statusRecording;
$statusSearchFilter[] = Video::STATUS_RECORDING;
}
foreach (Video::$statusDesc as $key => $value) {
if (!in_array($key, $statusSearchFilter)) {
@ -1277,7 +1277,7 @@ if (empty($advancedCustom->disableHTMLDescription)) {
$('#videoStartSeconds').val('00:00:00');
$('#videoSkipIntroSecond').val('00:00:00');
$('#inputVideoPassword').val("");
$('#videoStatus').val('<?php echo Video::$statusDraft; ?>');
$('#videoStatus').val('<?php echo Video::STATUS_DRAFT; ?>');
$('#inputCleanTitle').val("");
$('#created').val("");
$('#inputDescription').val("");

View file

@ -46,7 +46,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
$filename = $video->getFilename();
if ($video->getTitle() === "Video automatically booked") {
$video->setTitle($title);
$video->setStatus(Video::$statusInactive);
$video->setStatus(Video::STATUS_INACTIVE);
}
}
//var_dump($videos_id, $_FILES['upl']['name'], $title, $video->getTitle());exit;
@ -101,7 +101,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
$video->setType("zip", true);
}
$video->setAutoStatus(Video::$statusInactive);
$video->setAutoStatus(Video::STATUS_INACTIVE);
$id = $video->save();
if ($id) {
@ -113,7 +113,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
$tmp_name = $_FILES['upl']['tmp_name'];
$filenameMP4 = $filename . "." . $extension;
decideMoveUploadedToVideos($tmp_name, $filenameMP4, $video->getType());
$obj->title = $video->getTitle();
$obj->error = false;
$obj->filename = $filename;
@ -139,7 +139,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
if (!empty($_FILES['upl']['tmp_name'])) {
$obj->lines[] = __LINE__;
$video->setAutoStatus(Video::$statusActive);
$video->setAutoStatus(Video::STATUS_ACTIVE);
AVideoPlugin::onUploadIsDone($obj->videos_id);
AVideoPlugin::afterNewVideo($obj->videos_id);
}

View file

@ -344,9 +344,9 @@ TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY);
if (empty($video)) {
if (!empty($_GET['v'])) {
$vid = new Video('', '', $_GET['v']);
if ($vid->getStatus() === Video::$statusBrokenMissingFiles) {
if ($vid->getStatus() === Video::STATUS_BROKEN_MISSING_FILES) {
if (!Video::isMediaFileMissing($vid->getFilename())) {
$vid->setStatus(Video::$statusActive);
$vid->setStatus(Video::STATUS_ACTIVE);
$vid->save();
_error_log('Missing files recovered ' . $_GET['v']);
} else {
@ -359,7 +359,7 @@ if (empty($video)) {
}
exit;
}
} else if ($vid->getStatus() === Video::$statusUnpublished) {
} else if ($vid->getStatus() === Video::STATUS_UNPUBLISHED) {
$msg = 'This video is currently unpublished. Please contact an administrator to review and approve it for publication. Thank you for your patience and understanding.';
videoNotFound($msg);
exit;