From abc87ff8431db797042850bf631b59e7578821c9 Mon Sep 17 00:00:00 2001 From: docwilmot Date: Sun, 12 Mar 2023 11:38:29 -0500 Subject: [PATCH 1/3] Allow get all --- .../project_browser_server.module | 2 +- www/modules/custom/borg_pbs/borg_pbs.module | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/www/modules/contrib/project_browser_server/project_browser_server.module b/www/modules/contrib/project_browser_server/project_browser_server.module index 63b5a5337..dbbc3cd01 100644 --- a/www/modules/contrib/project_browser_server/project_browser_server.module +++ b/www/modules/contrib/project_browser_server/project_browser_server.module @@ -93,7 +93,7 @@ function _project_browser_server_return($results) { * Validate a Project Browser request. */ function _project_browser_server_validate($type) { - if ($type != 'module' && $type != 'theme' && $type != 'layout') { + if ($type != 'all' && $type != 'module' && $type != 'theme' && $type != 'layout') { backdrop_add_http_header('Status', '404 Not Found'); _project_browser_server_return(t('You must specify a project type to be either "module" or "theme" or "layout".')); diff --git a/www/modules/custom/borg_pbs/borg_pbs.module b/www/modules/custom/borg_pbs/borg_pbs.module index fc558027f..20bdf6568 100644 --- a/www/modules/custom/borg_pbs/borg_pbs.module +++ b/www/modules/custom/borg_pbs/borg_pbs.module @@ -56,7 +56,7 @@ function borg_pbs_project_browser_server_query($filters) { ->fields('n'); // Filter out projects based on type. - if (isset($filters['type'])) { + if (isset($filters['type']) && $filters['type'] != 'all') { $query->condition('n.type', 'project_' . $filters['type']); } @@ -104,10 +104,12 @@ function borg_pbs_project_browser_server_query($filters) { } // Only send back the requested amount. - $start = $filters['page'] * $filters['items_per_page']; - $count_query = $query; - $count_result = $count_query->execute(); - $query->range($start, $filters['items_per_page']); + if ($filters['items_per_page'] != 'all') { + $start = $filters['page'] * $filters['items_per_page']; + $count_query = $query; + $count_result = $count_query->execute(); + $query->range($start, $filters['items_per_page']); + } // Add the sorting. if (!empty($filters['order'])) { @@ -143,6 +145,9 @@ function borg_pbs_project_browser_server_query($filters) { } $result = $query->execute(); + if ($filters['items_per_page'] == 'all') { + $count_result = $result; + } $load = array(); foreach ($result as $row) { @@ -168,7 +173,7 @@ function borg_pbs_project_browser_server_query($filters) { $image_url = str_replace('https://projects.backdropcms.org','https://backdropcms.org', $image_url); $projects[$node->project['name']] = array( - 'type' => $filters['type'], + 'type' => $node->type, 'title' => $node->title, 'name' => $node->project['name'], 'backdrop version' => $filters['version'] . '.x', From 5bfffb446449f8d6bd530d1a63fde3098f789562 Mon Sep 17 00:00:00 2001 From: docwilmot Date: Sun, 12 Mar 2023 11:57:58 -0500 Subject: [PATCH 2/3] Set default filter values --- www/core/modules/installer/installer.browser.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/www/core/modules/installer/installer.browser.inc b/www/core/modules/installer/installer.browser.inc index b7b8d2690..bdccc2af4 100644 --- a/www/core/modules/installer/installer.browser.inc +++ b/www/core/modules/installer/installer.browser.inc @@ -234,7 +234,15 @@ function installer_browser_get_queued_releases() { * @return * Returns an array of results. */ -function installer_browser_fetch_results($filters) { +function installer_browser_fetch_results($filters = array()) { + $filters += array( + 'version' => '1', + 'text' => '', + 'type' => 'all', + 'page' => 0, + 'items_per_page' => 'all', + ); + $server = installer_browser_get_server(); // Attempt to retrieve the cached version of this page. $cid = 'installer:results:' . md5(serialize(array_merge($filters, $server))); From 09e4182693d3b31fd5bee843d3de00e0dfd5fc77 Mon Sep 17 00:00:00 2001 From: docwilmot Date: Tue, 6 Jan 2026 15:19:47 -0500 Subject: [PATCH 3/3] Update docblock and add patch --- PATCHES.md | 3 +++ www/core/modules/installer/installer.browser.inc | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/PATCHES.md b/PATCHES.md index 41c3bcc82..7c300e539 100644 --- a/PATCHES.md +++ b/PATCHES.md @@ -5,6 +5,9 @@ Text module -- formatted text fields should not lock when empty due to access. https://github.com/backdrop/backdrop-issues/issues/5151 https://github.com/backdrop/backdrop/pull/3686.patch +Installer module - increase query count + https://github.com/backdrop/backdrop-issues/issues/5845 + https://github.com/backdrop/backdrop/pull/5188.patch Patches to Backdrop Contrib: ============================ diff --git a/www/core/modules/installer/installer.browser.inc b/www/core/modules/installer/installer.browser.inc index bdccc2af4..e3357d584 100644 --- a/www/core/modules/installer/installer.browser.inc +++ b/www/core/modules/installer/installer.browser.inc @@ -231,8 +231,9 @@ function installer_browser_get_queued_releases() { * @param array $filters * An associative array of queries to use to filter results. * - * @return - * Returns an array of results. + * @return array + * If $filters is set, returns an array of projects based on the passed in + * keys. If not set, returns all projects of all types. */ function installer_browser_fetch_results($filters = array()) { $filters += array(