/** * Ensures that the user page is available after installation. */ public function testInstaller() { $this->assertUrl('user/1'); $this->assertResponse(200); // Confirm that we are logged-in after installation. $this->assertText($this->rootUser->getUsername()); // @todo hmmm this message is wrong! // Verify that the confirmation message appears. require_once \Drupal::root() . '/core/includes/install.inc'; $this->assertRaw(t('Congratulations, you installed @drupal!', array('@drupal' => drupal_install_profile_distribution_name()))); // Ensure that all modules, profile and themes have been installed and have // expected weights. $sync = \Drupal::service('config.storage.sync'); $sync_core_extension = $sync->read('core.extension'); $this->assertIdentical($sync_core_extension, \Drupal::config('core.extension')->get()); // Ensure that the correct install profile has been written to settings.php. $listing = new ExtensionDiscovery(\Drupal::root()); $listing->setProfileDirectories([]); $profiles = array_intersect_key($listing->scan('profile'), $sync_core_extension['module']); $current_profile = Settings::get('install_profile'); $this->assertFalse(empty($current_profile), 'The $install_profile setting exists'); $this->assertEqual($current_profile, key($profiles)); // Test that any configuration entities in sync have been created. // @todo }
/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { require_once DRUPAL_ROOT . '/core/includes/install.inc'; $distribution = SafeMarkup::checkPlain(drupal_install_profile_distribution_name()); // Include system.admin.inc so we can use the sort callbacks. $this->moduleHandler->loadInclude('system', 'inc', 'system.admin'); // Sort all modules by their names. $modules = system_rebuild_module_data(); uasort($modules, 'system_sort_modules_by_info_name'); $packages = ['any' => t('- ANY -')]; // Iterate over each of the modules. $form['modules']['#tree'] = TRUE; foreach ($modules as $machine_name => $module) { if (empty($module->info['hidden'])) { $form['modules'][$machine_name] = $this->buildRow($modules, $module, $distribution); $form['modules'][$machine_name]['#theme'] = 'mmu_modules_item'; $form['modules'][$machine_name]['#module'] = $module; $form['modules'][$machine_name]['#machine_name'] = $machine_name; $package = $module->info['package']; $packages[HTML::getClass($package)] = $package; } } ksort($packages); $defaults = []; if (isset($_COOKIE['mmu-active-filter'])) { $filter_defaults = explode('.mmu-', SafeMarkup::checkPlain($_COOKIE['mmu-active-filter'])); array_shift($filter_defaults); foreach ($filter_defaults as $filter_default) { list($key, $value) = array_pad(explode('-', $filter_default, 2), 2, NULL); $defaults[$key] = $value; } } if (isset($_COOKIE['mmu-active-sort'])) { list($defaults['sort_by'], $defaults['sort_order']) = array_pad(explode(':', SafeMarkup::checkPlain($_COOKIE['mmu-active-sort'])), 2, NULL); } $form['controls'] = array('#title' => 'controls', '#type' => 'container', '#attributes' => ['class' => ['mmu-controls', 'clearfix']], '#weight' => -100); $form['controls']['text'] = ['#type' => 'search', '#title' => t('Search'), '#size' => 30, '#placeholder' => $this->t('Enter module name'), '#attributes' => array('class' => array('table-filter-text'), 'data-table' => '#system-modules', 'autocomplete' => 'off')]; $form['controls']['package'] = ['#title' => t('Package'), '#type' => 'select', '#options' => $packages, '#default_value' => isset($defaults['package']) ? $defaults['package'] : '']; $form['controls']['status'] = ['#title' => t('Status'), '#type' => 'select', '#options' => ['any' => t('- ANY -'), 'selected' => t('Selected'), 'enabled' => t('Enabled'), 'disabled' => t('Disabled')], '#default_value' => isset($defaults['status']) ? $defaults['status'] : '']; $form['controls']['source'] = ['#title' => t('Source'), '#type' => 'select', '#options' => ['any' => t('- ANY -'), 'core' => t('Core'), 'contrib' => t('Contrib'), 'custom' => t('Custom')], '#default_value' => isset($defaults['source']) ? $defaults['source'] : '']; $form['controls']['sort_by'] = ['#title' => t('Sort by'), '#type' => 'select', '#options' => ['package' => t('Package'), 'name' => t('Name'), 'status' => t('Status')], '#default_value' => isset($defaults['sort_by']) ? $defaults['sort_by'] : '']; $form['controls']['sort_order'] = ['#title' => t('Order'), '#type' => 'select', '#options' => ['asc' => t('Asc'), 'desc' => t('Desc')], '#default_value' => isset($defaults['sort_order']) ? $defaults['sort_order'] : '']; $form['controls']['reset'] = ['#title' => t('Order'), '#type' => 'button', '#value' => t('Reset'), '#attributes' => ['class' => ['mmu-reset-button']], '#prefix' => '<div class="form-item"><div> </div>', '#suffix' => '</div>']; $form['modules']['#prefix'] = '<div id="mmu-container" class="clearfix">'; $form['modules']['#suffix'] = '</div>'; $form['controls']['actions'] = array('#type' => 'actions', '#attributes' => ['class' => ['form-item']]); $form['controls']['actions']['total_selected'] = array('#type' => 'container', '#markup' => ' '); $form['controls']['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Save configuration')); $form['summary'] = array('#type' => 'item', '#markup' => ''); $form['#attached']['library'][] = 'mmu/mmu'; $form['#attached']['library'][] = 'core/jquery.cookie'; $form['#attached']['library'][] = 'core/drupal.debounce'; $form['#attached']['library'][] = 'core/jquery.ui.dialog'; $form['#attached']['library'][] = 'core/jquery.ui.effects.explode'; $form['#attributes']['class'][] = 'mmu-modules-list'; return $form; }
/** * Ensures that the user page is available after installation. */ public function testInstaller() { $this->assertUrl('user/1'); $this->assertResponse(200); // Confirm that we are logged-in after installation. $this->assertText($this->rootUser->getUsername()); // Verify that the confirmation message appears. require_once \Drupal::root() . '/core/includes/install.inc'; $this->assertRaw(t('Congratulations, you installed @drupal!', array('@drupal' => drupal_install_profile_distribution_name()))); }
/** * Ensures that the user page is available after installation. */ public function testInstaller() { // Do assertions from parent. require_once \Drupal::root() . '/core/includes/install.inc'; $this->assertRaw(t('Congratulations, you installed @drupal fr!', array('@drupal' => drupal_install_profile_distribution_name()))); // Even though we began the install in English the configuration is French // so that takes precedence. $this->assertEqual('fr', \Drupal::config('system.site')->get('default_langcode')); $this->assertFalse(\Drupal::service('language_manager')->isMultilingual()); }
/** * {@inheritdoc} */ public function getFormOptions(array $database) { $form = parent::getFormOptions($database); // Remove the options that only apply to client/server style databases. unset($form['username'], $form['password'], $form['advanced_options']['host'], $form['advanced_options']['port']); // Make the text more accurate for SQLite. $form['database']['#title'] = t('Database file'); $form['database']['#description'] = t('The absolute path to the file where @drupal data will be stored. This must be writable by the web server and should exist outside of the web root.', array('@drupal' => drupal_install_profile_distribution_name())); $default_database = \Drupal::service('site.path') . '/files/.ht.sqlite'; $form['database']['#default_value'] = empty($database['database']) ? $default_database : $database['database']; return $form; }
/** * Ensures that the user page is available after installation. */ public function testInstaller() { // Verify that the confirmation message appears. require_once \Drupal::root() . '/core/includes/install.inc'; $this->assertRaw(t('Congratulations, you installed @drupal!', array('@drupal' => drupal_install_profile_distribution_name()))); }
/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { require_once DRUPAL_ROOT . '/core/includes/install.inc'; $distribution = SafeMarkup::checkPlain(drupal_install_profile_distribution_name()); // Include system.admin.inc so we can use the sort callbacks. $this->moduleHandler->loadInclude('system', 'inc', 'system.admin'); $form['filters'] = array('#type' => 'container', '#attributes' => array('class' => array('table-filter', 'js-show'))); $form['filters']['text'] = array('#type' => 'search', '#title' => $this->t('Search'), '#size' => 30, '#placeholder' => $this->t('Enter module name'), '#attributes' => array('class' => array('table-filter-text'), 'data-table' => '#system-modules', 'autocomplete' => 'off', 'title' => $this->t('Enter a part of the module name or description to filter by.'))); // Sort all modules by their names. $modules = system_rebuild_module_data(); uasort($modules, 'system_sort_modules_by_info_name'); // Iterate over each of the modules. $form['modules']['#tree'] = TRUE; foreach ($modules as $filename => $module) { if (empty($module->info['hidden'])) { $package = $module->info['package']; $form['modules'][$package][$filename] = $this->buildRow($modules, $module, $distribution); } } // Add a wrapper around every package. foreach (Element::children($form['modules']) as $package) { $form['modules'][$package] += array('#type' => 'details', '#title' => $this->t($package), '#open' => TRUE, '#theme' => 'system_modules_details', '#header' => array(array('data' => $this->t('Installed'), 'class' => array('checkbox', 'visually-hidden')), array('data' => $this->t('Name'), 'class' => array('name', 'visually-hidden')), array('data' => $this->t('Description'), 'class' => array('description', 'visually-hidden', RESPONSIVE_PRIORITY_LOW))), '#attributes' => array('class' => array('package-listing')), '#weight' => $package == 'Core' ? -10 : NULL); } // If testing modules are shown, collapse the corresponding package by // default. if (isset($form['modules']['Testing'])) { $form['modules']['Testing']['#open'] = FALSE; } // Lastly, sort all packages by title. uasort($form['modules'], array('\\Drupal\\Component\\Utility\\SortArray', 'sortByTitleProperty')); $form['#attached']['library'][] = 'system/drupal.system.modules'; $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Save configuration'), '#button_type' => 'primary'); return $form; }
/** * Check installation requirements and report any errors. */ function install_check_requirements($install_state) { $profile = $install_state['parameters']['profile']; // Check the profile requirements. $requirements = drupal_check_profile($profile); // If Drupal is not set up already, we need to create a settings file. if (!$install_state['settings_verified']) { $writable = FALSE; $conf_path = './' . conf_path(FALSE, TRUE); $settings_file = $conf_path . '/settings.php'; $file = $conf_path; $exists = FALSE; // Verify that the directory exists. if (drupal_verify_install_file($conf_path, FILE_EXIST, 'dir')) { // Check to make sure a settings.php already exists. $file = $settings_file; if (drupal_verify_install_file($settings_file, FILE_EXIST)) { $exists = TRUE; // If it does, make sure it is writable. $writable = drupal_verify_install_file($settings_file, FILE_READABLE | FILE_WRITABLE); $exists = TRUE; } } if (!$exists) { $requirements['settings file exists'] = array('title' => st('Settings file'), 'value' => st('The settings file does not exist.'), 'severity' => REQUIREMENT_ERROR, 'description' => st('The @drupal installer requires that you create a settings file as part of the installation process. Copy the %default_file file to %file. More details about installing Drupal are available in <a href="@install_txt">INSTALL.txt</a>.', array('@drupal' => drupal_install_profile_distribution_name(), '%file' => $file, '%default_file' => $conf_path . '/default.settings.php', '@install_txt' => base_path() . 'INSTALL.txt'))); } else { $requirements['settings file exists'] = array('title' => st('Settings file'), 'value' => st('The %file file exists.', array('%file' => $file))); if (!$writable) { $requirements['settings file writable'] = array('title' => st('Settings file'), 'value' => st('The settings file is not writable.'), 'severity' => REQUIREMENT_ERROR, 'description' => st('The @drupal installer requires write permissions to %file during the installation process. If you are unsure how to grant file permissions, consult the <a href="@handbook_url">online handbook</a>.', array('@drupal' => drupal_install_profile_distribution_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions'))); } else { $requirements['settings file'] = array('title' => st('Settings file'), 'value' => st('Settings file is writable.')); } } } return $requirements; }