Skip to content

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

Open
@docwilmot

Description

@docwilmot

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions