system requirements page for more information.'; exit; } require_once DRUPAL_ROOT . '/includes/common.inc'; require_once DRUPAL_ROOT . '/includes/file.inc'; require_once DRUPAL_ROOT . '/includes/install.inc'; // require_once DRUPAL_ROOT . '/includes/install.core.inc'; $databases = array( 'default' => array( 'default' => array( 'database' => '/tmp/drupal.' . md5(DRUPAL_ROOT) . '.sqlite', // @TODO Make the temporary directory generic. 'driver' => 'sqlite', 'prefix' => '', ), ), ); unlink($databases['default']['default']['database']); // print_r($databases); install_verify_settings(); // db_query(''); // Create super basic sqlite database. require 'modules/system/system.install'; require 'modules/user/user.install'; // Array // ( // [0] => actions // [1] => batch // [7] => cache_page // [8] => cache_path // [9] => date_format_locale // [10] => date_format_type // [11] => date_formats // [12] => file_managed // [13] => file_usage // [14] => flood // [15] => menu_links // [16] => menu_router // [17] => queue // [21] => sequences // [24] => url_alias // ) // Array // ( // [0] => authmap // ) $ignore = array( 'actions', 'batch', 'date_format_locale', 'date_format_type', 'date_formats', 'file_managed', 'file_usage', 'flood', 'queue', 'sequences', 'authmap', ); $schema = system_schema(); _drupal_schema_initialize($schema, 'system', FALSE); install_schema($schema, $ignore); $schema = user_schema(); _drupal_schema_initialize($schema, 'user', FALSE); install_schema($schema, $ignore); echo "oh snap!\n"; db_insert('system') ->fields(array('filename', 'name', 'type', 'owner', 'status', 'schema_version', 'bootstrap')) ->values(array( 'filename' => 'modules/system/system.module', 'name' => 'system', 'type' => 'module', 'owner' => '', 'status' => 1, 'schema_version' => 0, 'bootstrap' => 0, )) ->values(array( 'filename' => 'modules/user/user.module', 'name' => 'user', 'type' => 'module', 'owner' => '', 'status' => 1, 'schema_version' => 0, 'bootstrap' => 0, ), array( 'filename' => 'themes/bartik/bartik.info', 'name' => 'bartik', 'type' => 'theme', 'owner' => 'themes/engines/phptemplate/phptemplate.engine', 'status' => 1, 'schema_version' => -1, 'bootstrap' => 0, )) ->execute(); require DRUPAL_ROOT . '/includes/bootstrap.inc'; require DRUPAL_ROOT . '/includes/cache.inc'; require DRUPAL_ROOT . '/includes/lock.inc'; require DRUPAL_ROOT . '/includes/module.inc'; require DRUPAL_ROOT . '/includes/menu.inc'; require DRUPAL_ROOT . '/modules/system/system.module'; registry_rebuild(); system_rebuild_theme_data(); // Could also rearrange so ths is called once registry is built and less files // need to be included, otherwise remove this and include user.module. require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); // Clear out module list and hook implementation statics before calling // system_rebuild_theme_data(). module_list(TRUE); module_implements('', FALSE, TRUE); // print_r(menu_router_build()); var_dump(menu_rebuild()); // echo "before\n"; // var_dump(db_query('SELECT * FROM {menu_router}')->fetchAssoc()); variable_set('theme_default', 'bartik'); variable_get('menu_rebuild_needed', TRUE); // $core = array('cache', 'cache_bootstrap'); // @TODO Not necessary // foreach ($core as $table) { // cache_clear_all('*', $table, TRUE); // } // Need an install profile which we then switch to the profile they ask for. echo "ultra snap!\n"; function install_schema($schema, $ignore) { foreach ($schema as $name => $table) { if (!in_array($name, $ignore)) { db_create_table($name, $table); } } } /** * Verifies the existing settings in settings.php. */ function install_verify_settings() { global $databases; if (install_verify_pdo()) { $database = $databases['default']['default']; $errors = install_database_errors($database); print_r($errors); if (empty($errors)) { return TRUE; } } return FALSE; } /** * Verify PDO library. */ function install_verify_pdo() { // PDO was moved to PHP core in 5.2.0, but the old extension (targeting 5.0 // and 5.1) is still available from PECL, and can still be built without // errors. To verify that the correct version is in use, we check the // PDO::ATTR_DEFAULT_FETCH_MODE constant, which is not available in the // PECL extension. return extension_loaded('pdo') && defined('PDO::ATTR_DEFAULT_FETCH_MODE'); } /** * Checks a database connection and returns any errors. */ function install_database_errors($database) { global $databases; $errors = array(); // Check database type. $database_types = drupal_get_database_types(); $driver = $database['driver']; if (!isset($database_types[$driver])) { $errors['driver'] = st('Failed to connect?!?!'); // @TODO } else { // Run driver specific validation $errors += $database_types[$driver]->validateDatabaseSettings($database); // Run tasks associated with the database type. Any errors are caught in the // calling function. $databases['default']['default'] = $database; // Just changing the global doesn't get the new information processed. // We tell tell the Database class to re-parse $databases. Database::parseConnectionInfo(); try { db_run_tasks($driver); } catch (DatabaseTaskException $e) { // These are generic errors, so we do not have any specific key of the // database connection array to attach them to; therefore, we just put // them in the error array with standard numeric keys. $errors[$driver . '][0'] = $e->getMessage(); } } return $errors; }