Пример #1
0
function update_script_selection_form()
{
    $form = array();
    $count = 0;
    $form['start'] = array('#tree' => TRUE, '#type' => 'fieldset', '#collapsed' => TRUE, '#collapsible' => TRUE);
    // Ensure system.module's updates appear first
    $form['start']['system'] = array();
    $modules = drupal_get_installed_schema_version(NULL, FALSE, TRUE);
    foreach ($modules as $module => $schema_version) {
        $pending = array();
        $updates = drupal_get_schema_versions($module);
        // Skip incompatible module updates completely, otherwise test schema versions.
        if (!update_check_incompatibility($module) && $updates !== FALSE && $schema_version >= 0) {
            // module_invoke returns NULL for nonexisting hooks, so if no updates
            // are removed, it will == 0.
            $last_removed = module_invoke($module, 'update_last_removed');
            if ($schema_version < $last_removed) {
                $form['start'][$module] = array('#title' => $module, '#item' => '<em>' . $module . '</em> module can not be updated. Its schema version is ' . $schema_version . '. Updates up to and including ' . $last_removed . ' have been removed in this release. In order to update <em>' . $module . '</em> module, you will first <a href="http://drupal.org/upgrade">need to upgrade</a> to the last version in which these updates were available.', '#prefix' => '<div class="warning">', '#suffix' => '</div>');
                continue;
            }
            $updates = drupal_map_assoc($updates);
            foreach (array_keys($updates) as $update) {
                if ($update > $schema_version) {
                    // The description for an update comes from its Doxygen.
                    $func = new ReflectionFunction($module . '_update_' . $update);
                    $description = str_replace(array("\n", '*', '/'), '', $func->getDocComment());
                    $pending[] = "{$update} - {$description}";
                    if (!isset($default)) {
                        $default = $update;
                    }
                }
            }
            if (!empty($pending)) {
                if (!isset($default)) {
                    $default = $schema_version;
                }
                $form['start'][$module] = array('#type' => 'hidden', '#value' => $default);
                $form['start'][$module . '_updates'] = array('#markup' => theme('item_list', $pending, $module . ' module'));
            }
        }
        unset($default);
        $count = $count + count($pending);
    }
    if (empty($count)) {
        drupal_set_message(t('No pending updates.'));
        unset($form);
        $form['links'] = array('#markup' => theme('item_list', update_helpful_links()));
    } else {
        $form['help'] = array('#markup' => '<p>The version of Drupal you are updating from has been automatically detected.</p>', '#weight' => -5);
        $form['start']['#title'] = strtr('!num pending updates', array('!num' => $count));
        $form['has_js'] = array('#type' => 'hidden', '#default_value' => FALSE);
        $form['submit'] = array('#type' => 'submit', '#value' => 'Apply pending updates');
    }
    return $form;
}
Пример #2
0
 protected function getLastUpdate($module)
 {
     $this->getDrupalHelper()->loadLegacyFile('/core/includes/update.inc');
     $this->getDrupalHelper()->loadLegacyFile('/core/includes/schema.inc');
     $updates = update_get_update_list();
     if (empty($updates[$module]['pending'])) {
         $lastUpdateSchema = drupal_get_schema_versions($module);
     } else {
         $lastUpdateSchema = reset(array_keys($updates[$module]['pending'], max($updates[$module]['pending'])));
     }
     return $lastUpdateSchema;
 }
Пример #3
0
 /**
  * Returns available database schema updates once a new version is installed.
  *
  * @return array
  */
 public function getSchemaUpdates()
 {
     require_once DRUPAL_ROOT . '/core/includes/install.inc';
     require_once DRUPAL_ROOT . '/core/includes/update.inc';
     if (!self::canUpdate($this->name)) {
         return array();
     }
     module_load_include('install', $this->name);
     if (!($updates = drupal_get_schema_versions($this->name))) {
         return array();
     }
     $modules_with_updates = update_get_update_list();
     if ($updates = $modules_with_updates[$this->name]) {
         if ($updates['start']) {
             return $updates['pending'];
         }
     }
     return array();
 }
Пример #4
0
function update_batch()
{
    global $base_url;
    $operations = array();
    // Set the installed version so updates start at the correct place.
    foreach ($_POST['start'] as $module => $version) {
        drupal_set_installed_schema_version($module, $version - 1);
        $updates = drupal_get_schema_versions($module);
        $max_version = max($updates);
        if ($version <= $max_version) {
            foreach ($updates as $update) {
                if ($update >= $version) {
                    $operations[] = array('update_do_one', array($module, $update));
                }
            }
        }
    }
    $batch = array('operations' => $operations, 'title' => 'Updating', 'init_message' => 'Starting updates', 'error_message' => 'An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference.', 'finished' => 'update_finished');
    batch_set($batch);
    batch_process($base_url . '/update.php?op=results', $base_url . '/update.php');
}
 /**
  * {@inheritdoc}
  */
 public function install(array $module_list, $enable_dependencies = TRUE)
 {
     $extension_config = \Drupal::config('core.extension');
     if ($enable_dependencies) {
         // Get all module data so we can find dependencies and sort.
         $module_data = system_rebuild_module_data();
         $module_list = $module_list ? array_combine($module_list, $module_list) : array();
         if (array_diff_key($module_list, $module_data)) {
             // One or more of the given modules doesn't exist.
             return FALSE;
         }
         // Only process currently uninstalled modules.
         $installed_modules = $extension_config->get('module') ?: array();
         if (!($module_list = array_diff_key($module_list, $installed_modules))) {
             // Nothing to do. All modules already installed.
             return TRUE;
         }
         // Add dependencies to the list. The new modules will be processed as
         // the while loop continues.
         while (list($module) = each($module_list)) {
             foreach (array_keys($module_data[$module]->requires) as $dependency) {
                 if (!isset($module_data[$dependency])) {
                     // The dependency does not exist.
                     return FALSE;
                 }
                 // Skip already installed modules.
                 if (!isset($module_list[$dependency]) && !isset($installed_modules[$dependency])) {
                     $module_list[$dependency] = $dependency;
                 }
             }
         }
         // Set the actual module weights.
         $module_list = array_map(function ($module) use($module_data) {
             return $module_data[$module]->sort;
         }, $module_list);
         // Sort the module list by their weights (reverse).
         arsort($module_list);
         $module_list = array_keys($module_list);
     }
     // Required for module installation checks.
     include_once DRUPAL_ROOT . '/core/includes/install.inc';
     /** @var \Drupal\Core\Config\ConfigInstaller $config_installer */
     $config_installer = \Drupal::service('config.installer');
     $sync_status = $config_installer->isSyncing();
     if ($sync_status) {
         $source_storage = $config_installer->getSourceStorage();
     }
     $modules_installed = array();
     foreach ($module_list as $module) {
         $enabled = $extension_config->get("module.{$module}") !== NULL;
         if (!$enabled) {
             // Throw an exception if the module name is too long.
             if (strlen($module) > DRUPAL_EXTENSION_NAME_MAX_LENGTH) {
                 throw new ExtensionNameLengthException(format_string('Module name %name is over the maximum allowed length of @max characters.', array('%name' => $module, '@max' => DRUPAL_EXTENSION_NAME_MAX_LENGTH)));
             }
             $extension_config->set("module.{$module}", 0)->set('module', module_config_sort($extension_config->get('module')))->save();
             // Prepare the new module list, sorted by weight, including filenames.
             // This list is used for both the ModuleHandler and DrupalKernel. It
             // needs to be kept in sync between both. A DrupalKernel reboot or
             // rebuild will automatically re-instantiate a new ModuleHandler that
             // uses the new module list of the kernel. However, DrupalKernel does
             // not cause any modules to be loaded.
             // Furthermore, the currently active (fixed) module list can be
             // different from the configured list of enabled modules. For all active
             // modules not contained in the configured enabled modules, we assume a
             // weight of 0.
             $current_module_filenames = $this->getModuleList();
             $current_modules = array_fill_keys(array_keys($current_module_filenames), 0);
             $current_modules = module_config_sort(array_merge($current_modules, $extension_config->get('module')));
             $module_filenames = array();
             foreach ($current_modules as $name => $weight) {
                 if (isset($current_module_filenames[$name])) {
                     $module_filenames[$name] = $current_module_filenames[$name];
                 } else {
                     $module_path = drupal_get_path('module', $name);
                     $pathname = "{$module_path}/{$name}.info.yml";
                     $filename = file_exists($module_path . "/{$name}.module") ? "{$name}.module" : NULL;
                     $module_filenames[$name] = new Extension('module', $pathname, $filename);
                 }
             }
             // Update the module handler in order to load the module's code.
             // This allows the module to participate in hooks and its existence to
             // be discovered by other modules.
             // The current ModuleHandler instance is obsolete with the kernel
             // rebuild below.
             $this->setModuleList($module_filenames);
             $this->load($module);
             module_load_install($module);
             // Clear the static cache of system_rebuild_module_data() to pick up the
             // new module, since it merges the installation status of modules into
             // its statically cached list.
             drupal_static_reset('system_rebuild_module_data');
             // Update the kernel to include it.
             // This reboots the kernel to register the module's bundle and its
             // services in the service container. The $module_filenames argument is
             // taken over as %container.modules% parameter, which is passed to a
             // fresh ModuleHandler instance upon first retrieval.
             // @todo install_begin_request() creates a container without a kernel.
             if ($kernel = \Drupal::service('kernel', ContainerInterface::NULL_ON_INVALID_REFERENCE)) {
                 $kernel->updateModules($module_filenames, $module_filenames);
             }
             // Refresh the schema to include it.
             drupal_get_schema(NULL, TRUE);
             // Allow modules to react prior to the installation of a module.
             $this->invokeAll('module_preinstall', array($module));
             // Now install the module's schema if necessary.
             drupal_install_schema($module);
             // Clear plugin manager caches and flag router to rebuild if requested.
             \Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();
             \Drupal::service('router.builder_indicator')->setRebuildNeeded();
             // Set the schema version to the number of the last update provided by
             // the module, or the minimum core schema version.
             $version = \Drupal::CORE_MINIMUM_SCHEMA_VERSION;
             $versions = drupal_get_schema_versions($module);
             if ($versions) {
                 $version = max(max($versions), $version);
             }
             // Notify the entity manager that this module's entity types are new,
             // so that it can notify all interested handlers. For example, a
             // SQL-based storage handler can use this as an opportunity to create
             // the necessary database tables.
             $entity_manager = \Drupal::entityManager();
             foreach ($entity_manager->getDefinitions() as $entity_type) {
                 if ($entity_type->getProvider() == $module) {
                     $entity_manager->onEntityTypeCreate($entity_type);
                 }
             }
             // Install default configuration of the module.
             $config_installer = \Drupal::service('config.installer');
             if ($sync_status) {
                 $config_installer->setSyncing(TRUE)->setSourceStorage($source_storage);
             } else {
                 // If we're not in a config synchronisation reset the source storage
                 // so that the extension install storage will pick up the new
                 // configuration.
                 $config_installer->resetSourceStorage();
             }
             \Drupal::service('config.installer')->installDefaultConfig('module', $module);
             // If the module has no current updates, but has some that were
             // previously removed, set the version to the value of
             // hook_update_last_removed().
             if ($last_removed = $this->invoke($module, 'update_last_removed')) {
                 $version = max($version, $last_removed);
             }
             drupal_set_installed_schema_version($module, $version);
             // Record the fact that it was installed.
             $modules_installed[] = $module;
             // file_get_stream_wrappers() needs to re-register Drupal's stream
             // wrappers in case a module-provided stream wrapper is used later in
             // the same request. In particular, this happens when installing Drupal
             // via Drush, as the 'translations' stream wrapper is provided by
             // Interface Translation module and is later used to import
             // translations.
             \Drupal::service('stream_wrapper_manager')->register();
             // Update the theme registry to include it.
             drupal_theme_rebuild();
             // Modules can alter theme info, so refresh theme data.
             // @todo ThemeHandler cannot be injected into ModuleHandler, since that
             //   causes a circular service dependency.
             // @see https://drupal.org/node/2208429
             \Drupal::service('theme_handler')->refreshInfo();
             // Allow the module to perform install tasks.
             $this->invoke($module, 'install');
             // Record the fact that it was installed.
             \Drupal::logger('system')->info('%module module installed.', array('%module' => $module));
         }
     }
     // If any modules were newly installed, invoke hook_modules_installed().
     if (!empty($modules_installed)) {
         $this->invokeAll('modules_installed', array($modules_installed));
     }
     return TRUE;
 }
Пример #6
0
function update_batch()
{
    global $base_url;
    // During the update, toggle site maintenance so that schema changes do not
    // affect visiting users.
    $_SESSION['site_offline'] = variable_get('site_offline', FALSE);
    if ($_SESSION['site_offline'] == FALSE) {
        variable_set('site_offline', TRUE);
    }
    $operations = array();
    // Set the installed version so updates start at the correct place.
    foreach ($_POST['start'] as $module => $version) {
        drupal_set_installed_schema_version($module, $version - 1);
        $updates = drupal_get_schema_versions($module);
        $max_version = max($updates);
        if ($version <= $max_version) {
            foreach ($updates as $update) {
                if ($update >= $version) {
                    $operations[] = array('update_do_one', array($module, $update));
                }
            }
        }
    }
    $batch = array('operations' => $operations, 'title' => 'Updating', 'init_message' => 'Starting updates', 'error_message' => 'An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference.', 'finished' => 'update_finished');
    batch_set($batch);
    batch_process($base_url . '/update.php?op=results', $base_url . '/update.php');
}
Пример #7
0
function update_update_page()
{
    // Set the installed version so updates start at the correct place.
    foreach ($_POST['start'] as $module => $version) {
        drupal_set_installed_schema_version($module, $version - 1);
        $updates = drupal_get_schema_versions($module);
        $max_version = max($updates);
        if ($version <= $max_version) {
            foreach ($updates as $update) {
                if ($update >= $version) {
                    $_SESSION['update_remaining'][] = array('module' => $module, 'version' => $update);
                }
            }
        }
    }
    // Keep track of total number of updates
    $_SESSION['update_total'] = count($_SESSION['update_remaining']);
    if ($_POST['has_js']) {
        return update_progress_page();
    } else {
        return update_progress_page_nojs();
    }
}
Пример #8
0
 /**
  * {@inheritdoc}
  */
 public function install(array $module_list, $enable_dependencies = TRUE)
 {
     $extension_config = \Drupal::configFactory()->getEditable('core.extension');
     if ($enable_dependencies) {
         // Get all module data so we can find dependencies and sort.
         $module_data = system_rebuild_module_data();
         $module_list = $module_list ? array_combine($module_list, $module_list) : array();
         if ($missing_modules = array_diff_key($module_list, $module_data)) {
             // One or more of the given modules doesn't exist.
             throw new MissingDependencyException(sprintf('Unable to install modules %s due to missing modules %s.', implode(', ', $module_list), implode(', ', $missing_modules)));
         }
         // Only process currently uninstalled modules.
         $installed_modules = $extension_config->get('module') ?: array();
         if (!($module_list = array_diff_key($module_list, $installed_modules))) {
             // Nothing to do. All modules already installed.
             return TRUE;
         }
         // Add dependencies to the list. The new modules will be processed as
         // the while loop continues.
         while (list($module) = each($module_list)) {
             foreach (array_keys($module_data[$module]->requires) as $dependency) {
                 if (!isset($module_data[$dependency])) {
                     // The dependency does not exist.
                     throw new MissingDependencyException("Unable to install modules: module '{$module}' is missing its dependency module {$dependency}.");
                 }
                 // Skip already installed modules.
                 if (!isset($module_list[$dependency]) && !isset($installed_modules[$dependency])) {
                     $module_list[$dependency] = $dependency;
                 }
             }
         }
         // Set the actual module weights.
         $module_list = array_map(function ($module) use($module_data) {
             return $module_data[$module]->sort;
         }, $module_list);
         // Sort the module list by their weights (reverse).
         arsort($module_list);
         $module_list = array_keys($module_list);
     }
     // Required for module installation checks.
     include_once $this->root . '/core/includes/install.inc';
     /** @var \Drupal\Core\Config\ConfigInstaller $config_installer */
     $config_installer = \Drupal::service('config.installer');
     $sync_status = $config_installer->isSyncing();
     if ($sync_status) {
         $source_storage = $config_installer->getSourceStorage();
     }
     $modules_installed = array();
     foreach ($module_list as $module) {
         $enabled = $extension_config->get("module.{$module}") !== NULL;
         if (!$enabled) {
             // Throw an exception if the module name is too long.
             if (strlen($module) > DRUPAL_EXTENSION_NAME_MAX_LENGTH) {
                 throw new ExtensionNameLengthException("Module name '{$module}' is over the maximum allowed length of " . DRUPAL_EXTENSION_NAME_MAX_LENGTH . ' characters');
             }
             // Check the validity of the default configuration. This will throw
             // exceptions if the configuration is not valid.
             $config_installer->checkConfigurationToInstall('module', $module);
             // Save this data without checking schema. This is a performance
             // improvement for module installation.
             $extension_config->set("module.{$module}", 0)->set('module', module_config_sort($extension_config->get('module')))->save(TRUE);
             // Prepare the new module list, sorted by weight, including filenames.
             // This list is used for both the ModuleHandler and DrupalKernel. It
             // needs to be kept in sync between both. A DrupalKernel reboot or
             // rebuild will automatically re-instantiate a new ModuleHandler that
             // uses the new module list of the kernel. However, DrupalKernel does
             // not cause any modules to be loaded.
             // Furthermore, the currently active (fixed) module list can be
             // different from the configured list of enabled modules. For all active
             // modules not contained in the configured enabled modules, we assume a
             // weight of 0.
             $current_module_filenames = $this->moduleHandler->getModuleList();
             $current_modules = array_fill_keys(array_keys($current_module_filenames), 0);
             $current_modules = module_config_sort(array_merge($current_modules, $extension_config->get('module')));
             $module_filenames = array();
             foreach ($current_modules as $name => $weight) {
                 if (isset($current_module_filenames[$name])) {
                     $module_filenames[$name] = $current_module_filenames[$name];
                 } else {
                     $module_path = drupal_get_path('module', $name);
                     $pathname = "{$module_path}/{$name}.info.yml";
                     $filename = file_exists($module_path . "/{$name}.module") ? "{$name}.module" : NULL;
                     $module_filenames[$name] = new Extension($this->root, 'module', $pathname, $filename);
                 }
             }
             // Update the module handler in order to load the module's code.
             // This allows the module to participate in hooks and its existence to
             // be discovered by other modules.
             // The current ModuleHandler instance is obsolete with the kernel
             // rebuild below.
             $this->moduleHandler->setModuleList($module_filenames);
             $this->moduleHandler->load($module);
             module_load_install($module);
             // Clear the static cache of system_rebuild_module_data() to pick up the
             // new module, since it merges the installation status of modules into
             // its statically cached list.
             drupal_static_reset('system_rebuild_module_data');
             // Update the kernel to include it.
             $this->updateKernel($module_filenames);
             // Allow modules to react prior to the installation of a module.
             $this->moduleHandler->invokeAll('module_preinstall', array($module));
             // Now install the module's schema if necessary.
             drupal_install_schema($module);
             // Clear plugin manager caches.
             \Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();
             // Set the schema version to the number of the last update provided by
             // the module, or the minimum core schema version.
             $version = \Drupal::CORE_MINIMUM_SCHEMA_VERSION;
             $versions = drupal_get_schema_versions($module);
             if ($versions) {
                 $version = max(max($versions), $version);
             }
             // Notify interested components that this module's entity types and
             // field storage definitions are new. For example, a SQL-based storage
             // handler can use this as an opportunity to create the necessary
             // database tables.
             // @todo Clean this up in https://www.drupal.org/node/2350111.
             $entity_manager = \Drupal::entityManager();
             $update_manager = \Drupal::entityDefinitionUpdateManager();
             foreach ($entity_manager->getDefinitions() as $entity_type) {
                 if ($entity_type->getProvider() == $module) {
                     $update_manager->installEntityType($entity_type);
                 } elseif ($entity_type->isSubclassOf(FieldableEntityInterface::CLASS)) {
                     // The module being installed may be adding new fields to existing
                     // entity types. Field definitions for any entity type defined by
                     // the module are handled in the if branch.
                     foreach ($entity_manager->getFieldStorageDefinitions($entity_type->id()) as $storage_definition) {
                         if ($storage_definition->getProvider() == $module) {
                             // If the module being installed is also defining a storage key
                             // for the entity type, the entity schema may not exist yet. It
                             // will be created later in that case.
                             try {
                                 $update_manager->installFieldStorageDefinition($storage_definition->getName(), $entity_type->id(), $module, $storage_definition);
                             } catch (EntityStorageException $e) {
                                 watchdog_exception('system', $e, 'An error occurred while notifying the creation of the @name field storage definition: "!message" in %function (line %line of %file).', ['@name' => $storage_definition->getName()]);
                             }
                         }
                     }
                 }
             }
             // Install default configuration of the module.
             $config_installer = \Drupal::service('config.installer');
             if ($sync_status) {
                 $config_installer->setSyncing(TRUE)->setSourceStorage($source_storage);
             }
             \Drupal::service('config.installer')->installDefaultConfig('module', $module);
             // If the module has no current updates, but has some that were
             // previously removed, set the version to the value of
             // hook_update_last_removed().
             if ($last_removed = $this->moduleHandler->invoke($module, 'update_last_removed')) {
                 $version = max($version, $last_removed);
             }
             drupal_set_installed_schema_version($module, $version);
             // Ensure that all post_update functions are registered already.
             /** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */
             $post_update_registry = \Drupal::service('update.post_update_registry');
             $post_update_registry->registerInvokedUpdates($post_update_registry->getModuleUpdateFunctions($module));
             // Record the fact that it was installed.
             $modules_installed[] = $module;
             // Drupal's stream wrappers needs to be re-registered in case a
             // module-provided stream wrapper is used later in the same request. In
             // particular, this happens when installing Drupal via Drush, as the
             // 'translations' stream wrapper is provided by Interface Translation
             // module and is later used to import translations.
             \Drupal::service('stream_wrapper_manager')->register();
             // Update the theme registry to include it.
             drupal_theme_rebuild();
             // Modules can alter theme info, so refresh theme data.
             // @todo ThemeHandler cannot be injected into ModuleHandler, since that
             //   causes a circular service dependency.
             // @see https://www.drupal.org/node/2208429
             \Drupal::service('theme_handler')->refreshInfo();
             // In order to make uninstalling transactional if anything uses routes.
             \Drupal::getContainer()->set('router.route_provider.old', \Drupal::service('router.route_provider'));
             \Drupal::getContainer()->set('router.route_provider', \Drupal::service('router.route_provider.lazy_builder'));
             // Allow the module to perform install tasks.
             $this->moduleHandler->invoke($module, 'install');
             // Record the fact that it was installed.
             \Drupal::logger('system')->info('%module module installed.', array('%module' => $module));
         }
     }
     // If any modules were newly installed, invoke hook_modules_installed().
     if (!empty($modules_installed)) {
         \Drupal::getContainer()->set('router.route_provider', \Drupal::service('router.route_provider.old'));
         if (!\Drupal::service('router.route_provider.lazy_builder')->hasRebuilt()) {
             // Rebuild routes after installing module. This is done here on top of
             // \Drupal\Core\Routing\RouteBuilder::destruct to not run into errors on
             // fastCGI which executes ::destruct() after the module installation
             // page was sent already.
             \Drupal::service('router.builder')->rebuild();
         }
         $this->moduleHandler->invokeAll('modules_installed', array($modules_installed));
     }
     return TRUE;
 }
 /**
  * Gather site profile information about this site.
  *
  * @param string $method
  *   Optional identifier for the method initiating request.
  *   Values could be 'cron' or 'menu callback' or 'drush'.
  *
  * @return array
  *   An associative array keyed by types of information.
  */
 public function get($method = '')
 {
     // Get file hashes and compute serialized version.
     list($hashes, $fileinfo) = $this->getFileHashes();
     $hashes_string = serialize($hashes);
     // Get the Drupal version
     $drupal_version = $this->getVersionInfo();
     $stored = $this->dataStoreGet(array('platform'));
     if (!empty($stored['platform'])) {
         $platform = $stored['platform'];
     } else {
         $platform = $this->getPlatform();
     }
     $spi = array('rpc_version' => ACQUIA_SPI_DATA_VERSION, 'spi_data_version' => ACQUIA_SPI_DATA_VERSION, 'site_key' => sha1(\Drupal::service('private_key')->get()), 'modules' => $this->getModules(), 'platform' => $platform, 'quantum' => $this->getQuantum(), 'system_status' => $this->getSystemStatus(), 'failed_logins' => $this->config('acquia_connector.settings')->get('spi.send_watchdog') ? $this->getFailedLogins() : array(), '404s' => $this->config('acquia_connector.settings')->get('spi.send_watchdog') ? $this->get404s() : array(), 'watchdog_size' => $this->getWatchdogSize(), 'watchdog_data' => $this->config('acquia_connector.settings')->get('spi.send_watchdog') ? $this->getWatchdogData() : array(), 'last_nodes' => $this->config('acquia_connector.settings')->get('spi.send_node_user') ? $this->getLastNodes() : array(), 'last_users' => $this->config('acquia_connector.settings')->get('spi.send_node_user') ? $this->getLastUsers() : array(), 'extra_files' => $this->checkFilesPresent(), 'ssl_login' => $this->checkLogin(), 'file_hashes' => $hashes, 'hashes_md5' => md5($hashes_string), 'hashes_sha1' => sha1($hashes_string), 'fileinfo' => $fileinfo, 'distribution' => isset($drupal_version['distribution']) ? $drupal_version['distribution'] : '', 'base_version' => $drupal_version['base_version'], 'build_data' => $drupal_version, 'roles' => Json::encode(user_roles()), 'uid_0_present' => $this->getUidZerroIsPresent());
     $scheme = parse_url($this->config('acquia_connector.settings')->get('spi.server'), PHP_URL_SCHEME);
     $via_ssl = in_array('ssl', stream_get_transports(), TRUE) && $scheme == 'https' ? TRUE : FALSE;
     if ($this->config('acquia_connector.settings')->get('spi.ssl_override')) {
         $via_ssl = TRUE;
     }
     $additional_data = array();
     $security_review = new SecurityReviewController();
     $security_review_results = $security_review->runSecurityReview();
     // It's worth sending along node access control information even if there are
     // no modules implementing it - some alerts are simpler if we know we don't
     // have to worry about node access.
     // Check for node grants modules.
     $additional_data['node_grants_modules'] = \Drupal::moduleHandler()->getImplementations('node_grants');
     // Check for node access modules.
     $additional_data['node_access_modules'] = \Drupal::moduleHandler()->getImplementations('node_access');
     if (!empty($security_review_results)) {
         $additional_data['security_review'] = $security_review_results['security_review'];
     }
     // Collect all user-contributed custom tests that pass validation.
     $custom_tests_results = $this->testCollect();
     if (!empty($custom_tests_results)) {
         $additional_data['custom_tests'] = $custom_tests_results;
     }
     $spi_data = \Drupal::moduleHandler()->invokeAll('acquia_connector_spi_get');
     if (!empty($spi_data)) {
         foreach ($spi_data as $name => $data) {
             if (is_string($name) && is_array($data)) {
                 $additional_data[$name] = $data;
             }
         }
     }
     // Database updates required?
     // Based on code from system.install
     $additional_data['pending_updates'] = FALSE;
     foreach (\Drupal::moduleHandler()->getModuleList() as $module => $filename) {
         $updates = drupal_get_schema_versions($module);
         if ($updates !== FALSE) {
             $default = drupal_get_installed_schema_version($module);
             if (max($updates) > $default) {
                 $additional_data['pending_updates'] = TRUE;
                 break;
             }
         }
     }
     if (!$additional_data['pending_updates'] && \Drupal::service('entity.definition_update_manager')->needsUpdates()) {
         $additional_data['pending_updates'] = TRUE;
     }
     if (!empty($additional_data)) {
         // JSON encode this additional data.
         $spi['additional_data'] = json_encode($additional_data);
     }
     if (!empty($method)) {
         $spi['send_method'] = $method;
     }
     if (!$via_ssl) {
         return $spi;
     } else {
         $variablesController = new VariablesController();
         // Values returned only over SSL
         $spi_ssl = array('system_vars' => $variablesController->getVariablesData(), 'settings_ra' => $this->getSettingsPermissions(), 'admin_count' => $this->config('acquia_connector.settings')->get('spi.admin_priv') ? $this->getAdminCount() : '', 'admin_name' => $this->config('acquia_connector.settings')->get('spi.admin_priv') ? $this->getSuperName() : '');
         return array_merge($spi, $spi_ssl);
     }
 }