updated elysia_cron, elfinder, metatag, libraries, email_registration, migrate, nodeform_cols
This commit is contained in:
@@ -1,4 +1,21 @@
|
||||
|
||||
Libraries 7.x-2.5, 2018-10-5
|
||||
-----------------------------
|
||||
#2815965 by plach, Manav, tstoeckler, Proteo: Base theme is not loaded when checking for theme library info
|
||||
#2999116 by Anghelu, joshbrown81: Finds no library after update
|
||||
|
||||
Libraries 7.x-2.4, 2018-09-10
|
||||
-----------------------------
|
||||
#2779591 by mark_fullmer, cglauren, improved PHP 7.x.x support.
|
||||
#2699799 by flaviovs, hanoii: Support reading version from package.json.
|
||||
#2816781 by joelstein: Add a 'access library reports' permission.
|
||||
#2823735 by amanaplan, tstoeckler: Add admin_menu cache clear integration.
|
||||
#2745763 by Albert Volkman, tstoeckler: Allow downloading all libraries at once.
|
||||
#2310753 by tstoeckler: Avoid libraries_get_libraries() scanning the root.
|
||||
#2341955 by sadashiv, tstoeckler: Clear library cache on library report.
|
||||
#819610 by tstoeckler: Show variants and dependencies in the UI.
|
||||
#2724925 by ron_s, tstoeckler: Separate installed from uninstalled libraries.
|
||||
|
||||
Libraries 7.x-2.3, 2016-05-12
|
||||
-----------------------------
|
||||
#1884246 by BR0kEN, tstoeckler et al: Allow downloading libraries via Drush.
|
||||
@@ -94,17 +111,11 @@ by sun: Fixed testbot breaks upon .info file without .module file.
|
||||
#719896 by tstoeckler, sun: Added starting point for hook_libraries_info().
|
||||
|
||||
|
||||
Libraries 7.x-1.x, xxxx-xx-xx
|
||||
-----------------------------
|
||||
|
||||
Libraries 7.x-1.0, 2010-01-27
|
||||
-----------------------------
|
||||
#743522 by sun: Ported to D7.
|
||||
|
||||
|
||||
Libraries 6.x-1.x, xxxx-xx-xx
|
||||
-----------------------------
|
||||
|
||||
Libraries 6.x-1.0, 2010-01-27
|
||||
-----------------------------
|
||||
#1028744 by tstoeckler: Code clean-up.
|
||||
|
@@ -0,0 +1,3 @@
|
||||
.libraries-table {
|
||||
margin-bottom: 2em;
|
||||
}
|
@@ -20,41 +20,112 @@
|
||||
* The form array for the overview form.
|
||||
*/
|
||||
function libraries_admin_overview(array $form, array &$form_state) {
|
||||
$header = array(t('Name'), t('Status'), t('Installed version'), t('Provider'), t('Links'));
|
||||
$rows = array();
|
||||
// Only show variants for installed libraries.
|
||||
$header_installed = array(t('Name'), t('Version'), t('Variants'), t('Dependencies'), t('Provider'), t('Links'));
|
||||
// Only show status for libraries with an error.
|
||||
$header_error = array(t('Name'), t('Status'), t('Version'), t('Dependencies'), t('Provider'), t('Links'));
|
||||
// For unregistered libraries the only information we can show is the path.
|
||||
$header_unregistered = array(t('Name'), t('Path'));
|
||||
|
||||
$libraries = libraries_detect();
|
||||
uasort($libraries, 'libraries_admin_sort_title');
|
||||
$rows_installed = array();
|
||||
$rows_error = array();
|
||||
$rows_unregistered = array();
|
||||
|
||||
foreach ($libraries as $machine_name => $library) {
|
||||
// Registered libraries: we prefer to use libraries_detect() since it provides
|
||||
// library metadata.
|
||||
$libraries_registered = libraries_detect();
|
||||
uasort($libraries_registered, 'libraries_admin_sort_title');
|
||||
|
||||
// Unregistered libraries: modules can depend on Libraries API without sharing
|
||||
// metadata by using libraries_get_path(). Libraries can also be placed in the
|
||||
// filesystem that are incorrectly installed, a wrong version, or a standalone
|
||||
// not connected to any module. In these cases, libraries_get_libraries()
|
||||
// provides a full library list. Libraries found by libraries_get_libraries(),
|
||||
// but not identified by libraries_detect, are displayed in a separate table.
|
||||
$libraries_unregistered = libraries_get_libraries();
|
||||
natcasesort($libraries_unregistered);
|
||||
|
||||
foreach ($libraries_registered as $machine_name => $library) {
|
||||
$actions = array();
|
||||
$row = array();
|
||||
|
||||
if ($library['vendor url']) {
|
||||
$actions[] = l('Homepage', $library['vendor url']);
|
||||
$actions[] = l(t('Homepage'), $library['vendor url']);
|
||||
}
|
||||
if ($library['download url']) {
|
||||
$actions[] = l('Download', $library['download url']);
|
||||
$actions[] = l(t('Download'), $library['download url']);
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
'data' => array(
|
||||
l($library['name'], 'admin/reports/libraries/' . $machine_name),
|
||||
($library['installed'] ? t('OK') : drupal_ucfirst($library['error'])),
|
||||
(isset($library['version']) ? $library['version'] : ''),
|
||||
libraries_admin_get_provider_with_type($library),
|
||||
implode(' | ', $actions),
|
||||
),
|
||||
'class' => ($library['installed'] ? array('ok') : array('error')),
|
||||
);
|
||||
$row['data'][] = l($library['name'], 'admin/reports/libraries/' . $machine_name);
|
||||
// Only show status for libraries with an error. See above.
|
||||
if (!$library['installed']) {
|
||||
$row['data'][] = drupal_ucfirst($library['error']);
|
||||
}
|
||||
$row['data'][] = isset($library['version']) ? $library['version'] : '';
|
||||
if ($library['installed']) {
|
||||
$row['data'][] = implode(', ', array_keys($library['variants']));
|
||||
}
|
||||
$row['data'][] = libraries_admin_get_dependencies($library);
|
||||
$row['data'][] = libraries_admin_get_provider_with_type($library);
|
||||
$row['data'][] = implode(' | ', $actions);
|
||||
$row['class'] = $library['installed'] ? array('ok') : array('warning');
|
||||
|
||||
if ($library['installed']) {
|
||||
$rows_installed[] = $row;
|
||||
}
|
||||
else {
|
||||
$rows_error[] = $row;
|
||||
}
|
||||
|
||||
// Filter registered libraries from unregistered libraries.
|
||||
unset($libraries_unregistered[$library['machine name']]);
|
||||
}
|
||||
|
||||
$form['libraries']['list'] = array(
|
||||
'#theme' => 'table',
|
||||
'#header' => $header,
|
||||
'#rows' => $rows,
|
||||
'#empty' => t('There are currently no libraries installed'),
|
||||
// Build table of registered libraries with installed status.
|
||||
$form['libraries']['installed'] = array(
|
||||
'#theme' => 'libraries_table_with_title',
|
||||
'#title' => t('Installed'),
|
||||
'#header' => $header_installed,
|
||||
'#rows' => $rows_installed,
|
||||
'#description' => t('These libraries are registered and installed correctly.'),
|
||||
'#empty' => t('There are currently no libraries that are registered and installed.'),
|
||||
);
|
||||
|
||||
// Build table of registered libraries with error status.
|
||||
$form['libraries']['error'] = array(
|
||||
'#theme' => 'libraries_table_with_title',
|
||||
'#title' => t('Uninstalled'),
|
||||
'#header' => $header_error,
|
||||
'#rows' => $rows_error,
|
||||
'#description' => t('These libraries are registered but not installed. They may not need to be installed in case a module or theme provides optional integration with a library.'),
|
||||
'#empty' => t('There are currently no libraries that are registered but not installed.'),
|
||||
);
|
||||
|
||||
// Build table of unregistered libraries.
|
||||
foreach ($libraries_unregistered as $name => $path) {
|
||||
$rows_unregistered[] = array(
|
||||
'data' => array(
|
||||
$name,
|
||||
$path,
|
||||
),
|
||||
);
|
||||
}
|
||||
$form['libraries']['unregistered'] = array(
|
||||
'#theme' => 'libraries_table_with_title',
|
||||
'#title' => t('Unregistered'),
|
||||
'#header' => $header_unregistered,
|
||||
'#rows' => $rows_unregistered,
|
||||
'#description' => t('These libraries were found in the filesystem but there is no metadata about them.'),
|
||||
// Do not show the table at all, if there are no unregistered libraries.
|
||||
'#access' => (bool) $libraries_unregistered,
|
||||
);
|
||||
|
||||
// Clear the cached library information so that the library can be loaded if
|
||||
// it was just downloaded. Because these instructions use libraries_detect()
|
||||
// directly, they will never use the cached information, but this avoids the
|
||||
// overview showing a library as installed but it not being loadable.
|
||||
libraries_cache_clear();
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
@@ -99,11 +170,11 @@ function libraries_admin_library_status_form(array $form, array &$form_state, $l
|
||||
break;
|
||||
|
||||
case 'missing dependency':
|
||||
$form['instructions']['instruction']['#markup'] = t('There a missing dependency in your configuration that prevent this library to work properly.') . '<br>';
|
||||
$form['instructions']['instruction']['#markup'] = t('There is a missing dependency in your configuration that prevents this library from working properly.') . '<br>';
|
||||
break;
|
||||
|
||||
case 'incompatible dependency':
|
||||
$form['instructions']['instruction']['#markup'] = t('There an incompatible dependency in your configuration that prevent this library to work properly.') . '<br>';
|
||||
$form['instructions']['instruction']['#markup'] = t('There is an incompatible dependency in your configuration that prevents this library from working properly.') . '<br>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -483,6 +554,28 @@ function libraries_admin_sort_title(array $a, array $b) {
|
||||
return strnatcasecmp($a['name'], $b['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the library's dependencies, if any.
|
||||
*
|
||||
* @param array $library
|
||||
* A library information array.
|
||||
*
|
||||
* @return string
|
||||
* The dependencies.
|
||||
*/
|
||||
function libraries_admin_get_dependencies($library) {
|
||||
$dependencies = array();
|
||||
foreach ($library['dependencies'] as $dependency_name) {
|
||||
if ($dependency = libraries_info($dependency_name)) {
|
||||
$dependencies[] = $dependency['name'];
|
||||
}
|
||||
else {
|
||||
$dependencies[] = $dependency_name;
|
||||
}
|
||||
}
|
||||
return implode(', ', $dependencies);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the library's provider.
|
||||
*
|
||||
|
@@ -47,6 +47,8 @@
|
||||
* Unless 'version' is declared or libraries_get_version() is being used as
|
||||
* a version callback, 'version callback' must be declared. In the latter
|
||||
* case, however, 'version arguments' must be declared in the specified way.
|
||||
* For libraries that provide a package.json file, use
|
||||
* 'libraries_get_package_json_version' as the version callback.
|
||||
* - version arguments: (optional) A list of arguments to pass to the version
|
||||
* callback. Version arguments can be declared either as an associative
|
||||
* array whose keys are the argument names or as an indexed array without
|
||||
|
@@ -23,7 +23,9 @@ function libraries_drush_command() {
|
||||
'arguments' => array(
|
||||
'libraries' => 'A comma delimited list of library machine names.',
|
||||
),
|
||||
'required-arguments' => TRUE,
|
||||
'options' => array(
|
||||
'all' => 'Download all registered libraries.',
|
||||
),
|
||||
);
|
||||
|
||||
return $items;
|
||||
@@ -42,10 +44,7 @@ function libraries_drush_cache_clear(array &$types) {
|
||||
* Clears the library cache.
|
||||
*/
|
||||
function libraries_drush_invalidate_cache() {
|
||||
// @see drupal_flush_all_caches()
|
||||
foreach (libraries_flush_caches() as $table) {
|
||||
cache_clear_all('*', $table, TRUE);
|
||||
}
|
||||
libraries_cache_clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,28 +108,61 @@ function drush_libraries_list() {
|
||||
function drush_libraries_download() {
|
||||
drush_command_include('pm-download');
|
||||
|
||||
$libraries = libraries_info();
|
||||
$all_libraries = libraries_detect();
|
||||
|
||||
// @todo Consider supporting downloading all downloadable libraries.
|
||||
// @todo Consider offering a selection if no library is specified.
|
||||
foreach (pm_parse_arguments(func_get_args(), FALSE) as $machine_name) {
|
||||
if (!isset($libraries[$machine_name])) {
|
||||
$message = dt("The !library library is not registered with Libraries API.\n", array('!library' => $machine_name));
|
||||
$message .= dt("Provide an info file for it or implement hook_libraries_info().\n");
|
||||
$message .= dt("See hook_libraries_info() for more information.\n");
|
||||
drush_set_error('DRUSH_LIBRARY_UKNOWN', $message);
|
||||
continue;
|
||||
// Prepare a list of names of downloadable libraries.
|
||||
$downloadable_names = array();
|
||||
foreach ($all_libraries as $machine_name => $library) {
|
||||
// Skip libraries that are already installed.
|
||||
// @todo Allow (optionally) re-downloading installing libraries.
|
||||
if (!empty($library['download file url']) && !$library['installed']) {
|
||||
$downloadable_names[] = $machine_name;
|
||||
}
|
||||
$library = $libraries[$machine_name];
|
||||
}
|
||||
|
||||
if (empty($library['download file url'])) {
|
||||
$message = dt("The !library library cannot be downloaded.\n", array('!library' => $machine_name));
|
||||
$message .= dt("Libraries need to specify a download file URL to support being downloaded via Drush.\n");
|
||||
$message .= dt("See hook_libraries_info() for more information.\n");
|
||||
drush_set_error('DRUSH_LIBRARY_NOT_DOWNLOADABLE', $message);
|
||||
continue;
|
||||
// Gather a list of libraries to download. If '--all' was specified, that
|
||||
// takes precedence over any other arguments. Otherwise and if no arguments
|
||||
// are specified, we present a choice of all downloadable libraries.
|
||||
if (drush_get_option('all', FALSE) && $downloadable_names) {
|
||||
$machine_names = $downloadable_names;
|
||||
}
|
||||
elseif (pm_parse_arguments(func_get_args(), FALSE)) {
|
||||
$machine_names = array();
|
||||
foreach (pm_parse_arguments(func_get_args(), FALSE) as $machine_name) {
|
||||
// If there was an error with with one of the libraries, continue to try
|
||||
// to install any remaining libraries.
|
||||
if (!isset($all_libraries[$machine_name])) {
|
||||
$message = dt("The !library library is not registered with Libraries API.\n", array('!library' => $machine_name));
|
||||
$message .= dt("Provide an info file for it or implement hook_libraries_info().\n");
|
||||
$message .= dt("See hook_libraries_info() for more information.\n");
|
||||
drush_set_error('DRUSH_LIBRARY_UKNOWN', $message);
|
||||
continue;
|
||||
}
|
||||
if (empty($all_libraries[$machine_name]['download file url'])) {
|
||||
$message = dt("The !library library cannot be downloaded.\n", array('!library' => $machine_name));
|
||||
$message .= dt("Libraries need to specify a download file URL to support being downloaded via Drush.\n");
|
||||
$message .= dt("See hook_libraries_info() for more information.\n");
|
||||
drush_set_error('DRUSH_LIBRARY_NOT_DOWNLOADABLE', $message);
|
||||
continue;
|
||||
}
|
||||
$machine_names[] = $machine_name;
|
||||
}
|
||||
$download_url = $library['download file url'];
|
||||
}
|
||||
elseif ($downloadable_names) {
|
||||
$machine_names = drush_choice_multiple(drupal_map_assoc($downloadable_names), FALSE, 'Select which libraries to download.');
|
||||
// If the operation was cancelled by the user, or if no libraries were
|
||||
// selected, bail out without any further error message.
|
||||
if (!$machine_names) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
drush_log(dt('There are no registered, uninstalled libraries that can be downloaded.'), 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($machine_names as $machine_name) {
|
||||
$download_url = $all_libraries[$machine_name]['download file url'];
|
||||
|
||||
drush_log(dt('Downloading library !name ...', array('!name' => $machine_name)));
|
||||
|
||||
@@ -205,7 +237,7 @@ function drush_libraries_download() {
|
||||
drush_delete_dir($install_location, TRUE);
|
||||
}
|
||||
else {
|
||||
drush_log(dt("Skip installation of !project to !dest.", array('!project' => $library['machine name'], '!dest' => $install_location)), 'warning');
|
||||
drush_log(dt("Skip installation of !project to !dest.", array('!project' => $machine_name, '!dest' => $install_location)), 'warning');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@@ -8,9 +8,8 @@ files[] = tests/LibrariesLoadWebTest.test
|
||||
files[] = tests/LibrariesUnitTest.test
|
||||
files[] = tests/LibrariesWebTestBase.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-05-12
|
||||
version = "7.x-2.3"
|
||||
; Information added by Drupal.org packaging script on 2018-10-05
|
||||
version = "7.x-2.5"
|
||||
core = "7.x"
|
||||
project = "libraries"
|
||||
datestamp = "1463077450"
|
||||
|
||||
datestamp = "1538770685"
|
||||
|
@@ -34,3 +34,13 @@ function libraries_update_7201() {
|
||||
// during the 7.x-2.x cycle.
|
||||
registry_rebuild();
|
||||
}
|
||||
|
||||
/**
|
||||
* Grant the "View library reports" permission to roles with the "View site reports" permission.
|
||||
*/
|
||||
function libraries_update_7202() {
|
||||
$rids = array_keys(user_roles(FALSE, 'access site reports'));
|
||||
foreach ($rids as $rid) {
|
||||
_update_7000_user_role_grant_permissions($rid, array('access library reports'), 'libraries');
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,29 @@ function libraries_flush_caches() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_admin_menu_cache_info().
|
||||
*/
|
||||
function libraries_admin_menu_cache_info() {
|
||||
$caches['libraries'] = array(
|
||||
'title' => t('Libraries'),
|
||||
'callback' => 'libraries_cache_clear',
|
||||
);
|
||||
return $caches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the cached library information.
|
||||
*/
|
||||
function libraries_cache_clear() {
|
||||
foreach (libraries_flush_caches() as $bin) {
|
||||
// Using the wildcard argument leads to DrupalDatabaseCache::clear()
|
||||
// truncating the libraries cache table which is more performant that
|
||||
// deleting the rows.
|
||||
cache_clear_all('*', $bin, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the path of a library.
|
||||
*
|
||||
@@ -56,6 +79,52 @@ function libraries_get_path($name, $base_path = FALSE) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all enabled themes.
|
||||
*
|
||||
* Themes are sorted so that base themes always precede their child themes.
|
||||
*
|
||||
* @return array
|
||||
* An associative array of theme objects keyed by theme name.
|
||||
*/
|
||||
function libraries_get_enabled_themes() {
|
||||
$themes = array();
|
||||
foreach (list_themes() as $name => $theme) {
|
||||
if ($theme->status) {
|
||||
$themes[$name] = $theme;
|
||||
}
|
||||
}
|
||||
|
||||
return libraries_sort_themes($themes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort a themes array.
|
||||
*
|
||||
* @param array $themes
|
||||
* Array of themes as objects, keyed by theme name.
|
||||
* @param string $base
|
||||
* A base theme (internal use only).
|
||||
*
|
||||
* @return array
|
||||
* A similar array to $themes, but sorted in such a way that subthemes are
|
||||
* always located after its base theme.
|
||||
*/
|
||||
function libraries_sort_themes($themes, $base = '') {
|
||||
$output = array();
|
||||
foreach ($themes as $name => $theme) {
|
||||
if (!isset($theme->base_theme) || $theme->base_theme == $base) {
|
||||
$output[$name] = $theme;
|
||||
unset($themes[$name]);
|
||||
$subthemes = libraries_sort_themes($themes, $name);
|
||||
foreach ($subthemes as $sub_name => $subtheme) {
|
||||
$output[$sub_name] = $subtheme;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of library directories.
|
||||
*
|
||||
@@ -77,6 +146,13 @@ function libraries_get_libraries() {
|
||||
$profile = drupal_get_path('profile', drupal_get_profile());
|
||||
$config = conf_path();
|
||||
|
||||
// $config and $profile should never be empty in a proper Drupal setup.
|
||||
// However, we should never search into the root filesystem under any
|
||||
// circumstances, so just bail out in that case.
|
||||
if (!$profile && !$config) {
|
||||
return array();
|
||||
}
|
||||
|
||||
// Similar to 'modules' and 'themes' directories in the root directory,
|
||||
// certain distributions may want to place libraries into a 'libraries'
|
||||
// directory in Drupal's root directory.
|
||||
@@ -358,10 +434,12 @@ function &libraries_info($name = NULL) {
|
||||
}
|
||||
}
|
||||
|
||||
// Gather information from hook_libraries_info() in enabled themes.
|
||||
// Gather information from hook_libraries_info() in enabled themes. Themes
|
||||
// are sorted to ensure that a base theme's template.php is included before
|
||||
// its children's ones.
|
||||
$themes = array();
|
||||
foreach (list_themes() as $theme_name => $theme_info) {
|
||||
if ($theme_info->status && file_exists(drupal_get_path('theme', $theme_name) . '/template.php')) {
|
||||
foreach (libraries_get_enabled_themes() as $theme_name => $theme_info) {
|
||||
if (file_exists(drupal_get_path('theme', $theme_name) . '/template.php')) {
|
||||
// Collect a list of viable themes for re-use when calling the alter
|
||||
// hook.
|
||||
$themes[] = $theme_name;
|
||||
@@ -546,7 +624,7 @@ function libraries_detect($name = NULL) {
|
||||
$library['version'] = call_user_func_array($library['version callback'], array_merge(array($library), $library['version arguments']));
|
||||
}
|
||||
else {
|
||||
$library['version'] = call_user_func($library['version callback'], $library, $library['version arguments']);
|
||||
$library['version'] = call_user_func_array($library['version callback'], array(&$library, $library['version arguments']));
|
||||
}
|
||||
if (empty($library['version'])) {
|
||||
$library['error'] = 'not detected';
|
||||
@@ -887,16 +965,56 @@ function libraries_get_version($library, $options) {
|
||||
fclose($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the version information from a library's package.json file.
|
||||
*
|
||||
* @param $library
|
||||
* An associative array containing all information about the library.
|
||||
* @param $options
|
||||
* This callback expects no option.
|
||||
* @return
|
||||
* A string containing the version of the library.
|
||||
*
|
||||
* @see libraries_get_path()
|
||||
*/
|
||||
function libraries_get_package_json_version($library, $options) {
|
||||
$file = DRUPAL_ROOT . '/' . $library['library path'] . '/package.json';
|
||||
if (!file_exists($file)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$content = file_get_contents($file);
|
||||
if (!$content) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = drupal_json_decode($content);
|
||||
if (isset($data['version'])) {
|
||||
return $data['version'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
function libraries_help($path, $arg) {
|
||||
switch ($path) {
|
||||
case 'admin/reports/libraries':
|
||||
return t('Click on a library for a status report or detailed installation instructions in case the library is not installed correctly.');
|
||||
return t('Click on a library for a status report or detailed installation instructions.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_permission().
|
||||
*/
|
||||
function libraries_permission() {
|
||||
return array(
|
||||
'access library reports' => array(
|
||||
'title' => t('View library reports'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
@@ -907,7 +1025,7 @@ function libraries_menu() {
|
||||
'description' => 'An overview of libraries installed on this site.',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('libraries_admin_overview'),
|
||||
'access arguments' => array('access site reports'),
|
||||
'access arguments' => array('access library reports'),
|
||||
'file' => 'libraries.admin.inc'
|
||||
);
|
||||
$items['admin/reports/libraries/%libraries_ui'] = array(
|
||||
@@ -915,7 +1033,7 @@ function libraries_menu() {
|
||||
'description' => 'Status overview for a single library',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('libraries_admin_library_status_form', 3),
|
||||
'access arguments' => array('access site reports'),
|
||||
'access arguments' => array('access library reports'),
|
||||
'file' => 'libraries.admin.inc'
|
||||
);
|
||||
return $items;
|
||||
@@ -944,3 +1062,19 @@ function libraries_menu() {
|
||||
function libraries_ui_load($name) {
|
||||
return libraries_detect($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_theme().
|
||||
*/
|
||||
function libraries_theme($existing, $type, $theme, $path) {
|
||||
// Because we extend the 'table' theme function, fetch the respective
|
||||
// variables dynamically.
|
||||
$common_theme = drupal_common_theme();
|
||||
$variables = $common_theme['table']['variables'] + array('title' => '', 'description' => '');
|
||||
return array(
|
||||
'libraries_table_with_title' => array(
|
||||
'variables' => $variables,
|
||||
'file' => 'libraries.theme.inc',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
36
sites/all/modules/contrib/dev/libraries/libraries.theme.inc
Normal file
36
sites/all/modules/contrib/dev/libraries/libraries.theme.inc
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides theme and preprocess functions for Libraries API.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepare variables for theming a table with a title.
|
||||
*
|
||||
* @param array $variables
|
||||
* An array of theme variables, passed by reference.
|
||||
*/
|
||||
function template_preprocess_libraries_table_with_title(&$variables) {
|
||||
drupal_add_css(drupal_get_path('module', 'libraries') . '/css/libraries.admin.css');
|
||||
|
||||
$variables['attributes'] += array('class' => array());
|
||||
$variables['attributes']['class'][] = 'libraries-table';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML for a table with a title.
|
||||
*
|
||||
* @param array $variables
|
||||
* An array theme variables.
|
||||
*
|
||||
* @return string
|
||||
* The HTML output for this table with a title.
|
||||
*/
|
||||
function theme_libraries_table_with_title(array $variables) {
|
||||
$output = '';
|
||||
$output .= '<h2>' . $variables['title'] . '</h2>';
|
||||
$output .= '<div class="description">' . $variables['description'] . '</div>';
|
||||
$output .= theme_table($variables);
|
||||
return $output;
|
||||
}
|
@@ -40,8 +40,20 @@ class LibrariesAdminWebTest extends LibrariesWebTestBase {
|
||||
* Tests the libraries report at /admin/reports/libraries.
|
||||
*/
|
||||
public function testLibrariesReportOverview() {
|
||||
$this->getWithPermissions(array('access site reports'), 'admin/reports/libraries');
|
||||
$this->assertRaw('Libraries');
|
||||
$this->getWithPermissions(array('access library reports'), 'admin/reports/libraries');
|
||||
// Assert the page title and table titles show up.
|
||||
$this->assertText('Libraries');
|
||||
$this->assertRaw('<h2>Installed</h2>');
|
||||
$this->assertRaw('<h2>Uninstalled</h2>');
|
||||
|
||||
// Make sure the table headings show up.
|
||||
$this->assertText('Name');
|
||||
$this->assertText('Status');
|
||||
$this->assertText('Version');
|
||||
$this->assertText('Variants');
|
||||
$this->assertText('Dependencies');
|
||||
$this->assertText('Provider');
|
||||
$this->assertText('Links');
|
||||
|
||||
// Make sure that all the libraries are listed.
|
||||
$libraries = libraries_info();
|
||||
@@ -51,8 +63,7 @@ class LibrariesAdminWebTest extends LibrariesWebTestBase {
|
||||
$this->assertLinkByHref('admin/reports/libraries/' . $library['machine name']);
|
||||
}
|
||||
|
||||
// Make sure that all possible statuses are displayed.
|
||||
$this->assertText('OK');
|
||||
// Make sure that all possible error statuses are displayed.
|
||||
$this->assertText('Not found');
|
||||
$this->assertText('Not detected');
|
||||
$this->assertText('Not supported');
|
||||
@@ -73,7 +84,7 @@ class LibrariesAdminWebTest extends LibrariesWebTestBase {
|
||||
* Tests the libraries report for an installed library.
|
||||
*/
|
||||
public function testLibrariesReportInstalled() {
|
||||
$this->getWithPermissions(array('access site reports'), 'admin/reports/libraries/example_files');
|
||||
$this->getWithPermissions(array('access library reports'), 'admin/reports/libraries/example_files');
|
||||
$this->assertRaw('Status report for library <em class="placeholder">Example files</em>');
|
||||
$this->assertRaw('The <em class="placeholder">Example files</em> library is installed correctly.');
|
||||
// Check that the information in the status report is displayed.
|
||||
@@ -88,7 +99,7 @@ class LibrariesAdminWebTest extends LibrariesWebTestBase {
|
||||
* Tests the libraries report for a missing library.
|
||||
*/
|
||||
public function testLibrariesReportMissing() {
|
||||
$this->getWithPermissions(array('access site reports'), 'admin/reports/libraries/example_missing');
|
||||
$this->getWithPermissions(array('access library reports'), 'admin/reports/libraries/example_missing');
|
||||
$this->assertRaw('Status report for library <em class="placeholder">Example missing</em>');
|
||||
$this->assertRaw('The <em class="placeholder">Example missing</em> library could not be found.');
|
||||
// Check that the download link is being displayed.
|
||||
@@ -100,7 +111,7 @@ class LibrariesAdminWebTest extends LibrariesWebTestBase {
|
||||
* Tests the libraries report for a missing library.
|
||||
*/
|
||||
public function testLibrariesReportNotDetected() {
|
||||
$this->getWithPermissions(array('access site reports'), 'admin/reports/libraries/example_undetected_version');
|
||||
$this->getWithPermissions(array('access library reports'), 'admin/reports/libraries/example_undetected_version');
|
||||
$this->assertRaw('Status report for library <em class="placeholder">Example undetected version</em>');
|
||||
$this->assertRaw('The version of the <em class="placeholder">Example undetected version</em> library could not be detected.');
|
||||
}
|
||||
@@ -109,7 +120,7 @@ class LibrariesAdminWebTest extends LibrariesWebTestBase {
|
||||
* Tests the libraries report for a missing library.
|
||||
*/
|
||||
public function testLibrariesReportNotSupported() {
|
||||
$this->getWithPermissions(array('access site reports'), 'admin/reports/libraries/example_unsupported_version');
|
||||
$this->getWithPermissions(array('access library reports'), 'admin/reports/libraries/example_unsupported_version');
|
||||
$this->assertRaw('Status report for library <em class="placeholder">Example unsupported version</em>');
|
||||
$this->assertRaw('The installed version <em class="placeholder">1</em> of the <em class="placeholder">Example unsupported version</em> library is not supported.');
|
||||
// Check that the download link is being displayed.
|
||||
|
@@ -2,9 +2,8 @@
|
||||
name = Example info file
|
||||
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-05-12
|
||||
version = "7.x-2.3"
|
||||
; Information added by Drupal.org packaging script on 2018-10-05
|
||||
version = "7.x-2.5"
|
||||
core = "7.x"
|
||||
project = "libraries"
|
||||
datestamp = "1463077450"
|
||||
|
||||
datestamp = "1538770685"
|
||||
|
@@ -5,9 +5,8 @@ package = Testing
|
||||
dependencies[] = libraries
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-05-12
|
||||
version = "7.x-2.3"
|
||||
; Information added by Drupal.org packaging script on 2018-10-05
|
||||
version = "7.x-2.5"
|
||||
core = "7.x"
|
||||
project = "libraries"
|
||||
datestamp = "1463077450"
|
||||
|
||||
datestamp = "1538770685"
|
||||
|
@@ -3,9 +3,8 @@ description = Tests that themes can provide and alter library information.
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-05-12
|
||||
version = "7.x-2.3"
|
||||
; Information added by Drupal.org packaging script on 2018-10-05
|
||||
version = "7.x-2.5"
|
||||
core = "7.x"
|
||||
project = "libraries"
|
||||
datestamp = "1463077450"
|
||||
|
||||
datestamp = "1538770685"
|
||||
|
Reference in New Issue
Block a user