public function setup() { parent::setup(); drupal_install_modules(array('search', 'kasahorow', 'kentry', 'devel')); $this->path = drupal_get_path('module', 'kentry'); //Create a node and add some relations $this->relid = 'testrel'; $this->node1 = new stdClass(); $this->node2 = new stdClass(); $this->node3 = new stdClass(); $this->node4 = new stdClass(); $this->node5 = new stdClass(); $this->node1->title = 'Test node 1'; node_save($this->node1); $this->node2->title = 'Test node 2'; node_save($this->node2); $this->node3->title = 'Test node 3'; node_save($this->node3); $this->node4->title = 'Test node 4'; node_save($this->node4); $this->node5->title = 'Test node 5'; node_save($this->node5); //Outgoing link from node1 to node2: ancestor(node1) = node2 _kentry_add_link($this->node1, $this->node2, $this->relid); //Incoming link from node3 to node1: descendant(node1) = node3 _kentry_add_link($this->node3, $this->node1, $this->relid); // ancestor(node2) = node4 _kentry_add_link($this->node2, $this->node4, $this->relid); // descendant(node3) = node5 _kentry_add_link($this->node5, $this->node3, $this->relid); }
/** * Initialize auto-inc values on dev site. Run this function only once, at setup. */ function __init() { // Bring config vars into function namespace extract(__config()); // Enable profile module drush_print("Installing profile module."); if (drush_drupal_major_version() < 7) { include_once 'includes/install.inc'; drupal_install_modules(array('profile')); } else { module_enable(array('profile')); } // Set auto-increment values $tables = array('authmap', 'comments', 'files', 'node', 'node_revisions', 'profile_fields', 'role', 'term_data', 'url_alias', 'users', 'vocabulary'); foreach ($tables as $table) { $value = ${$table}; db_query("ALTER TABLE `{$table}` AUTO_INCREMENT = %d", $value); drush_print("Set auto-increment value for {$table} to {$value}"); } unset($value); drush_print("Initialization done!"); }
/** * Generates a random database prefix, runs the install scripts on the * prefixed database and enable the specified modules. After installation * many caches are flushed and the internal browser is setup so that the * page requests will run on the new prefix. A temporary files directory * is created with the same name as the database prefix. * * @param ... * List of modules to enable for the duration of the test. */ protected function setUp() { global $db_prefix, $user, $language; // Store necessary current values before switching to prefixed database. $this->originalLanguage = $language; $this->originalLanguageDefault = variable_get('language_default'); $this->originalPrefix = $db_prefix; $this->originalFileDirectory = file_directory_path(); $this->originalProfile = drupal_get_profile(); $clean_url_original = variable_get('clean_url', 0); // Generate temporary prefixed database to ensure that tests have a clean starting point. $db_prefix_new = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}'); db_update('simpletest_test_id')->fields(array('last_prefix' => $db_prefix_new))->condition('test_id', $this->testId)->execute(); $db_prefix = $db_prefix_new; // Create test directory ahead of installation so fatal errors and debug // information can be logged during installation process. // Use temporary files directory with the same prefix as the database. $public_files_directory = $this->originalFileDirectory . '/simpletest/' . substr($db_prefix, 10); $private_files_directory = $public_files_directory . '/private'; $temp_files_directory = $private_files_directory . '/temp'; // Create the directories file_prepare_directory($public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); file_prepare_directory($private_files_directory, FILE_CREATE_DIRECTORY); file_prepare_directory($temp_files_directory, FILE_CREATE_DIRECTORY); $this->generatedTestFiles = FALSE; // Log fatal errors. ini_set('log_errors', 1); ini_set('error_log', $public_files_directory . '/error.log'); // Reset all statics so that test is performed with a clean environment. drupal_static_reset(); include_once DRUPAL_ROOT . '/includes/install.inc'; drupal_install_system(); $this->preloadRegistry(); // Include the default profile variable_set('install_profile', 'standard'); $profile_details = install_profile_info('standard', 'en'); // Install the modules specified by the default profile. drupal_install_modules($profile_details['dependencies'], TRUE); drupal_static_reset('_node_types_build'); if ($modules = func_get_args()) { // Install modules needed for this test. drupal_install_modules($modules, TRUE); } // Because the schema is static cached, we need to flush // it between each run. If we don't, then it will contain // stale data for the previous run's database prefix and all // calls to it will fail. drupal_get_schema(NULL, TRUE); // Run default profile tasks. $install_state = array(); drupal_install_modules(array('standard'), TRUE); // Rebuild caches. node_types_rebuild(); actions_synchronize(); _drupal_flush_css_js(); $this->refreshVariables(); $this->checkPermissions(array(), TRUE); // Log in with a clean $user. $this->originalUser = $user; drupal_save_session(FALSE); $user = user_load(1); // Restore necessary variables. variable_set('install_task', 'done'); variable_set('clean_url', $clean_url_original); variable_set('site_mail', '*****@*****.**'); // Set up English language. unset($GLOBALS['conf']['language_default']); $language = language_default(); // Set path variables variable_set('file_public_path', $public_files_directory); variable_set('file_private_path', $private_files_directory); variable_set('file_temporary_path', $temp_files_directory); // Use the test mail class instead of the default mail handler class. variable_set('mail_system', array('default-system' => 'TestingMailSystem')); drupal_set_time_limit($this->timeLimit); }
/** * Generates a random database prefix and runs the install scripts on the prefixed database. * After installation many caches are flushed and the internal browser is setup so that the page * requests will run on the new prefix. A temporary files directory is created with the same name * as the database prefix. * * @param ... List modules to enable. */ function setUp() { global $db_prefix, $simpletest_ua_key; if ($simpletest_ua_key) { $this->db_prefix_original = $db_prefix; $clean_url_original = variable_get('clean_url', 0); $db_prefix = 'simpletest' . mt_rand(1000, 1000000); include_once './includes/install.inc'; drupal_install_system(); $modules = array_unique(array_merge(func_get_args(), drupal_verify_profile('default', 'en'))); drupal_install_modules($modules); $this->_modules = drupal_map_assoc($modules); $this->_modules['system'] = 'system'; $task = 'profile'; default_profile_tasks($task, ''); menu_rebuild(); actions_synchronize(); _drupal_flush_css_js(); variable_set('install_profile', 'default'); variable_set('install_task', 'profile-finished'); variable_set('clean_url', $clean_url_original); // Use temporary files directory with the same prefix as database. $this->original_file_directory = file_directory_path(); variable_set('file_directory_path', file_directory_path() . '/' . $db_prefix); file_check_directory(file_directory_path(), TRUE); // Create the files directory. } parent::setUp(); }
function setup() { parent::setup(); drupal_install_modules(array('kasahorow', 'kservices', 'devel')); }
/** * Generates a random database prefix, runs the install scripts on the * prefixed database and enable the specified modules. After installation * many caches are flushed and the internal browser is setup so that the * page requests will run on the new prefix. A temporary files directory * is created with the same name as the database prefix. * * @param ... * List of modules to enable for the duration of the test. */ protected function setUp() { global $db_prefix; // Store necessary current values before switching to prefixed database. $this->originalPrefix = $db_prefix; $clean_url_original = variable_get('clean_url', 0); // Generate temporary prefixed database to ensure that tests have a clean starting point. $db_prefix = Database::getActiveConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}'); include_once DRUPAL_ROOT . '/includes/install.inc'; drupal_install_system(); $this->preloadRegistry(); // Add the specified modules to the list of modules in the default profile. $args = func_get_args(); $modules = array_unique(array_merge(drupal_get_profile_modules('default', 'en'), $args)); drupal_install_modules($modules); // Because the schema is static cached, we need to flush // it between each run. If we don't, then it will contain // stale data for the previous run's database prefix and all // calls to it will fail. drupal_get_schema(NULL, TRUE); // Run default profile tasks. $task = 'profile'; default_profile_tasks($task, ''); // Rebuild caches. actions_synchronize(); _drupal_flush_css_js(); $this->refreshVariables(); $this->checkPermissions(array(), TRUE); // Restore necessary variables. variable_set('install_profile', 'default'); variable_set('install_task', 'profile-finished'); variable_set('clean_url', $clean_url_original); variable_set('site_mail', '*****@*****.**'); // Use temporary files directory with the same prefix as database. $this->originalFileDirectory = file_directory_path(); variable_set('file_directory_path', file_directory_path() . '/' . $db_prefix); $directory = file_directory_path(); file_check_directory($directory, FILE_CREATE_DIRECTORY); // Create the files directory. }
/** * Form API submit for the site configuration form. */ function install_configure_form_submit($form, &$form_state) { global $user; variable_set('site_name', $form_state['values']['site_name']); variable_set('site_mail', $form_state['values']['site_mail']); variable_set('date_default_timezone', $form_state['values']['date_default_timezone']); variable_set('site_default_country', $form_state['values']['site_default_country']); // Enable update.module if this option was selected. if ($form_state['values']['update_status_module'][1]) { drupal_install_modules(array('update')); // Add the site maintenance account's email address to the list of // addresses to be notified when updates are available, if selected. if ($form_state['values']['update_status_module'][2]) { variable_set('update_notify_emails', array($form_state['values']['account']['mail'])); } } // Turn this off temporarily so that we can pass a password through. variable_set('user_email_verification', FALSE); $form_state['old_values'] = $form_state['values']; $form_state['values'] = $form_state['values']['account']; // We precreated user 1 with placeholder values. Let's save the real values. $account = user_load(1); $merge_data = array('init' => $form_state['values']['mail'], 'roles' => array(), 'status' => 1); user_save($account, array_merge($form_state['values'], $merge_data)); // Load global $user and perform final login tasks. $user = user_load(1); user_login_finalize(); $form_state['values'] = $form_state['old_values']; unset($form_state['old_values']); variable_set('user_email_verification', TRUE); if (isset($form_state['values']['clean_url'])) { variable_set('clean_url', $form_state['values']['clean_url']); } // Record when this install ran. variable_set('install_time', $_SERVER['REQUEST_TIME']); }
/** * Enables a drupal module * @param string $name name of the module * @return boolean success */ function drupalModuleEnable($name) { if (module_exists($name)) { $this->pass(" [module] {$name} already enabled"); return TRUE; } include_once './includes/install.inc'; module_rebuild_cache(); // Rebuild the module cache if (drupal_get_installed_schema_version($name, TRUE) == SCHEMA_UNINSTALLED) { drupal_install_modules(array($name)); } else { $try = module_enable(array($name)); } if (module_exists($name)) { if (!isset($this->_cleanupModules[$name])) { $this->_cleanupModules[$name] = 0; } $this->pass(" [module] {$name} enabled"); return TRUE; } else { $this->fail(" [module] {$name} could not be enbled, probably file not exists"); return FALSE; } }
/** * Generates a random database prefix, runs the install scripts on the * prefixed database and enable the specified modules. After installation * many caches are flushed and the internal browser is setup so that the * page requests will run on the new prefix. A temporary files directory * is created with the same name as the database prefix. * * @param ... * List of modules to enable for the duration of the test. */ protected function setUp() { global $db_prefix, $user, $language; // Store necessary current values before switching to prefixed database. $this->originalLanguage = $language; // $this->originalLanguageDefault = variable_get('language_default'); $this->originalPrefix = $db_prefix; $this->originalFileDirectory = file_directory_path(); // $this->originalProfile = drupal_get_profile(); $clean_url_original = variable_get('clean_url', 0); // Must reset locale here, since schema calls t(). (Drupal 6) if (module_exists('locale')) { $language = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''); locale(NULL, NULL, TRUE); } // Generate temporary prefixed database to ensure that tests have a clean starting point. // $db_prefix_new = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}'); $db_prefix_new = $db_prefix . 'simpletest' . mt_rand(1000, 1000000); // Workaround to insure we init the theme layer before going into prefixed // environment. (Drupal 6) $this->pass(t('Starting run with db_prefix %prefix', array('%prefix' => $db_prefix_new)), 'System'); // db_update('simpletest_test_id') // ->fields(array('last_prefix' => $db_prefix_new)) // ->condition('test_id', $this->testId) // ->execute(); db_query("UPDATE {simpletest_test_id}\n SET last_prefix = '%s'\n WHERE test_id = %d", $db_prefix_new, $this->testId); $db_prefix = $db_prefix_new; // Create test directory ahead of installation so fatal errors and debug // information can be logged during installation process. $directory = $this->originalFileDirectory . '/simpletest/' . substr($db_prefix, 10); // file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); // Log fatal errors. ini_set('log_errors', 1); ini_set('error_log', $directory . '/error.log'); // include_once DRUPAL_ROOT . '/includes/install.inc'; include_once './includes/install.inc'; drupal_install_system(); // $this->preloadRegistry(); // // Include the default profile // variable_set('install_profile', 'default'); // $profile_details = install_profile_info('default', 'en'); // Add the specified modules to the list of modules in the default profile. // Install the modules specified by the default profile. // drupal_install_modules($profile_details['dependencies'], TRUE); drupal_install_modules(drupal_verify_profile('default', 'en')); // node_type_clear(); // Install additional modules one at a time in order to make sure that the // list of modules is updated between each module's installation. $modules = func_get_args(); foreach ($modules as $module) { // drupal_install_modules(array($module), TRUE); drupal_install_modules(array($module)); } // Because the schema is static cached, we need to flush // it between each run. If we don't, then it will contain // stale data for the previous run's database prefix and all // calls to it will fail. drupal_get_schema(NULL, TRUE); // Run default profile tasks. // $install_state = array(); // drupal_install_modules(array('default'), TRUE); $task = 'profile'; default_profile_tasks($task, ''); // Rebuild caches. // node_types_rebuild(); actions_synchronize(); _drupal_flush_css_js(); $this->refreshVariables(); $this->checkPermissions(array(), TRUE); user_access(NULL, NULL, TRUE); // Drupal 6. // Log in with a clean $user. $this->originalUser = $user; // drupal_save_session(FALSE); // $user = user_load(1); session_save_session(FALSE); $user = user_load(array('uid' => 1)); // Restore necessary variables. variable_set('install_profile', 'default'); // variable_set('install_task', 'done'); variable_set('install_task', 'profile-finished'); variable_set('clean_url', $clean_url_original); variable_set('site_mail', '*****@*****.**'); // // Set up English language. // unset($GLOBALS['conf']['language_default']); // $language = language_default(); // Use the test mail class instead of the default mail handler class. // variable_set('mail_sending_system', array('default-system' => 'TestingMailSystem')); variable_set('smtp_library', drupal_get_path('module', 'simpletest') . '/simpletest.mail.inc'); // Use temporary files directory with the same prefix as the database. // $public_files_directory = $this->originalFileDirectory . '/' . $db_prefix; // $private_files_directory = $public_files_directory . '/private'; $directory = $this->originalFileDirectory . '/' . $db_prefix; // Set path variables // variable_set('file_public_path', $public_files_directory); // variable_set('file_private_path', $private_files_directory); variable_set('file_directory_path', $directory); // Create the directories // $directory = file_directory_path('public'); // file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); // file_prepare_directory($private_files_directory, FILE_CREATE_DIRECTORY); file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); // drupal_set_time_limit($this->timeLimit); set_time_limit($this->timeLimit); }
/** * Generates a random database prefix, runs the install scripts on the * prefixed database and enable the specified modules. After installation * many caches are flushed and the internal browser is setup so that the * page requests will run on the new prefix. A temporary files directory * is created with the same name as the database prefix. * * @param ... * List of modules to enable for the duration of the test. */ protected function setUp() { global $db_prefix, $user, $language; // $language (Drupal 6). // Store necessary current values before switching to prefixed database. $this->originalPrefix = $db_prefix; $clean_url_original = variable_get('clean_url', 0); // Must reset locale here, since schema calls t(). (Drupal 6) if (module_exists('locale')) { $language = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''); locale(NULL, NULL, TRUE); } // Generate temporary prefixed database to ensure that tests have a clean starting point. // $db_prefix = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}'); $db_prefix = 'simpletest' . mt_rand(1000, 1000000); // include_once DRUPAL_ROOT . '/includes/install.inc'; include_once './includes/install.inc'; drupal_install_system(); // $this->preloadRegistry(); // Add the specified modules to the list of modules in the default profile. $args = func_get_args(); // $modules = array_unique(array_merge(drupal_get_profile_modules('default', 'en'), $args)); $modules = array_unique(array_merge(drupal_verify_profile('default', 'en'), $args)); // drupal_install_modules($modules, TRUE); drupal_install_modules($modules); // Because the schema is static cached, we need to flush // it between each run. If we don't, then it will contain // stale data for the previous run's database prefix and all // calls to it will fail. drupal_get_schema(NULL, TRUE); // Run default profile tasks. $task = 'profile'; default_profile_tasks($task, ''); // Rebuild caches. actions_synchronize(); _drupal_flush_css_js(); $this->refreshVariables(); $this->checkPermissions(array(), TRUE); user_access(NULL, NULL, TRUE); // Drupal 6. // Log in with a clean $user. $this->originalUser = $user; // drupal_save_session(FALSE); // $user = user_load(1); session_save_session(FALSE); $user = user_load(array('uid' => 1)); // Restore necessary variables. variable_set('install_profile', 'default'); variable_set('install_task', 'profile-finished'); variable_set('clean_url', $clean_url_original); variable_set('site_mail', '*****@*****.**'); // Use temporary files directory with the same prefix as database. $this->originalFileDirectory = file_directory_path(); variable_set('file_directory_path', file_directory_path() . '/' . $db_prefix); $directory = file_directory_path(); // Create the files directory. file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); set_time_limit($this->timeLimit); }
/** * Generates a random database prefix, runs the install scripts on the * prefixed database and enable the specified modules. After installation * many caches are flushed and the internal browser is setup so that the * page requests will run on the new prefix. A temporary files directory * is created with the same name as the database prefix. * * @param ... * List of modules to enable for the duration of the test. */ function setUp() { global $db_prefix, $user, $language; // $language (Drupal 6). global $install_locale; // Store necessary current values before switching to prefixed database. $this->db_prefix_original = $db_prefix; $clean_url_original = variable_get('clean_url', 0); // Generate temporary prefixed database to ensure that tests have a clean starting point. $db_prefix = 'simpletest' . mt_rand(1000, 1000000); include_once './includes/install.inc'; drupal_install_system(); // Add the specified modules to the list of modules in the default profile. $args = func_get_args(); // Add language and basic i18n modules $install_locale = $this->install_locale; $i18n_modules = array('locale', 'translation', 'i18n', 'i18n_test'); $modules = array_unique(array_merge(drupal_verify_profile('default', $this->install_locale), $args, $i18n_modules)); drupal_install_modules($modules); // Install locale if ($this->install_locale != 'en') { $this->addLanguage($this->install_locale, TRUE); } // Run default profile tasks. $task = 'profile'; default_profile_tasks($task, ''); // Rebuild caches. actions_synchronize(); _drupal_flush_css_js(); $this->refreshVariables(); $this->checkPermissions(array(), TRUE); user_access(NULL, NULL, TRUE); // Drupal 6. // Log in with a clean $user. $this->originalUser = $user; // drupal_save_session(FALSE); // $user = user_load(1); session_save_session(FALSE); $user = user_load(1); // Restore necessary variables. variable_set('install_profile', 'default'); variable_set('install_task', 'profile-finished'); variable_set('clean_url', $clean_url_original); variable_set('site_mail', '*****@*****.**'); // Use temporary files directory with the same prefix as database. $this->originalFileDirectory = file_directory_path(); variable_set('file_directory_path', file_directory_path() . '/' . $db_prefix); $directory = file_directory_path(); // Create the files directory. file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); drupal_set_time_limit($this->timeLimit); // Some more includes require_once 'includes/language.inc'; // Refresh theme $this->initTheme(); // Set path languages so we can retrieve pages in different languages variable_set('language_negotiation', LANGUAGE_NEGOTIATION_PATH); }
drupal_privuser($argv[2], $argv[3], $argv[4]); die; exit; } if ($argv[1] == "--drupal-cron") { drupal_cron(); die; exit; } if ($argv[1] == "--drupal-modules") { drupal_dump_modules($argv[2]); die; exit; } if ($argv[1] == "--drupal-modules-install") { drupal_install_modules($argv[2]); die; exit; } if ($argv[1] == "--drupal-reinstall") { drupal_reinstall($argv[2]); die; exit; } if ($argv[1] == "--drupal-schedules") { drupal_schedules(); die; exit; } if ($argv[1] == "--status") { mod_status($argv[2]);
/** * Enables a drupal module * @param string $name name of the module * @return boolean success */ function drupalModuleEnable($name) { if (module_exists($name)) { return TRUE; } include_once './includes/install.inc'; module_rebuild_cache(); // Rebuild the module cache if (drupal_get_installed_schema_version($name, TRUE) == SCHEMA_UNINSTALLED) { drupal_install_modules(array($name)); } else { $try = module_enable(array($name)); } if (module_exists($name)) { if (!isset($this->_cleanupModules[$name])) { $this->_cleanupModules[$name] = 0; return TRUE; } } else { die("required module {$name} could not be enabled (probably file does not exist)"); } }
public function setup() { parent::setup(); drupal_install_modules(array('swen', 'devel')); }
/** * Installs Atrium instead of Drupal * * Generates a random database prefix, runs the install scripts on the * prefixed database and enable the specified modules. After installation * many caches are flushed and the internal browser is setup so that the * page requests will run on the new prefix. A temporary files directory * is created with the same name as the database prefix. * * @param ... * List of modules to enable for the duration of the test. */ protected function setUp() { global $db_prefix, $user, $language, $profile, $install_locale; // $language (Drupal 6). // Store necessary current values before switching to prefixed database. $this->originalPrefix = $db_prefix; $this->originalLanguage = clone $language; $clean_url_original = variable_get('clean_url', 0); // Must reset locale here, since schema calls t(). (Drupal 6) if (module_exists('locale')) { $language = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''); locale(NULL, NULL, TRUE); } // Generate temporary prefixed database to ensure that tests have a clean starting point. // $db_prefix = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}'); $db_prefix = 'simpletest' . mt_rand(1000, 1000000); $install_locale = $this->install_locale; $profile = $this->install_profile; // include_once DRUPAL_ROOT . '/includes/install.inc'; include_once './includes/install.inc'; drupal_install_system(); // $this->preloadRegistry(); // Set up theme system for the maintenance page. // Otherwise we have trouble: https://ds.openatrium.com/dsi/node/18426#comment-38118 // @todo simpletest module patch drupal_maintenance_theme(); // Add the specified modules to the list of modules in the default profile. $args = func_get_args(); // $modules = array_unique(array_merge(drupal_get_profile_modules('default', 'en'), $args)); $modules = array_unique(array_merge(drupal_verify_profile($this->install_profile, $this->install_locale), $args)); // drupal_install_modules($modules, TRUE); drupal_install_modules($modules); // Because the schema is static cached, we need to flush // it between each run. If we don't, then it will contain // stale data for the previous run's database prefix and all // calls to it will fail. drupal_get_schema(NULL, TRUE); if ($this->install_profile == 'openatrium') { // Download and import translation if needed if ($this->install_locale != 'en') { $this->installLanguage($this->install_locale); } // Install more modules $modules = _openatrium_atrium_modules(); drupal_install_modules($modules); // Configure intranet // $profile_tasks = $this->install_profile . '_profile_tasks'; _openatrium_intranet_configure(); _openatrium_intranet_configure_check(); variable_set('atrium_install', 1); // Clear views cache before rebuilding menu tree. Requires patch // [patch_here] to Views, as new modules have been included and // default views need to be re-detected. module_exists('views') ? views_get_all_views(TRUE) : TRUE; menu_rebuild(); } _drupal_flush_css_js(); $this->refreshVariables(); $this->checkPermissions(array(), TRUE); user_access(NULL, NULL, TRUE); // Drupal 6. // Log in with a clean $user. $this->originalUser = $user; // drupal_save_session(FALSE); // $user = user_load(1); session_save_session(FALSE); $user = user_load(array('uid' => 1)); // Restore necessary variables. variable_set('install_profile', $this->install_profile); variable_set('install_task', 'profile-finished'); variable_set('clean_url', $clean_url_original); variable_set('site_mail', '*****@*****.**'); // Use temporary files directory with the same prefix as database. $this->originalFileDirectory = file_directory_path(); variable_set('file_directory_path', file_directory_path() . '/' . $db_prefix); $directory = file_directory_path(); // Create the files directory. file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); set_time_limit($this->timeLimit); }
/** * Form API submit for the site configuration form. */ function install_configure_form_submit($form, &$form_state) { global $user; variable_set('site_name', $form_state['values']['site_name']); variable_set('site_mail', $form_state['values']['site_mail']); variable_set('date_default_timezone', $form_state['values']['date_default_timezone']); // Enable update.module if this option was selected. if ($form_state['values']['update_status_module'][1]) { drupal_install_modules(array('update')); } // Turn this off temporarily so that we can pass a password through. variable_set('user_email_verification', FALSE); $form_state['old_values'] = $form_state['values']; $form_state['values'] = $form_state['values']['account']; // We precreated user 1 with placeholder values. Let's save the real values. $account = user_load(1); $merge_data = array('init' => $form_state['values']['mail'], 'roles' => array(), 'status' => 1); user_save($account, array_merge($form_state['values'], $merge_data)); // Log in the first user. user_authenticate($form_state['values']); $form_state['values'] = $form_state['old_values']; unset($form_state['old_values']); variable_set('user_email_verification', TRUE); if (isset($form_state['values']['clean_url'])) { variable_set('clean_url', $form_state['values']['clean_url']); } // The user is now logged in, but has no session ID yet, which // would be required later in the request, so remember it. $user->sid = session_id(); // Record when this install ran. variable_set('install_time', time()); }
/** * Generates a random database prefix, runs the install scripts on the * prefixed database and enable the specified modules. After installation * many caches are flushed and the internal browser is setup so that the * page requests will run on the new prefix. A temporary files directory * is created with the same name as the database prefix. * * @param ... * List of modules to enable for the duration of the test. */ protected function setUp() { global $db_prefix, $user, $language; // Store necessary current values before switching to prefixed database. $this->originalLanguage = $language; $this->originalLanguageDefault = variable_get('language_default'); $this->originalPrefix = $db_prefix; $this->originalFileDirectory = file_directory_path(); $clean_url_original = variable_get('clean_url', 0); // Generate temporary prefixed database to ensure that tests have a clean starting point. $db_prefix = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}'); include_once DRUPAL_ROOT . '/includes/install.inc'; drupal_install_system(); $this->preloadRegistry(); // Add the specified modules to the list of modules in the default profile. // Install the modules specified by the default profile. $core_modules = drupal_get_profile_modules('default', 'en'); drupal_install_modules($core_modules, TRUE); node_type_clear(); // Install additional modules one at a time in order to make sure that the // list of modules is updated between each module's installation. $modules = func_get_args(); foreach ($modules as $module) { drupal_install_modules(array($module), TRUE); } // Because the schema is static cached, we need to flush // it between each run. If we don't, then it will contain // stale data for the previous run's database prefix and all // calls to it will fail. drupal_get_schema(NULL, TRUE); // Run default profile tasks. $task = 'profile'; default_profile_tasks($task, ''); // Rebuild caches. node_types_rebuild(); actions_synchronize(); _drupal_flush_css_js(); $this->refreshVariables(); $this->checkPermissions(array(), TRUE); // Log in with a clean $user. $this->originalUser = $user; drupal_save_session(FALSE); $user = user_load(1); // Restore necessary variables. variable_set('install_profile', 'default'); variable_set('install_task', 'profile-finished'); variable_set('clean_url', $clean_url_original); variable_set('site_mail', '*****@*****.**'); // Set up English language. unset($GLOBALS['conf']['language_default']); $language = language_default(); // Make sure our drupal_mail_wrapper function is called instead of the // default mail handler. variable_set('smtp_library', drupal_get_path('module', 'simpletest') . '/drupal_web_test_case.php'); // Use temporary files directory with the same prefix as database. variable_set('file_directory_path', $this->originalFileDirectory . '/' . $db_prefix); $directory = file_directory_path(); // Create the files directory. file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); set_time_limit($this->timeLimit); }