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

Allow modules to query for all projects, optionally of a certain type. #947

Open
docwilmot opened this issue Oct 29, 2022 · 1 comment · May be fixed by #984
Open

Allow modules to query for all projects, optionally of a certain type. #947

docwilmot opened this issue Oct 29, 2022 · 1 comment · May be fixed by #984

Comments

@docwilmot
Copy link
Contributor

This was mentioned here backdrop/backdrop-issues#5845
and here #870

Currently we dont have a way to get a list of all projects available on BackdropCMS.org. The closest is calliing installer_browser_fetch_results() with a high items_per_page (9999 for example).

Even then this can only return one project type (9999 modules for example).

We can fix this by skipping the query filter in borg_pbs_project_browser_server_query(). So:

  if ($items_per_page != 'all') {
    // Only send back the requested amount unless all projects were requested.
    $start = $filters['page'] * $filters['items_per_page'];
    $count_query = $query;
    $count_result = $count_query->execute();
    $query->range($start, $filters['items_per_page']);
  }

And optionally skipping the type query:

  if ($type != 'all') {
    // Filter out projects based on type unless all types were requested.
    if (isset($filters['type'])) {
    $query->condition('n.type', 'project_' . $filters['type']);
  }
}

This would allow installer_browser_fetch_results(array('items_per_page' => 'all', 'type' => 'all')) for example.

Note that Drupal has opted to do a 4 times a day dump of this info to file since there are many many more projects there than we have (we're up to 991 total as of today).

@docwilmot docwilmot linked a pull request Mar 12, 2023 that will close this issue
@docwilmot
Copy link
Contributor Author

PR enables:
installer_browser_fetch_results() returns all projects of all types.
installer_browser_fetch_results(array('type' => 'modules')) returns all modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant