function drush_libraries_list in Libraries API 7.2
Command callback. Show a list of registered libraries.
File
- ./
libraries.drush.inc, line 53 - Drush integration for Libraries API.
Code
function drush_libraries_list() {
$libraries = libraries_detect();
ksort($libraries);
if (empty($libraries)) {
drush_print('There are no registered libraries.');
}
else {
module_load_include('inc', 'libraries', 'libraries.admin');
$rows = array();
// drush_print_table() automatically treats the first row as the header, if
// $header is TRUE.
$rows[] = array(
dt('Name'),
dt('Status'),
dt('Version'),
dt('Variants'),
dt('Dependencies'),
dt('Provider'),
);
foreach ($libraries as $name => $library) {
// Only list installed variants.
$variants = array();
foreach ($library['variants'] as $variant_name => $variant) {
if ($variant['installed']) {
$variants[] = $variant_name;
}
}
$rows[] = array(
$name,
$library['installed'] ? dt('OK') : drupal_ucfirst($library['error']),
$library['installed'] && $library['version'] ? '-' : $library['version'],
$variants ? implode(', ', $variants) : '-',
$library['dependencies'] ? implode(', ', $library['dependencies']) : '-',
libraries_admin_get_provider($library),
);
}
// Make the possible values for the 'Status' column and the 'Version' header
// wrap nicely.
$widths = array(
0,
12,
7,
0,
0,
0,
);
drush_print_table($rows, TRUE, $widths);
}
}