Skip to content
Snippets Groups Projects

Issue #3200972: Add checks for 3rd party libraries on Status page.

Issue #3200972: Add checks for 3rd party libraries on Status page.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1302 foreach (array_keys(\Drupal::moduleHandler()->getModuleList()) as $module_name) {
1303 $libraries = \Drupal::service('library.discovery')->getLibrariesByExtension($module_name);
1304 foreach ($libraries as $library_name => $library) {
1305 foreach ($library['js'] as $js_array) {
1306 if ($js_array['type'] === 'file' && strpos($js_array['data'], 'libraries/') === 0) {
1307 if (!file_exists(\Drupal::root() . DIRECTORY_SEPARATOR . $js_array['data'])) {
1308 $requirements[$module_name . '_' . $library_name] = [
1309 'title' => t('@module javascript libraries', ['@module' => $module_name]),
1310 'value' => t('Not installed'),
1311 'severity' => REQUIREMENT_ERROR,
1312 'description' => t('You are missing one or several required javascript files from @library library. Please check @module module README about how to install them.', ['@library' => $library_name, '@module' => $module_name]),
1313 ];
1314 break;
1315 }
1316 }
1317 }
  • Comment on lines +1305 to +1317
    • There are other supported libraries dirs, e.g. sites/default/libraries. We should probably skip the strpos check and use \Drupal\Core\Asset\LibrariesDirectoryFileFinder::find instead of file_exists
    • Should we also collate all the libraries that have missing files and combine them in to a single requirement?
    • What about css files?
    • I think we should rewrite this to use array_any, it's cleaner than breaking out of the foreach loop.
  • Please register or sign in to reply
Please register or sign in to reply
Loading