Merge branch 'master' of https://github.com/shish/shimmie2
This commit is contained in:
commit
d13c91ff9a
5 changed files with 19 additions and 14 deletions
|
@ -25,6 +25,7 @@ function log_msg(string $section, int $priority, string $message, ?string $flash
|
|||
|
||||
if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && ($priority >= $threshold)) {
|
||||
print date("c")." $section: $message\n";
|
||||
ob_flush();
|
||||
}
|
||||
if (!is_null($flash)) {
|
||||
$page->flash($flash);
|
||||
|
|
|
@ -107,11 +107,11 @@ class BulkActions extends Extension
|
|||
if (count($event->args) < 2) {
|
||||
return;
|
||||
}
|
||||
$query = $event->args[0];
|
||||
$items = $this->yield_search_results($event->args[1]);
|
||||
$newEvent = new BulkActionEvent($event->args[0], $items);
|
||||
var_dump($newEvent);
|
||||
# send_event($newEvent);
|
||||
$action = $event->args[0];
|
||||
$query = $event->args[1];
|
||||
$items = $this->yield_search_results($query);
|
||||
log_info("bulk_actions", "Performing $action on {$event->args[1]}");
|
||||
send_event(new BulkActionEvent($event->args[0], $items));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ class Index extends Extension
|
|||
}
|
||||
if ($event->cmd == "search") {
|
||||
$query = count($event->args) > 0 ? Tag::explode($event->args[0]) : [];
|
||||
$items = Image::find_images(0, 100, $query);
|
||||
$items = Image::find_images(0, 1000, $query);
|
||||
foreach ($items as $item) {
|
||||
print("{$item->hash}\n");
|
||||
}
|
||||
|
|
|
@ -167,8 +167,9 @@ class Media extends Extension
|
|||
$failed = 0;
|
||||
foreach ($event->items as $image) {
|
||||
try {
|
||||
log_debug("media", "Rescanning media for {$image->hash} ({$image->id})");
|
||||
send_event(new MediaCheckPropertiesEvent($image));
|
||||
$image->save_media_properties();
|
||||
$image->save_to_db();
|
||||
$total++;
|
||||
} catch (MediaException $e) {
|
||||
$failed++;
|
||||
|
@ -373,10 +374,10 @@ class Media extends Extension
|
|||
exec($cmd, $output, $ret);
|
||||
|
||||
if ((int)$ret == (int)0) {
|
||||
log_debug('Media', "Generating thumbnail with command `$cmd`, returns $ret");
|
||||
log_debug('media', "Generating thumbnail with command `$cmd`, returns $ret");
|
||||
return true;
|
||||
} else {
|
||||
log_error('Media', "Generating thumbnail with command `$cmd`, returns $ret");
|
||||
log_error('media', "Generating thumbnail with command `$cmd`, returns $ret");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -405,11 +406,11 @@ class Media extends Extension
|
|||
exec($cmd, $output, $ret);
|
||||
|
||||
if ((int)$ret == (int)0) {
|
||||
log_debug('Media', "Getting media data `$cmd`, returns $ret");
|
||||
log_debug('media', "Getting media data `$cmd`, returns $ret");
|
||||
$output = implode($output);
|
||||
return json_decode($output, true);
|
||||
} else {
|
||||
log_error('Media', "Getting media data `$cmd`, returns $ret");
|
||||
log_error('media', "Getting media data `$cmd`, returns $ret");
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
@ -617,7 +618,7 @@ class Media extends Extension
|
|||
if ($ret != 0) {
|
||||
throw new MediaException("Resizing image with command `$cmd`, returns $ret, outputting " . implode("\r\n", $output));
|
||||
} else {
|
||||
log_debug('Media', "Generating thumbnail with command `$cmd`, returns $ret");
|
||||
log_debug('media', "Generating thumbnail with command `$cmd`, returns $ret");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -931,7 +932,7 @@ class Media extends Extension
|
|||
} else {
|
||||
$size = [1, 1];
|
||||
}
|
||||
log_debug('Media', "Getting video size with `$cmd`, returns $output -- $size[0], $size[1]");
|
||||
log_debug('media', "Getting video size with `$cmd`, returns $output -- $size[0], $size[1]");
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,10 @@ try {
|
|||
|
||||
$_tracer->end();
|
||||
if (TRACE_FILE) {
|
||||
if ((microtime(true) - $_shm_load_start) > TRACE_THRESHOLD && $_SERVER["REQUEST_URI"] != "/upload") {
|
||||
if (
|
||||
(microtime(true) - $_shm_load_start) > TRACE_THRESHOLD
|
||||
&& ($_SERVER["REQUEST_URI"] ?? "") != "/upload"
|
||||
) {
|
||||
$_tracer->flush(TRACE_FILE);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue