function drush_yamlform_libraries_remove in YAML Form 8
Implements drush_hook_COMMAND().
1 call to drush_yamlform_libraries_remove()
- drush_yamlform_libraries_download in drush/
yamlform.drush.inc - Implements drush_hook_COMMAND().
File
- drush/
yamlform.drush.inc, line 440 - YAML Form module drush commands.
Code
function drush_yamlform_libraries_remove($status = TRUE) {
if ($status) {
drush_print(dt('Beginning to remove libraries...'));
}
$removed = FALSE;
/** @var \Drupal\yamlform\YamlFormLibrariesManagerInterface $libraries_manager */
$libraries_manager = \Drupal::service('yamlform.libraries_manager');
$libraries = $libraries_manager
->getLibraries();
foreach ($libraries as $library_name => $library) {
$library_path = '/' . $library['destination'] . '/' . $library['directory_name'];
$library_exists = file_exists(DRUPAL_ROOT . $library_path) ? TRUE : FALSE;
if ($library_exists) {
$t_args = [
'@name' => $library_name,
'@path' => $library_path,
];
if ($status) {
drush_print(dt('@name removed from @path...', $t_args));
drush_delete_dir(DRUPAL_ROOT . $library_path, TRUE);
}
$removed = TRUE;
}
}
if ($status) {
drupal_flush_all_caches();
}
return $removed;
}