Skip to content

Commit 604906c

Browse files
committed
fix extract thumbnails cron with archived media
1 parent dd3e9ae commit 604906c

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

core/cli/Cron.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function run(array $args): bool
6565
}
6666

6767
// Run job.
68-
echo "Running job..." . PHP_EOL;
68+
echo "Running job '{$module}/{$task}'..." . PHP_EOL;
6969
$status = $job->run();
7070
if ($status) {
7171
if ($lastRun) {
@@ -145,6 +145,9 @@ public function run(array $args): bool
145145

146146
// disabled "running" message since we have things running every second (would be good to have a debug mode)
147147
// echo "Running job '{$job['module']}/{$job['name']}'..." . PHP_EOL;
148+
// $output = '';
149+
// exec(OB_LOCAL . '/cli/ob' . ' cron run ' . $job['module'] . ' ' . $job['name'], $output);
150+
// echo implode(PHP_EOL, $output) . PHP_EOL;
148151
exec(OB_LOCAL . '/cli/ob' . ' cron run ' . $job['module'] . ' ' . $job['name'] . ' >> ' . $this->obCronLog . ' &');
149152
}
150153

core/cron/ExtractThumbnails.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ExtractThumbnails extends Cron
88
{
99
public function interval(): int
1010
{
11-
return 300;
11+
return 1;
1212
}
1313

1414
public function run(): bool
@@ -23,6 +23,12 @@ public function run(): bool
2323
$media = $db->assoc_list();
2424

2525
foreach ($media as $item) {
26+
// don't generate thumbnails for achived media files (these are in their own separate directory anyway and
27+
// wouldn't be found)
28+
if ($item['is_archived']) {
29+
continue;
30+
}
31+
2632
$input_file = OB_MEDIA . '/' . $item['file_location'][0] . '/' . $item['file_location'][1] . '/' . $item['filename'];
2733
$output_dir = OB_THUMBNAILS . '/media/' . $item['file_location'][0] . '/' . $item['file_location'][1];
2834
$output_file = $output_dir . '/' . $item['id'] . '.webp';

0 commit comments

Comments
 (0)