From 2688843d803a10608a0483458f4419073c1274a7 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 15 Jan 2024 13:08:59 +0000 Subject: [PATCH] more types --- ext/auto_tagger/main.php | 2 +- ext/bulk_import_export/main.php | 2 +- ext/index/main.php | 6 ++---- ext/res_limit/main.php | 3 ++- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ext/auto_tagger/main.php b/ext/auto_tagger/main.php index 701abecd..08c3a52f 100644 --- a/ext/auto_tagger/main.php +++ b/ext/auto_tagger/main.php @@ -274,7 +274,7 @@ class AutoTagger extends Extension /** * @param string[] $tags_mixed */ - private function apply_auto_tags(array $tags_mixed): ?array + private function apply_auto_tags(array $tags_mixed): array { global $database; diff --git a/ext/bulk_import_export/main.php b/ext/bulk_import_export/main.php index 12851520..0248080c 100644 --- a/ext/bulk_import_export/main.php +++ b/ext/bulk_import_export/main.php @@ -42,7 +42,7 @@ class BulkImportExport extends DataHandlerExtension $tmpfile = tempnam(sys_get_temp_dir(), "shimmie_bulk_import"); $stream = $zip->getStream($item->hash); - if ($zip === false) { + if ($stream === false) { throw new SCoreException("Could not import " . $item->hash . ": File not in zip"); } diff --git a/ext/index/main.php b/ext/index/main.php index b1fb37ce..ed929800 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -72,12 +72,11 @@ class Index extends Extension } $total_pages = (int)ceil(Search::count_images($search_terms) / $config->get_int(IndexConfig::IMAGES)); - $images = []; - if (SPEED_HAX && $total_pages > $fast_page_limit && !$user->can("big_search")) { $total_pages = $fast_page_limit; } + $images = null; if (SPEED_HAX) { if ($count_search_terms === 0 && ($page_number < 10)) { // extra caching for the first few post/list pages @@ -88,8 +87,7 @@ class Index extends Extension ); } } - - if (!$images) { + if (is_null($images)) { $images = Search::find_images(($page_number - 1) * $page_size, $page_size, $search_terms); } } catch (PermissionDeniedException $pde) { diff --git a/ext/res_limit/main.php b/ext/res_limit/main.php index c5c4bea6..62a3b2ce 100644 --- a/ext/res_limit/main.php +++ b/ext/res_limit/main.php @@ -18,7 +18,8 @@ class ResolutionLimit extends Extension $min_h = $config->get_int("upload_min_height", -1); $max_w = $config->get_int("upload_max_width", -1); $max_h = $config->get_int("upload_max_height", -1); - $ratios = explode(" ", $config->get_string("upload_ratios", "")); + $rs = $config->get_string("upload_ratios", ""); + $ratios = trim($rs) ? explode(" ", $rs) : []; $image = $event->image;