Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ouroboros #1372

Merged
merged 4 commits into from
Jan 7, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[ouroboros] remove hard dependency on tag map
socram8888 committed Dec 30, 2024
commit 590474fff4be34208e9dd81ccc923eaeb49de717
11 changes: 9 additions & 2 deletions ext/ouroboros_api/main.php
Original file line number Diff line number Diff line change
@@ -421,6 +421,13 @@ protected function postIndex(int $limit, int $page, array $tags): void
protected function tagIndex(int $limit, int $page, string $order, string $name, string $name_pattern): void
{
global $database, $config;

// This class will only exist if the tag map plugin is enabled
$tags_min = 0;
if (class_exists('\Shimmie2\TagMapConfig')) {
$tags_min = $config->get_int(TagMapConfig::TAGS_MIN);
}

$start = ($page - 1) * $limit;
switch ($order) {
case 'name':
@@ -432,7 +439,7 @@ protected function tagIndex(int $limit, int $page, string $order, string $name,
WHERE count >= :tags_min
ORDER BY LOWER(substr(tag, 1, 1)) LIMIT :start, :max_items
",
['tags_min' => $config->get_int(TagMapConfig::TAGS_MIN), 'start' => $start, 'max_items' => $limit]
['tags_min' => $tags_min, 'start' => $start, 'max_items' => $limit]
);
break;
case 'count':
@@ -444,7 +451,7 @@ protected function tagIndex(int $limit, int $page, string $order, string $name,
WHERE count >= :tags_min
ORDER BY count DESC, tag ASC LIMIT :start, :max_items
",
['tags_min' => $config->get_int(TagMapConfig::TAGS_MIN), 'start' => $start, 'max_items' => $limit]
['tags_min' => $tags_min, 'start' => $start, 'max_items' => $limit]
);
break;
}