@@ -29,9 +29,11 @@ discard block |
||
29 | 29 | { |
30 | 30 | $time = strtotime('- 6 hours'); |
31 | 31 | $files = File::find()->where(['object_id' => '0'])->andWhere(['<', 'created', $time])->all(); |
32 | - if ($files) foreach ($files as $file) { |
|
32 | + if ($files) { |
|
33 | + foreach ($files as $file) { |
|
33 | 34 | $file->delete(); |
34 | 35 | } |
36 | + } |
|
35 | 37 | } |
36 | 38 | |
37 | 39 | /** |
@@ -60,22 +62,26 @@ discard block |
||
60 | 62 | { |
61 | 63 | $ffmpeg = Yii::$app->getModule('files')->ffmpeg; |
62 | 64 | |
63 | - if (!file_exists($ffmpeg)) |
|
64 | - return $this->stdout("ffmpeg is not found: {$ffmpeg}" . PHP_EOL, Console::FG_RED); |
|
65 | + if (!file_exists($ffmpeg)) { |
|
66 | + return $this->stdout("ffmpeg is not found: {$ffmpeg}" . PHP_EOL, Console::FG_RED); |
|
67 | + } |
|
65 | 68 | |
66 | - if (!is_executable($ffmpeg)) |
|
67 | - return $this->stdout("ffmpeg is not executable: {$ffmpeg}" . PHP_EOL, Console::FG_RED); |
|
69 | + if (!is_executable($ffmpeg)) { |
|
70 | + return $this->stdout("ffmpeg is not executable: {$ffmpeg}" . PHP_EOL, Console::FG_RED); |
|
71 | + } |
|
68 | 72 | |
69 | 73 | $file = File::find() |
70 | 74 | ->where(['type' => FileType::VIDEO, 'video_status' => VideoStatus::QUEUE]) |
71 | 75 | ->andWhere(['!=', 'object_id', 0]) |
72 | 76 | ->one(); |
73 | 77 | |
74 | - if (!$file) |
|
75 | - return $this->stdout("Convert queue is empty" . PHP_EOL, Console::FG_GREEN); |
|
78 | + if (!$file) { |
|
79 | + return $this->stdout("Convert queue is empty" . PHP_EOL, Console::FG_GREEN); |
|
80 | + } |
|
76 | 81 | |
77 | - if (!file_exists($file->rootPath)) |
|
78 | - return $this->stdout("Source file is not found: {$file->rootPath}" . PHP_EOL, Console::FG_RED); |
|
82 | + if (!file_exists($file->rootPath)) { |
|
83 | + return $this->stdout("Source file is not found: {$file->rootPath}" . PHP_EOL, Console::FG_RED); |
|
84 | + } |
|
79 | 85 | |
80 | 86 | |
81 | 87 | $file->video_status = VideoStatus::CONVERTING; |