1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- use Drupal\Core\Config\FileStorage;
- use Drupal\Core\Config\InstallStorage;
- use Drupal\views\Entity\View;
- function dblog_post_update_convert_recent_messages_to_view() {
-
-
- if (\Drupal::moduleHandler()->moduleExists('views')) {
- if (!View::load('watchdog')) {
-
- $module_handler = \Drupal::moduleHandler();
- $optional_install_path = $module_handler->getModule('dblog')->getPath() . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY;
- $storage = new FileStorage($optional_install_path);
- \Drupal::entityTypeManager()
- ->getStorage('view')
- ->create($storage->read('views.view.watchdog'))
- ->save();
- return t('The watchdog view has been created.');
- }
- return t("The watchdog view already exists and was not replaced. To replace the 'Recent log messages' with a view, rename the watchdog view and uninstall and install the 'Database Log' module");
- }
- }
|