--- install.php.orig 2006-04-21 11:36:44.000000000 -0400 +++ install.php 2006-04-21 11:23:10.000000000 -0400 @@ -0,0 +1,19 @@ +Congratulations, Drupal has been successfully installed. Please review any warnings or errors that you might see above before continuing on to your new website.'); +} +else { + require_once './includes/install.inc'; + drupal_install(INSTALL_PROFILES); +} + +?> --- includes/install.inc.orig 2006-04-21 11:51:29.000000000 -0400 +++ includes/install.inc 2006-04-21 11:56:16.000000000 -0400 @@ -4,15 +4,38 @@ define('SCHEMA_UNINSTALLED', -1); define('SCHEMA_INSTALLED', 0); +define('DRUPAL_MINIMUM_PHP', '4.3.3'); +define('DRUPAL_MINIMUM_MEMORY', '8M'); +define('DRUPAL_MINIMUM_MYSQL', '3.23.17'); // If using MySQL +define('DRUPAL_MINIMUM_PGSQL', '7.3'); // If using PostgreSQL +define('DRUPAL_MINIMUM_APACHE', '1.3'); // If using Apache -// The system module (Drupal core) is currently a special case -include_once './database/updates.inc'; +define('FILE_EXIST', 1); +define('FILE_READABLE', 2); +define('FILE_WRITABLE', 4); +define('FILE_WRITEABLE', 4); +define('FILE_EXECUTABLE', 8); +define('FILE_NOT_EXIST', 16); +define('FILE_NOT_READABLE', 32); +define('FILE_NOT_WRITABLE', 64); +define('FILE_NOT_WRITEABLE', 64); +define('FILE_NOT_EXECUTABLE', 128); -// Include install files for each module -foreach (module_list() as $module) { - $install_file = './'. drupal_get_path('module', $module) .'/'. $module .'.install'; - if (is_file($install_file)) { - include_once $install_file; +define('INSTALL_BOOTSTRAP_ENVIRONMENT', 0); +define('INSTALL_BOOTSTRAP_SETTINGS', 1); +define('INSTALL_BOOTSTRAP_DATABASE', 2); +define('INSTALL_PROFILES', 3); + +if (!$install) { + // The system module (Drupal core) is currently a special case + include_once './database/updates.inc'; + + // Include install files for each module + foreach (module_list() as $module) { + $install_file = './'. drupal_get_path('module', $module) .'/'. $module .'.install'; + if (is_file($install_file)) { + include_once $install_file; + } } } @@ -79,3 +102,1000 @@ function drupal_set_installed_schema_version($module, $version) { db_query("UPDATE {system} SET schema_version = %d WHERE name = '%s'", $version, $module); } + +/** + * The Drupal installation happens in a series of steps. We begin by verifying + * that the current environment meets our minimum requirements. We then go + * on to verify that settings.php is properly configured. From there we + * connect to the configured database and verify that it meets our minimum + * requirements. Finally we can allow the user to select an installation + * profile and complete the installation process. + * + * @param $phase + * The installation phase we should proceed to. + */ +function drupal_install($phase) { + static $phases = array(INSTALL_BOOTSTRAP_ENVIRONMENT, INSTALL_BOOTSTRAP_SETTINGS, INSTALL_BOOTSTRAP_DATABASE, INSTALL_PROFILES); + + while (!is_null($current_phase = array_shift($phases))) { + _drupal_install($current_phase); + if ($phase == $current_phase) { + return; + } + } +} + +/** + * The individual Drupal installation phase definitions. + * + * @param $phase + * The current phase. + */ +function _drupal_install($phase) { + switch ($phase) { + case INSTALL_BOOTSTRAP_ENVIRONMENT: + _already_installed(); + // Initial install environment tests + require_once './modules/system.install'; + drupal_verify_install(system_requirements_bootstrap()); + if (_install_errors()) { + drupal_maintenance_theme(); + drupal_set_title('Verify your install environment'); + print theme('install_page', '
The errors above must be resolved before you can install Drupal. Find additional information about Drupal\'s minimum system requirements here.
'); + exit; + } + break; + + case INSTALL_BOOTSTRAP_SETTINGS: + // Configure/verify settings.php + install_verify_settings(); + if (_install_errors()) { + drupal_maintenance_theme(); + drupal_set_title('Site configuration'); + print theme('install_page', 'Please fill out the following information to configure your Drupal site.
'. drupal_install_settings_form()); + exit; + } + + break; + + case INSTALL_BOOTSTRAP_DATABASE: + // Establish connection to the database + require_once './includes/database.inc'; + $parts = parse_url($base_url); + $base_path = (isset($parts['path']) ? $parts['path'] . '/' : '/'); + install_verify_db(); + if (_install_errors()) { + drupal_maintenance_theme(); + drupal_set_title('Database configuration'); + print theme('install_page', drupal_install_settings_form('database')); + exit; + } + db_set_active(); + break; + + case INSTALL_PROFILES: + // Select from install profiles and/or specific modules/themes + // (gets instructions from *.install and *.profile files) + $profile = drupal_select_profile(); + drupal_install_profile($profile); + _install_goto("install.php?profile=$profile&installed=TRUE"); + break; + + } +} + +/** + * Check if there are any errors at this point in the installation process. + * + * @return + * An array of errors, if any. + */ +function _install_errors() { + $messages = drupal_set_message(); + return $messages['error']; +} + +/** + * Test for the existence of $installed in settings.php. + * + * @return + * TRUE/FALSE if $installed exists. + */ +function _already_installed() { + global $installed, $base_url; + + require_once './includes/bootstrap.inc'; + include './'. conf_path() .'/settings.php'; + + if ($installed) { + _install_goto("$base_url"); + } + return FALSE; +} + +/** + * Redirect + */ +function _install_goto($path) { + header ('Location: '. $path); + exit(); +} + +/** + * Auto detect the base_url with PHP predefined variables. + * + * @param $file + * The name of the file calling this function so we can strip it out of + * the URI when generating the base_url. + * + * @return + * The auto-detected $base_url that should be configured in settings.php + */ +function drupal_detect_baseurl($file = 'install.php') { + $proto = $_SERVER['HTTPS'] ? 'https://' : 'http://'; + $host = $_SERVER['SERVER_NAME']; + $port = ($_SERVER['SERVER_PORT'] == 80 ? '' : ':'. $_SERVER['SERVER_PORT']); + $dir = str_replace("/$file", '', $_SERVER['REQUEST_URI']); + return "$proto$host$port$dir"; +} + +/** + * Detect all databases supported by Drupal that are compiled into the current + * PHP installation. + * + * @return + * An array of database types compiled into PHP. + */ +function drupal_detect_database_types() { + $databases = array(); + + if (file_exists('./includes/install.mysql.inc')) { + include_once './includes/install.mysql.inc'; + if (mysql_is_available()) { + $databases[] = 'mysql'; + } + } + if (file_exists('./includes/install.mysqli.inc')) { + include_once './includes/install.mysqli.inc'; + if (mysqli_is_available()) { + $databases[] = 'mysqli'; + } + } + if (file_exists('./includes/install.pgsql.inc')) { + include_once './includes/install.pgsql.inc'; + if (pgsql_is_available()) { + $databases[] = 'pgsql'; + } + } + + return $databases; +} + +/** + * + */ +function install_verify_db() { + global $db_url, $db_type; + + $function = 'drupal_test_'. $db_type; + if (function_exists("$function")) { + return $function($db_url); + } + else { + drupal_set_message(strtr('Installation error: function "%function" does not exist.', array('%function' => $function)), 'error'); + } + return FALSE; +} + +/** + * Read settings.php into a buffer line by line, changing values specified in + * $settings array, then over-writing the old settings.php file. + * + * @param $settings + * An array of settings that need to be updated. + */ +function drupal_rewrite_settings($settings = array()) { + $settings_file = './'. conf_path() .'/settings.php'; + + $keys = array(); + foreach ($settings as $setting => $data) { + $keys[] = $setting; + } + + $buffer = NULL; + if($fp = @fopen($settings_file, 'r+')) { + // Step line by line through settings.php + while (!feof($fp)) { + $line = fgets($fp); + if (substr($line, 0, 1) == '$') { + preg_match('/\$(.*) /U', $line, $variable); + if (in_array($variable[1], $keys)) { + // Write new value to settings.php in the following format: + // $'setting' = 'value'; // 'comment' + $setting = $settings[$variable[1]]; + $buffer .= '$'. $variable[1] ." = '". $setting['value'] ."';". ($setting['comment'] ? ' // '. $setting['comment'] ."\n" : "\n"); + unset($settings[$variable[1]]); + } + else { + $buffer .= $line; + } + } + else { + $buffer .= $line; + } + } + fclose($fp); + + // Add required settings that were missing from settings.php + foreach ($settings as $setting => $data) { + if ($data['required']) { + $buffer .= "\$$setting = '". $data['value'] ."';\n"; + } + } + + $fp = fopen($settings_file, 'w'); + if ($fp && fwrite($fp, $buffer) === FALSE) { + drupal_set_message('Failed to modify settings.php, please verify the file permissions.', 'error'); + } + } + else { + drupal_set_message('Failed to open settings.php, please verify the file permissions.', 'error'); + } +} + +/** + * Verify settings.php, rewriting if necessary. + */ +function install_verify_settings() { + global $db_url, $db_prefix, $base_url, $db_type, $installed; + $settings_file = './'. conf_path() .'/settings.php'; + + $detected_base_url = drupal_detect_baseurl(); + + if (isset($_POST['save'])) { + $settings['db_url'] = array( + 'value' => $_POST['db_type'] .'://'. $_POST['db_user'] .($_POST['db_pass'] ? ':'. $_POST['db_pass'] : '') .'@'. ($_POST['db_host'] ? $_POST['db_host'] : 'localhost') .'/'. $_POST['db_path'], + 'required' => TRUE, + ); + if (isset($_POST['db_prefix']) && eregi('[^A-Za-z0-9_]+', $_POST['db_prefix'])) { + drupal_set_message('You database prefix you have entered,'. $_POST['db_prefix'] .', is invalid. The database prefix can only contain alphanumeric characters and underscores.', 'error');
+ }
+ $settings['db_prefix'] = array(
+ 'value' => $_POST['db_prefix'],
+ 'required' => TRUE,
+ );
+ $settings['base_url'] = array(
+ 'value' => empty($_POST['base_url']) ? rtrim($detected_base_url, '/') : rtrim($_POST['base_url'], '/'),
+ 'comment' => 'NO trailing slash!',
+ 'required' => TRUE,
+ );
+ drupal_rewrite_settings($settings);
+ }
+
+ include $settings_file;
+
+ // Verify base_url
+ if ($base_url == 'http://www.example.com') {
+ drupal_set_message("Your Base URL was automatically changed from the example 'http://www.example.com' to the detected URL '$detected_base_url'.", 'status');
+ $base_url = $detected_base_url;
+ }
+ elseif ($detected_base_url != $base_url) {
+ drupal_set_message("You have entered a Base URL of '$base_url' which does not match the detected Base URL of '$detected_base_url', please be sure that '$base_url' is correct.", 'status');
+ }
+
+ // Verify database settings
+ $db_type = substr($db_url, 0, strpos($db_url, '://'));
+ $databases = drupal_detect_database_types();
+ if (!in_array($db_type, $databases)) {
+ drupal_set_message("In your $settings_file file you have configured Drupal to use a $db_type database server, however your PHP installation currently does not support this database type.", 'error');
+ }
+ $url = parse_url($db_url);
+ $db_user = urldecode($url['user']);
+ $db_pass = urldecode($url['pass']);
+ if ($db_user == 'username' && $db_pass == 'password') {
+ if (isset($_POST['save'])) {
+ drupal_set_message('You have configured Drupal to use the default username and password. This is not allowed for security reasons.', 'error');
+ }
+ else {
+ drupal_maintenance_theme();
+ drupal_set_title('Site configuration');
+ print theme('install_page', 'Please fill out the following information to configure your Drupal site.
'. drupal_install_settings_form()); + exit; + } + } +} + +function drupal_install_settings_form($section = 'all') { + global $base_url, $db_url, $db_type, $db_prefix; + if (!isset($base_url)) { + $base_url = drupal_detect_baseurl(); + } + $url = parse_url($db_url); + $db_user = urldecode($url['user']); + $db_pass = urldecode($url['pass']); + $db_host = urldecode($url['host']); + $db_path = ltrim(urldecode($url['path']), '/'); + + if ($section == 'all' || $section == 'database') { + $form = ''; + } + + if ($section == 'all' || $section == 'webserver') { + $form .= ''; + } + + $form .= ''; + + return ''; +} + +/** + * Find all .profile's and allow admin to select which to install. + * + * @return + * The selected profile. + */ +function drupal_select_profile() { + include_once './includes/file.inc'; + $profiles = file_scan_directory('./profiles', '\.profile$', array('.', '..', 'CVS'), 0, TRUE, 'name', 0); + // Don't need to choose profile if only one available + if (sizeof($profiles) == 1) { + $profile = array_pop($profiles); + require_once $profile->filename; + return $profile->name; + } + elseif (sizeof($profiles) > 1) { + drupal_maintenance_theme(); + $element = ''; + foreach ($profiles as $profile) { + include_once($profile->filename); + if ($_POST['profile'] == "$profile->name") { + return "$profile->name"; + } + $element .= ""; + } + $form = theme('form_element', 'Profiles', $element); + $form .= ''; + + drupal_set_title('Select a profile'); + print theme('install_page', ''); + exit; + } + else { + return NULL; + } +} + +/** + * Merge requirements arrays. + */ +function _merge_requirements($requirements_old, $requirements_new) { + foreach ($requirements_new as $new => $data) { + if (isset($requirements_old["$new"])) { + // Use largest version + if (isset($data['required_version'])) { + if (version_compare($requirements_old["$new"]['required_version'], $data['required_version']) < 0) { + $requirements_old["$new"] = $data; + } + } + // Use largest value + elseif (isset($data['required_value'])) { + if ($requirements_old["$new"]['required_value'] < $data['required_value']) { + $requirements_old["$new"] = $data; + } + } + elseif (is_array($data)) { + $requirements_old["$new"] = _merge_requirements($requirements_old["$new"], $data); + } + } + else { + $requirements_old["$new"] = $data; + } + } + return $requirements_old; +} + +/** + * Merge table creation scripts. If the same table is defined multiple times, + * use the latest version of the schema. + */ +function _merge_tables($tables_old, $tables_new) { + foreach ($tables_new as $new => $data) { + if (isset($tables_old["$new"])) { + if ($tables_old["$new"]['schema'] < $data['schema']) { + $tables_old["$new"] = $data; + } + } + else { + $tables_old["$new"] = $data; + } + } + return $tables_old; +} + +/** + * Get list of all .install files. + * + * @param $module_list + * An array of modules to search for their .install files. + */ +function drupal_get_install_files($module_list = array()) { + $installs = array(); + foreach ($module_list as $module) { + $installs = array_merge($installs, file_scan_directory('./modules', "^$module.install$", array('.', '..', 'CVS'), 0, TRUE, 'name', 0)); + } + return $installs; +} + +/** + * Installed profile. + * + * @param profile + * Name of profile to install. + */ +function drupal_install_profile($profile) { + global $db_type; + + if (!isset($profile)) { + drupal_maintenance_theme(); + drupal_set_title('No profiles available'); + print theme('install_page', 'We were unable to find any installer profiles. Installer profiles tell us what modules to enable, and what schema to install in the database. A profile is necessary to continue with the installation process.
'); + exit; + } + + // Get a list of modules required by this profile + $function = $profile .'_enabled_modules'; + $module_list = $function(); + + // Verify that all required modules exist + $modules = array(); + foreach ($module_list as $current) { + $module = file_scan_directory('./modules', "^$current.module$", array('.', '..', 'CVS'), 0, TRUE, 'name', 0); + if (empty($module)) { + drupal_set_message("The $current module is required but was not found. Please move the file $current.module into the modules subdirectory.", 'error'); + } + else { + $modules = array_merge($modules, $module); + } + } + + // Get a list of all .install files + $installs = drupal_get_install_files($module_list); + + // Verify the _requirements_pre for this profile and all its modules + $requirements = array(); + $function = $profile .'_requirements_pre'; + if (function_exists("$function")) { + $requirements = $function(); + } + foreach ($installs as $install) { + require_once $install->filename; + $function = $install->name .'_requirements_pre'; + if (function_exists("$function")) { + $requirements = _merge_requirements($requirements, $function()); + } + } + drupal_verify_install($requirements); + if (_install_errors()) { + drupal_maintenance_theme(); + drupal_set_title('Verify your install environment'); + print theme('install_page', 'The errors above must be resolved before you can install Drupal. Find additional information about Drupal\'s minimum system requirements here.
'); + exit; + } + + // Install schemas for profile and all its modules + $tables = array(); + $function = $profile .'_create_tables'; + if (function_exists("$function")) { + $tables = $function(); + } + foreach ($installs as $install) { + $function = $install->name .'_create_tables'; + if (function_exists("$function")) { + $tables = _merge_tables($tables, $function()); + } + } + foreach ($tables as $table => $data) { + $result = @db_query("DESCRIBE {$table}"); + if (!db_num_rows($result)) { + db_query($data['create']); + if (is_array($data['default_value'])) { + foreach ($data['default_value'] as $query) { + db_query($query); + } + } + elseif (isset($data['default_value'])) { + db_query($data['default_value']); + } + } + else { + drupal_set_message("Failed to create database table$table, the table already exists.", 'status');
+ }
+ }
+
+ // Enable the modules required by the profile
+ db_query("DELETE FROM {system} WHERE type = 'module'");
+ foreach ($modules as $module) {
+ switch ($db_type) {
+ case 'mysql':
+ case 'mysqli':
+ db_query("INSERT INTO {system} (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES('". $module->filename ."', '". $module->name ."', 'module', '', 1, 0, 0, 0)");
+ break;
+ case 'pgsql':
+ break;
+ }
+ }
+
+ // Update settings.php to show that the installer has already been run
+ $settings = array();
+ $settings['installed'] = array(
+ 'value' => $profile,
+ 'required' => TRUE
+ );
+ drupal_rewrite_settings($settings);
+}
+
+function drupal_install_profile_post($profile = NULL) {
+ if (!isset($profile)) {
+ // Nothing to do, exit
+ return;
+ }
+ require_once "./profiles/$profile.profile";
+ require_once "./includes/file.inc";
+
+ // Get a list of modules required by this profile
+ $function = $profile .'_enabled_modules';
+ $module_list = $function();
+
+ // Get a list of all .install files
+ $installs = drupal_get_install_files($module_list);
+
+ // Verify the _requirements_post for this profile and all its modules
+ $requirements = array();
+ $function = $profile .'_requirements_post';
+ if (function_exists("$function")) {
+ $requirements = $function();
+ }
+ foreach ($installs as $install) {
+ require_once $install->filename;
+ $function = $install->name .'_requirements_post';
+ if (function_exists("$function")) {
+ $requirements = _merge_requirements($requirements, $function());
+ }
+ }
+ drupal_verify_install($requirements);
+}
+
+/**
+ * Call the appropriate installation function. If the function is not
+ * available, attempt to load the appropriate include file then try again.
+ *
+ * @param $requirements
+ * An array of requirements.
+ */
+function drupal_verify_install($requirements = array()) {
+ foreach ($requirements as $type => $data) {
+ $function = "drupal_verify_install_$type";
+ if (function_exists("$function")) {
+ $function($data);
+ }
+ else {
+ switch ($type) {
+ case 'mysql':
+ case 'mysqli':
+ case 'pgsql':
+ // The include files for all available database types have already
+ // been included. Thus, we are not using this database type and this
+ // requirement does not apply to the current installation.
+ continue;
+ case 'apache':
+ default:
+ $include = './includes/install.'. $type .'.inc';
+ if (file_exists($include)) {
+ require_once($include);
+ if (function_exists("$function")) {
+ $function($data);
+ }
+ else {
+ drupal_set_message(strtr('Installation error: function "%function" does not exist.', array('%function' => $function)), 'error');
+ }
+ }
+ else {
+ drupal_set_message(strtr('Installation error: unable to find file "%file", function "%function" does not exist.', array('%file' => $include, '%function' => $function)), 'error');
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Some php.ini options are written in shorthand (ie 1K instead of 1024 bytes).
+ * This function converts php.ini shorthand into bytes.
+ *
+ * @param $shorthand
+ * A memory string in php.ini shorthand notation (ie 1K, 8M, 10G)
+ *
+ * @return
+ * The shorthand value converted to bytes.
+ */
+function drupal_shorthand_to_bytes($shorthand) {
+ $result = trim($shorthand);
+ $modifier = strtolower($result{strlen($result)-1});
+ switch ($modifier) {
+ case 'g':
+ $result *= 1024;
+ case 'm':
+ $result *= 1024;
+ case 'k':
+ $result *= 1024;
+ }
+ return $result;
+}
+
+/**
+ * Verify that the installed version of PHP meets our minimum requirements.
+ *
+ * @param $version
+ * An array with some or all of the following directives:
+ * 'required_version' = the required version of PHP
+ * 'message' = message to display if version is invalid
+ * ("%required_version" and "%installed_version" will be
+ * automatically replaced if included in the message
+ * text.)
+ * 'message_type' = message type (ie, 'error', 'status')
+ */
+function drupal_verify_version_php($version = array()) {
+ if (!function_exists(version_compare) ||
+ version_compare(phpversion(), $version['required_version'], '<')) {
+ // version_compare() was added in PHP 4.1.
+ $message_type = $version['message_type'] ? $version['message_type'] : 'status';
+ drupal_set_message(strtr($version['message'], array('%required_version' => $version['required_version'], '%installed_version' => phpversion())), $message_type);
+ }
+}
+
+/**
+ * Verify the value of the specified configuration option as found in php.ini.
+ *
+ * @param $setting
+ * An array with some or all of the following directives:
+ * 'required_value' = the required value of the configuration option
+ * 'shorthand' = TRUE/FALSE whether the option is in shorthand notation
+ * 'operator' = optional comparison operator
+ * 'message' = message to display if comparison fails
+ * ("%required_value" and "%current_value" will be
+ * automatically replaced if included in the message
+ * text.)
+ * 'message_type' = message type (ie, 'error', 'status')
+ */
+function drupal_verify_install_php($requirements = array()) {
+ foreach ($requirements as $requirement => $data) {
+ // Handle special case (not from php.ini)
+ if ($requirement == 'version') {
+ drupal_verify_version_php($data);
+ }
+ else {
+ if ($data['shorthand']) {
+ $required = drupal_shorthand_to_bytes($data['required_value']);
+ $current = drupal_shorthand_to_bytes(ini_get($requirement));
+ }
+ else {
+ $required = $data['required_value'];
+ $current = ini_get($requirement);
+ }
+
+ switch ($data['operator']) {
+ case '<':
+ $valid = ($current < $required);
+ break;
+ case '<=':
+ $valid = ($current <= $required);
+ break;
+ case '==':
+ default:
+ $valid = ($current == $required);
+ break;
+ case '>=':
+ $valid = ($current >= $required);
+ break;
+ case '>':
+ $valid = ($current > $required);
+ break;
+ case '!=':
+ case '<>':
+ $valid = ($current != $required);
+ break;
+ case '===':
+ $valid = ($current === $required);
+ break;
+ case '!==':
+ $valid = ($current !== $required);
+ break;
+ }
+
+ if (!$valid && isset($data['message'])) {
+ $message_type = $data['message_type'] ? $data['message_type'] : 'status';
+ drupal_set_message(strtr($data['message'], array('%current_value' => ini_get($requirement), '%required_value' => $data['required_value'])), $message_type);
+ }
+ }
+ }
+}
+
+/**
+ * Verify the state of the specified file.
+ *
+ * @param $requirements
+ * An array with some or all of the following directives:
+ * 'required' = whether or not this file is required
+ * 'mask' = permissions information about the file
+ * 'type' = file type (file, directory, link)
+ * 'message' = message to display if something is wrong with file
+ * ("%required_value" and "%current_value" will be
+ * automatically replaced if included in the message
+ * text.)
+ * 'message_type' = message type (ie, 'error', 'status')
+ */
+function drupal_verify_install_file($requirements = array()) {
+ foreach ($requirements as $file => $data) {
+ // Handle special case files (ie settings.php)
+ switch ($file) {
+ case '%settings.php':
+ $file = './'. conf_path() .'/settings.php';
+ break;
+ }
+
+ $err = FALSE;
+ $message_type = ($data['required'] ? 'error' : 'status');
+ // Check for files that shouldn't be there
+ if (isset($data['mask']) && $data['mask'] & FILE_NOT_EXIST) {
+ if (file_exists($file)) {
+ drupal_set_message(strtr('%type %file exists but should not.', array('%type' => $data['type'], '%file' => $file)), $message_type);
+ $err = TRUE;
+ }
+ }
+ else {
+ // Verfiy that the file is the type of file it is supposed to be
+ if (isset($data['type']) && file_exists($file)) {
+ switch ($data['type']) {
+ case 'file':
+ if (!is_file($file)) {
+ $err = TRUE;
+ }
+ break;
+ case 'directory':
+ if (!is_dir($file)) {
+ $err = TRUE;
+ }
+ break;
+ case 'link':
+ if (!is_link($file)) {
+ $err = TRUE;
+ }
+ break;
+ }
+ if ($err) {
+ drupal_set_message(strtr('%file exists but is not a %type.', array('%type' => $data['type'], '%file' => $file)), $message_type);
+ }
+ }
+
+ // Verify file permissions
+ if (isset($data['mask'])) {
+ $filetype = ucfirst($data['type']);
+ $masks = array(FILE_EXIST, FILE_READABLE, FILE_WRITABLE, FILE_EXECUTABLE, FILE_NOT_EXIST, FILE_NOT_READABLE, FILE_NOT_WRITABLE, FILE_NOT_EXECUTABLE);
+ foreach ($masks as $mask) {
+ if ($data['mask'] & $mask && !$err) {
+ switch ($mask) {
+ case FILE_EXIST:
+ if (!file_exists($file)) {
+ if ($filetype == 'Directory') {
+ drupal_install_mkdir($file, $data['mask']);
+ }
+ if (!file_exists($file)) {
+ drupal_set_message(strtr('%type %file does not exist.', array('%type' => $filetype, '%file' => $file)), $message_type);
+ $err = TRUE;
+ }
+ }
+ break;
+ case FILE_READABLE:
+ if (!is_readable($file) && !drupal_install_fix_file($file, $data['mask'])) {
+ drupal_set_message(strtr('%type %file is not readable.', array('%type' => $filetype, '%file' => $file)), $message_type);
+ $err = TRUE;
+ }
+ break;
+ case FILE_WRITABLE:
+ if (!is_writable($file) && !drupal_install_fix_file($file, $data['mask'])) {
+ drupal_set_message(strtr('%type %file is not writable.', array('%type' => $filetype, '%file' => $file)), $message_type);
+ $err = TRUE;
+ }
+ break;
+ case FILE_EXECUTABLE:
+ if (!is_executable($file) && !drupal_install_fix_file($file, $data['mask'])) {
+ drupal_set_message(strtr('%type %file is not executable.', array('%type' => $filetype, '%file' => $file)), $message_type);
+ $err = TRUE;
+ }
+ break;
+ case FILE_NOT_READABLE:
+ if (is_readable($file) && !drupal_install_fix_file($file, $data['mask'])) {
+ drupal_set_message(strtr('%type %file is readable but should not be.', array('%type' => $filetype, '%file' => $file)), $message_type);
+ $err = TRUE;
+ }
+ break;
+ case FILE_NOT_WRITABLE:
+ if (is_writable($file) && !drupal_install_fix_file($file, $data['mask'])) {
+ drupal_set_message(strtr('%type %file is writable but should not be.', array('%type' => $filetype, '%file' => $file)), $message_type);
+ $err = TRUE;
+ }
+ break;
+ case FILE_NOT_EXECUTABLE:
+ if (is_executable($file) && !drupal_install_fix_file($file, $data['mask'])) {
+ drupal_set_message(strtr('%type %file is executable but should not be.', array('%type' => $filetype, '%file' => $file)), $message_type);
+ $err = TRUE;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ if ($err && isset($data['message'])) {
+ $message_type = $data['message_type'] ? $data['message_type'] : 'status';
+ drupal_set_message($data['message'], $message_type);
+ }
+ }
+}
+
+function drupal_install_mkdir($file, $mask) {
+ $mod = 0;
+ $masks = array(FILE_READABLE, FILE_WRITABLE, FILE_EXECUTABLE, FILE_NOT_READABLE, FILE_NOT_WRITABLE, FILE_NOT_EXECUTABLE);
+ foreach ($masks as $m) {
+ if ($mask & $m) {
+ switch ($m) {
+ case FILE_READABLE:
+ $mod += 444;
+ break;
+ case FILE_WRITABLE:
+ $mod += 222;
+ break;
+ case FILE_EXECUTABLE:
+ $mod += 111;
+ break;
+ }
+ }
+ }
+
+ if (@mkdir($file, intval("0$mod", 8))) {
+ drupal_set_message("Automatically created directory $file.", 'status');
+ return TRUE;
+ }
+ else {
+ drupal_set_message("Failed to automatically create directory $file, insufficient privileges.", 'status');
+ }
+}
+
+/**
+ * Attempt to fix file permissions.
+ *
+ * @param $file
+ * The name of the file with permissions to fix.
+ * @param $mask
+ * The desired permissions for the file.
+ *
+ * @return
+ * TRUE/FALSE whether or not we were able to fix the file's permissions.
+ */
+function drupal_install_fix_file($file, $mask) {
+ $mod = substr(sprintf('%o', fileperms($file)), -4);
+ $prefix = substr($mod, 0, 1);
+ $mod = substr($mod, 1 ,4);
+ $masks = array(FILE_READABLE, FILE_WRITABLE, FILE_EXECUTABLE, FILE_NOT_READABLE, FILE_NOT_WRITABLE, FILE_NOT_EXECUTABLE);
+ foreach ($masks as $m) {
+ if ($mask & $m) {
+ switch ($m) {
+ case FILE_READABLE:
+ if (!is_readable($file)) {
+ $mod += 444;
+ }
+ break;
+ case FILE_WRITABLE:
+ if (!is_writable($file)) {
+ $mod += 222;
+ }
+ break;
+ case FILE_EXECUTABLE:
+ if (!is_executable($file)) {
+ $mod += 111;
+ }
+ break;
+ case FILE_NOT_READABLE:
+ if (is_readable($file)) {
+ $mod -= 444;
+ }
+ break;
+ case FILE_NOT_WRITABLE:
+ if (is_writable($file)) {
+ $mod -= 222;
+ }
+ break;
+ case FILE_NOT_EXECUTABLE:
+ if (is_executable($file)) {
+ $mod -= 111;
+ }
+ break;
+ }
+ }
+ }
+
+ if (@chmod($file, intval("$prefix$mod", 8))) {
+ drupal_set_message("Automatically fixed the permissions of file $file.", 'status');
+ return TRUE;
+ }
+ else {
+ drupal_set_message("Failed to automatically fix permissions of file $file, insufficient privileges.", 'status');
+ return FALSE;
+ }
+}
+
+/**
+ * Verify that a function exists.
+ *
+ * @param $requirements
+ * An array with some or all of the following directives:
+ * 'message' = message to display if the function does not exist.
+ * 'message_type' = message type (ie, 'error', 'status')
+ */
+function drupal_verify_install_function($requirements = array()) {
+ foreach ($requirements as $function => $data) {
+ if (!function_exists("$function")) {
+ $message_type = $data['message_type'] ? $data['message_type'] : 'status';
+ drupal_set_message($data['message'], $message_type);
+ }
+ }
+}
+
+?>
--- includes/theme.inc.orig 2006-04-21 11:22:53.000000000 -0400
+++ includes/theme.inc 2006-04-21 11:23:10.000000000 -0400
@@ -453,17 +453,63 @@
return $output;
}
+function theme_install_page($content) {
+ drupal_set_header('Content-Type: text/html; charset=utf-8');
+ theme('add_style', 'misc/maintenance.css');
+ drupal_set_html_head('');
+ $output = "\n";
+ $output .= '';
+ $output .= '';
+ $output .= ' '. $query .'" and MySQL reported the following error: "'. $error .'".', 'error');
+ $err = TRUE;
+ }
+ else {
+ $success[] = 'INSERT';
+ }
+
+ // Test UPDATE
+ $query = 'UPDATE drupal_install_test SET id = 2;';
+ $result = mysql_query("$query");
+ if ($error = mysql_error()) {
+ drupal_set_message('We were unable to update a value in a test table on your MySQL database server. We tried updating a value with the command "'. $query .'" and MySQL reported the following error: "'. $error .'".', 'error');
+ $err = TRUE;
+ }
+ else {
+ $success[] = 'UPDATE';
+ }
+
+ // Test LOCK
+ $query = 'LOCK TABLES drupal_install_test WRITE;';
+ $result = mysql_query("$query");
+ if ($error = mysql_error()) {
+ drupal_set_message('We were unable to lock a test table on your MySQL database server. We tried locking a table with the command "'. $query .'" and MySQL reported the following error: "'. $error .'".', 'error');
+ $err = TRUE;
+ }
+ else {
+ $success[] = 'LOCK';
+ }
+
+ // Test UNLOCK
+ $query = 'UNLOCK TABLES;';
+ $result = mysql_query("$query");
+ if ($error = mysql_error()) {
+ drupal_set_message('We were unable to unlock a test table on your MySQL database server. We tried unlocking a table with the command "'. $query .'" and MySQL reported the following error: "'. $error .'".', 'error');
+ $err = TRUE;
+ }
+ else {
+ $success[] = 'UNLOCK';
+ }
+
+ // Test DELETE
+ $query = 'DELETE FROM drupal_install_test;';
+ $result = mysql_query("$query");
+ if ($error = mysql_error()) {
+ drupal_set_message('We were unable to delete a value from a test table on your MySQL database server. We tried deleting a value with the command "'. $query .'" and MySQL reported the following error: "'. $error .'".', 'error');
+ $err = TRUE;
+ }
+ else {
+ $success[] = 'DELETE';
+ }
+
+ // Test DROP
+ $query = 'DROP TABLE drupal_install_test;';
+ $result = mysql_query("$query");
+ if ($error = mysql_error()) {
+ drupal_set_message('We were unable to drop a test table from your MySQL database server. We tried dropping a table with the command "'. $query .'" and MySQL reported the following error: "'. $error .'".', 'error');
+ $err = TRUE;
+ }
+ else {
+ $success[] = 'DROP';
+ }
+
+ if ($err) {
+ drupal_set_message('In order for Drupal to work and to proceed with the installation process you must resolve all MySQL permission issues reported above. We were able to verify that we have permission for the following MySQL commands: '. implode($success, ', ') .'. For more help with configuring your MySQL database server, see the Installation and upgrading handbook. If you are unsure what any of this means you should probably contact your hosting provider.', 'error');
+ return FALSE;
+ }
+
+ mysql_close($connection);
+ return TRUE;
+ }
+ else {
+ drupal_set_message('Failure to connect to your MySQL database server. MySQL reports the following message: '. mysql_error() .'settings.php have been made, so you should now remove write permissions to this file. Failure to remove write permissions to this file is a security risk.',
+ 'message_type' => 'error'
+ );
+
+ return $requirements;
+}
+
+function system_create_tables() {
+ global $db_type;
+ $tables = array();
+
+ if ($db_type == 'mysql') {
+ $tables['access'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {access} (
+ aid tinyint(10) NOT NULL auto_increment,
+ mask varchar(255) NOT NULL default '',
+ type varchar(255) NOT NULL default '',
+ status tinyint(2) NOT NULL default '0',
+ PRIMARY KEY (aid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['accesslog'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {accesslog} (
+ aid int(10) NOT NULL auto_increment,
+ sid varchar(32) NOT NULL default '',
+ title varchar(255) default NULL,
+ path varchar(255) default NULL,
+ url varchar(255) default NULL,
+ hostname varchar(128) default NULL,
+ uid int(10) unsigned default '0',
+ timer int(10) unsigned NOT NULL default '0',
+ timestamp int(11) unsigned NOT NULL default '0',
+ KEY accesslog_timestamp (timestamp),
+ PRIMARY KEY (aid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['aggregator_category'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {aggregator_category} (
+ cid int(10) NOT NULL auto_increment,
+ title varchar(255) NOT NULL default '',
+ description longtext NOT NULL,
+ block tinyint(2) NOT NULL default '0',
+ PRIMARY KEY (cid),
+ UNIQUE KEY title (title)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['aggregator_category_feed'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {aggregator_category_feed} (
+ fid int(10) NOT NULL default '0',
+ cid int(10) NOT NULL default '0',
+ PRIMARY KEY (fid,cid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['aggregator_category_item'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {aggregator_category_item} (
+ iid int(10) NOT NULL default '0',
+ cid int(10) NOT NULL default '0',
+ PRIMARY KEY (iid,cid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['aggregator_feed'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {aggregator_feed} (
+ fid int(10) NOT NULL auto_increment,
+ title varchar(255) NOT NULL default '',
+ url varchar(255) NOT NULL default '',
+ refresh int(10) NOT NULL default '0',
+ checked int(10) NOT NULL default '0',
+ link varchar(255) NOT NULL default '',
+ description longtext NOT NULL,
+ image longtext NOT NULL,
+ etag varchar(255) NOT NULL default '',
+ modified int(10) NOT NULL default '0',
+ block tinyint(2) NOT NULL default '0',
+ PRIMARY KEY (fid),
+ UNIQUE KEY link (url),
+ UNIQUE KEY title (title)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['aggregator_item'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {aggregator_item} (
+ iid int(10) NOT NULL auto_increment,
+ fid int(10) NOT NULL default '0',
+ title varchar(255) NOT NULL default '',
+ link varchar(255) NOT NULL default '',
+ author varchar(255) NOT NULL default '',
+ description longtext NOT NULL,
+ timestamp int(11) default NULL,
+ PRIMARY KEY (iid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['authmap'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {authmap} (
+ aid int(10) unsigned NOT NULL auto_increment,
+ uid int(10) NOT NULL default '0',
+ authname varchar(128) NOT NULL default '',
+ module varchar(128) NOT NULL default '',
+ PRIMARY KEY (aid),
+ UNIQUE KEY authname (authname)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['blocks'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {blocks} (
+ module varchar(64) DEFAULT '' NOT NULL,
+ delta varchar(32) NOT NULL default '0',
+ theme varchar(255) NOT NULL default '',
+ status tinyint(2) DEFAULT '0' NOT NULL,
+ weight tinyint(1) DEFAULT '0' NOT NULL,
+ region varchar(64) DEFAULT 'left' NOT NULL,
+ custom tinyint(2) DEFAULT '0' NOT NULL,
+ throttle tinyint(1) DEFAULT '0' NOT NULL,
+ visibility tinyint(1) DEFAULT '0' NOT NULL,
+ pages text DEFAULT '' NOT NULL
+ ) TYPE=MyISAM;",
+ 'default_value' => array(
+ "REPLACE {blocks} SET module = 'user', delta = '0', theme = 'bluemarine', status = '1';",
+ "REPLACE {blocks} SET module = 'user', delta = '1', theme = 'bluemarine', status = '1';")
+
+ );
+
+ $tables['book'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {book} (
+ vid int(10) unsigned NOT NULL default '0',
+ nid int(10) unsigned NOT NULL default '0',
+ parent int(10) NOT NULL default '0',
+ weight tinyint(3) NOT NULL default '0',
+ PRIMARY KEY (vid),
+ KEY nid (nid),
+ KEY parent (parent)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['boxes'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {boxes} (
+ bid tinyint(4) NOT NULL auto_increment,
+ title varchar(64) NOT NULL default '',
+ body longtext,
+ info varchar(128) NOT NULL default '',
+ format int(4) NOT NULL default '0',
+ PRIMARY KEY (bid),
+ UNIQUE KEY info (info)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['cache'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {cache} (
+ cid varchar(255) NOT NULL default '',
+ data longblob,
+ expire int(11) NOT NULL default '0',
+ created int(11) NOT NULL default '0',
+ headers text,
+ PRIMARY KEY (cid),
+ INDEX expire (expire)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['comments'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {comments} (
+ cid int(10) NOT NULL auto_increment,
+ pid int(10) NOT NULL default '0',
+ nid int(10) NOT NULL default '0',
+ uid int(10) NOT NULL default '0',
+ subject varchar(64) NOT NULL default '',
+ comment longtext NOT NULL,
+ hostname varchar(128) NOT NULL default '',
+ timestamp int(11) NOT NULL default '0',
+ score mediumint(9) NOT NULL default '0',
+ status tinyint(3) unsigned NOT NULL default '0',
+ format int(4) NOT NULL default '0',
+ thread varchar(255) NOT NULL,
+ users longtext,
+ name varchar(60) default NULL,
+ mail varchar(64) default NULL,
+ homepage varchar(255) default NULL,
+ PRIMARY KEY (cid),
+ KEY lid (nid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['contact'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {contact} (
+ cid int(10) unsigned NOT NULL auto_increment,
+ category varchar(255) NOT NULL default '',
+ recipients longtext NOT NULL default '',
+ reply longtext NOT NULL default '',
+ weight tinyint(3) NOT NULL default '0',
+ selected tinyint(1) NOT NULL default '0',
+ PRIMARY KEY (cid),
+ UNIQUE KEY category (category)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['node_comment_statistics'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {node_comment_statistics} (
+ nid int(10) unsigned NOT NULL auto_increment,
+ last_comment_timestamp int(11) NOT NULL default '0',
+ last_comment_name varchar(60) default NULL,
+ last_comment_uid int(10) NOT NULL default '0',
+ comment_count int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (nid),
+ KEY node_comment_timestamp (last_comment_timestamp)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['client'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {client} (
+ cid int(10) unsigned NOT NULL auto_increment,
+ link varchar(255) NOT NULL default '',
+ name varchar(128) NOT NULL default '',
+ mail varchar(128) NOT NULL default '',
+ slogan longtext NOT NULL,
+ mission longtext NOT NULL,
+ users int(10) NOT NULL default '0',
+ nodes int(10) NOT NULL default '0',
+ version varchar(35) NOT NULL default'',
+ created int(11) NOT NULL default '0',
+ changed int(11) NOT NULL default '0',
+ PRIMARY KEY (cid)
+ ) TYPE=MyISAM;",
+ );
+
+
+ $tables['client_system'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {client_system} (
+ cid int(10) NOT NULL default '0',
+ name varchar(255) NOT NULL default '',
+ type varchar(255) NOT NULL default '',
+ PRIMARY KEY (cid,name)
+ ) TYPE=MyISAM;",
+ );
+
+
+ $tables['files'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {files} (
+ fid int(10) unsigned NOT NULL default '0',
+ nid int(10) unsigned NOT NULL default '0',
+ vid int(10) unsigned NOT NULL default '0',
+ filename varchar(255) NOT NULL default '',
+ description varchar(255) NOT NULL default '',
+ filepath varchar(255) NOT NULL default '',
+ filemime varchar(255) NOT NULL default '',
+ filesize int(10) unsigned NOT NULL default '0',
+ list tinyint(1) unsigned NOT NULL default '0',
+ KEY vid (vid),
+ KEY fid (fid)
+ ) TYPE=MyISAM;",
+ );
+
+
+ $tables['filter_formats'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {filter_formats} (
+ format int(4) NOT NULL auto_increment,
+ name varchar(255) NOT NULL default '',
+ roles varchar(255) NOT NULL default '',
+ cache tinyint(2) NOT NULL default '0',
+ PRIMARY KEY (format)
+ ) TYPE=MyISAM;",
+ 'default_value' => array(
+ "INSERT INTO {filter_formats} VALUES (1,'Filtered HTML',',1,2,',1);",
+ "INSERT INTO {filter_formats} VALUES (3,'Full HTML','',1);")
+ );
+
+ $tables['filters'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {filters} (
+ format int(4) NOT NULL default '0',
+ module varchar(64) NOT NULL default '',
+ delta tinyint(2) DEFAULT '0' NOT NULL,
+ weight tinyint(2) DEFAULT '0' NOT NULL,
+ INDEX (weight)
+ ) TYPE=MyISAM;",
+ 'default_value' => array(
+ "INSERT INTO {filters} VALUES (1,'filter',0,0);",
+ "INSERT INTO {filters} VALUES (1,'filter',2,1);",
+ "INSERT INTO {filters} VALUES (2,'filter',1,0);",
+ "INSERT INTO {filters} VALUES (3,'filter',2,0);")
+ );
+
+ $tables['flood'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {flood} (
+ event varchar(64) NOT NULL default '',
+ hostname varchar(128) NOT NULL default '',
+ timestamp int(11) NOT NULL default '0'
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['forum'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {forum} (
+ nid int(10) unsigned NOT NULL default '0',
+ vid int(10) unsigned NOT NULL default '0',
+ tid int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (vid),
+ KEY nid (nid),
+ KEY tid (tid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['history'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {history} (
+ uid int(10) NOT NULL default '0',
+ nid int(10) NOT NULL default '0',
+ timestamp int(11) NOT NULL default '0',
+ PRIMARY KEY (uid,nid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['locales_meta'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {locales_meta} (
+ locale varchar(12) NOT NULL default '',
+ name varchar(64) NOT NULL default '',
+ enabled int(2) NOT NULL default '0',
+ isdefault int(2) NOT NULL default '0',
+ plurals int(1) NOT NULL default '0',
+ formula varchar(128) NOT NULL default '',
+ PRIMARY KEY (locale)
+ ) TYPE=MyISAM;",
+ 'default_value' => array(
+ "INSERT INTO {locales_meta} (locale, name, enabled, isdefault) VALUES ('en', 'English', '1', '1');")
+ );
+
+ $tables['locales_source'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {locales_source} (
+ lid int(11) NOT NULL auto_increment,
+ location varchar(255) NOT NULL default '',
+ source blob NOT NULL,
+ PRIMARY KEY (lid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['locales_target'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {locales_target} (
+ lid int(11) NOT NULL default '0',
+ translation blob NOT NULL,
+ locale varchar(12) NOT NULL default '',
+ plid int(11) NOT NULL default '0',
+ plural int(1) NOT NULL default '0',
+ KEY lid (lid),
+ KEY lang (locale),
+ KEY plid (plid),
+ KEY plural (plural)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['menu'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {menu} (
+ mid int(10) unsigned NOT NULL default '0',
+ pid int(10) unsigned NOT NULL default '0',
+ path varchar(255) NOT NULL default '',
+ title varchar(255) NOT NULL default '',
+ description varchar(255) NOT NULL default '',
+ weight tinyint(4) NOT NULL default '0',
+ type int(2) unsigned NOT NULL default '0',
+ PRIMARY KEY (mid)
+ ) TYPE=MyISAM;",
+ 'default_value' => "INSERT INTO {menu} VALUES (2, 0, '', 'Primary links', '', 0, 115);"
+ );
+
+ $tables['node'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {node} (
+ nid int(10) unsigned NOT NULL auto_increment,
+ vid int(10) unsigned NOT NULL default '0',
+ type varchar(32) NOT NULL default '',
+ title varchar(128) NOT NULL default '',
+ uid int(10) NOT NULL default '0',
+ status int(4) NOT NULL default '1',
+ created int(11) NOT NULL default '0',
+ changed int(11) NOT NULL default '0',
+ comment int(2) NOT NULL default '0',
+ promote int(2) NOT NULL default '0',
+ moderate int(2) NOT NULL default '0',
+ sticky int(2) NOT NULL default '0',
+ PRIMARY KEY (nid),
+ KEY node_type (type(4)),
+ KEY node_title_type (title,type(4)),
+ KEY status (status),
+ KEY uid (uid),
+ KEY vid (vid),
+ KEY node_moderate (moderate),
+ KEY node_promote_status (promote, status),
+ KEY node_created (created),
+ KEY node_changed (changed),
+ KEY node_status_type (status, type, nid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['node_access'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {node_access} (
+ nid int(10) unsigned NOT NULL default '0',
+ gid int(10) unsigned NOT NULL default '0',
+ realm varchar(255) NOT NULL default '',
+ grant_view tinyint(1) unsigned NOT NULL default '0',
+ grant_update tinyint(1) unsigned NOT NULL default '0',
+ grant_delete tinyint(1) unsigned NOT NULL default '0',
+ PRIMARY KEY (nid,gid,realm)
+ ) TYPE=MyISAM;",
+ 'default_value' => "INSERT INTO {node_access} VALUES (0, 0, 'all', 1, 0, 0);"
+ );
+
+ $tables['node_revisions'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {node_revisions} (
+ nid int(10) unsigned NOT NULL,
+ vid int(10) unsigned NOT NULL,
+ uid int(10) NOT NULL default '0',
+ title varchar(128) NOT NULL default '',
+ body longtext NOT NULL default '',
+ teaser longtext NOT NULL default '',
+ log longtext NOT NULL default '',
+ timestamp int(11) NOT NULL default '0',
+ format int(4) NOT NULL default '0',
+ PRIMARY KEY (nid,vid),
+ KEY uid (uid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['profile_fields'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {profile_fields} (
+ fid int(10) NOT NULL auto_increment,
+ title varchar(255) default NULL,
+ name varchar(128) default NULL,
+ explanation TEXT default NULL,
+ category varchar(255) default NULL,
+ page varchar(255) default NULL,
+ type varchar(128) default NULL,
+ weight tinyint(1) DEFAULT '0' NOT NULL,
+ required tinyint(1) DEFAULT '0' NOT NULL,
+ register tinyint(1) DEFAULT '0' NOT NULL,
+ visibility tinyint(1) DEFAULT '0' NOT NULL,
+ options text,
+ KEY category (category),
+ UNIQUE KEY name (name),
+ PRIMARY KEY (fid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['profile_values'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {profile_values} (
+ fid int(10) unsigned default '0',
+ uid int(10) unsigned default '0',
+ value text,
+ KEY uid (uid),
+ KEY fid (fid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['url_alias'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {url_alias} (
+ pid int(10) unsigned NOT NULL auto_increment,
+ src varchar(128) NOT NULL default '',
+ dst varchar(128) NOT NULL default '',
+ PRIMARY KEY (pid),
+ UNIQUE KEY dst (dst),
+ KEY src (src)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['permission'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {permission} (
+ rid int(10) unsigned NOT NULL default '0',
+ perm longtext,
+ tid int(10) unsigned NOT NULL default '0',
+ KEY rid (rid)
+ ) TYPE=MyISAM;",
+ 'default_value' => array(
+ "INSERT INTO {permission} VALUES (1,'access content',0);",
+ "INSERT INTO {permission} VALUES (2,'access comments, access content, post comments, post comments without approval',0);")
+ );
+
+ $tables['poll'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {poll} (
+ nid int(10) unsigned NOT NULL default '0',
+ runtime int(10) NOT NULL default '0',
+ active int(2) unsigned NOT NULL default '0',
+ PRIMARY KEY (nid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['poll_votes'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {poll_votes} (
+ nid int(10) unsigned NOT NULL,
+ uid int(10) unsigned NOT NULL default 0,
+ hostname varchar(128) NOT NULL default '',
+ INDEX (nid),
+ INDEX (uid),
+ INDEX (hostname)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['poll_choices'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {poll_choices} (
+ chid int(10) unsigned NOT NULL auto_increment,
+ nid int(10) unsigned NOT NULL default '0',
+ chtext varchar(128) NOT NULL default '',
+ chvotes int(6) NOT NULL default '0',
+ chorder int(2) NOT NULL default '0',
+ PRIMARY KEY (chid),
+ KEY nid (nid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['role'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {role} (
+ rid int(10) unsigned NOT NULL auto_increment,
+ name varchar(32) NOT NULL default '',
+ PRIMARY KEY (rid),
+ UNIQUE KEY name (name)
+ ) TYPE=MyISAM;",
+ 'default_value' => array(
+ "INSERT INTO {role} (rid, name) VALUES (1, 'anonymous user');",
+ "INSERT INTO {role} (rid, name) VALUES (2, 'authenticated user');")
+ );
+
+ $tables['search_dataset'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {search_dataset} (
+ sid int(10) unsigned NOT NULL default '0',
+ type varchar(16) default NULL,
+ data longtext NOT NULL,
+ KEY sid_type (sid, type)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['search_index'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {search_index} (
+ word varchar(50) NOT NULL default '',
+ sid int(10) unsigned NOT NULL default '0',
+ type varchar(16) default NULL,
+ fromsid int(10) unsigned NOT NULL default '0',
+ fromtype varchar(16) default NULL,
+ score float default NULL,
+ KEY sid_type (sid, type),
+ KEY from_sid_type (fromsid, fromtype),
+ KEY word (word)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['search_total'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {search_total} (
+ word varchar(50) NOT NULL default '',
+ count float default NULL,
+ PRIMARY KEY (word)
+ ) TYPE=MyISAM;",
+ );
+
+
+ $tables['sessions'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {sessions} (
+ uid int(10) unsigned NOT NULL,
+ sid varchar(32) NOT NULL default '',
+ hostname varchar(128) NOT NULL default '',
+ timestamp int(11) NOT NULL default '0',
+ cache int(11) NOT NULL default '0',
+ session longtext,
+ KEY uid (uid),
+ PRIMARY KEY (sid),
+ KEY timestamp (timestamp)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['sequences'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {sequences} (
+ name varchar(255) NOT NULL default '',
+ id int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (name)
+ ) TYPE=MyISAM;",
+ 'default_value' => "INSERT INTO {sequences} (name, id) VALUES ('menu_mid', 2);"
+ );
+
+ $tables['node_counter'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {node_counter} (
+ nid int(11) NOT NULL default '0',
+ totalcount bigint(20) unsigned NOT NULL default '0',
+ daycount mediumint(8) unsigned NOT NULL default '0',
+ timestamp int(11) unsigned NOT NULL default '0',
+ PRIMARY KEY (nid),
+ KEY totalcount (totalcount),
+ KEY daycount (daycount),
+ KEY timestamp (timestamp)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['system'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {system} (
+ filename varchar(255) NOT NULL default '',
+ name varchar(255) NOT NULL default '',
+ type varchar(255) NOT NULL default '',
+ description varchar(255) NOT NULL default '',
+ status int(2) NOT NULL default '0',
+ throttle tinyint(1) DEFAULT '0' NOT NULL,
+ bootstrap int(2) NOT NULL default '0',
+ schema_version smallint(3) NOT NULL default -1,
+ weight int(2) NOT NULL default '0',
+ PRIMARY KEY (filename),
+ KEY (weight)
+ ) TYPE=MyISAM;",
+ 'default_value' => array(
+ "INSERT INTO {system} (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/engines/phptemplate/phptemplate.engine', 'phptemplate', 'theme_engine', '', 1, 0, 0, 0);",
+ "INSERT INTO {system} (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/bluemarine/page.tpl.php', 'bluemarine', 'theme', 'themes/engines/phptemplate/phptemplate.engine', 1, 0, 0, 0);")
+ );
+
+ $tables['term_data'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {term_data} (
+ tid int(10) unsigned NOT NULL auto_increment,
+ vid int(10) unsigned NOT NULL default '0',
+ name varchar(255) NOT NULL default '',
+ description longtext,
+ weight tinyint(4) NOT NULL default '0',
+ PRIMARY KEY (tid),
+ KEY vid (vid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['term_hierarchy'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {term_hierarchy} (
+ tid int(10) unsigned NOT NULL default '0',
+ parent int(10) unsigned NOT NULL default '0',
+ KEY tid (tid),
+ KEY parent (parent),
+ PRIMARY KEY (tid, parent)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['term_node'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {term_node} (
+ nid int(10) unsigned NOT NULL default '0',
+ tid int(10) unsigned NOT NULL default '0',
+ KEY nid (nid),
+ KEY tid (tid),
+ PRIMARY KEY (tid,nid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['term_relation'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {term_relation} (
+ tid1 int(10) unsigned NOT NULL default '0',
+ tid2 int(10) unsigned NOT NULL default '0',
+ KEY tid1 (tid1),
+ KEY tid2 (tid2)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['term_synonym'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {term_synonym} (
+ tid int(10) unsigned NOT NULL default '0',
+ name varchar(255) NOT NULL default '',
+ KEY tid (tid),
+ KEY name (name(3))
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['users'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {users} (
+ uid int(10) unsigned NOT NULL default '0',
+ name varchar(60) NOT NULL default '',
+ pass varchar(32) NOT NULL default '',
+ mail varchar(64) default '',
+ mode tinyint(1) NOT NULL default '0',
+ sort tinyint(1) default '0',
+ threshold tinyint(1) default '0',
+ theme varchar(255) NOT NULL default '',
+ signature varchar(255) NOT NULL default '',
+ created int(11) NOT NULL default '0',
+ access int(11) NOT NULL default '0',
+ login int(11) NOT NULL default '0',
+ status tinyint(4) NOT NULL default '0',
+ timezone varchar(8) default NULL,
+ language varchar(12) NOT NULL default '',
+ picture varchar(255) NOT NULL DEFAULT '',
+ init varchar(64) default '',
+ data longtext,
+ PRIMARY KEY (uid),
+ UNIQUE KEY name (name),
+ KEY access (access)
+ ) TYPE=MyISAM;",
+ 'default_value' => "INSERT INTO {users} (uid, name, mail) VALUES ('0', '', '');"
+ );
+
+ $tables['users_roles'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {users_roles} (
+ uid int(10) unsigned NOT NULL default '0',
+ rid int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (uid, rid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['variable'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {variable} (
+ name varchar(48) NOT NULL default '',
+ value longtext NOT NULL,
+ PRIMARY KEY (name)
+ ) TYPE=MyISAM;",
+ 'default_value' => array(
+ "REPLACE {variable} SET name='theme_default', value='s:10:\"bluemarine\";';",
+ "INSERT INTO {variable} (name,value) VALUES ('filter_html_1','i:1;');",
+ "INSERT INTO {variable} (name, value) VALUES ('node_options_forum', 'a:1:{i:0;s:6:\"status\";}');",
+ "INSERT INTO {variable} VALUES ('menu_primary_menu', 'i:2;');",
+ "INSERT INTO {variable} VALUES ('menu_secondary_menu', 'i:2;');")
+ );
+
+ $tables['vocabulary'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {vocabulary} (
+ vid int(10) unsigned NOT NULL auto_increment,
+ name varchar(255) NOT NULL default '',
+ description longtext,
+ help varchar(255) NOT NULL default '',
+ relations tinyint(3) unsigned NOT NULL default '0',
+ hierarchy tinyint(3) unsigned NOT NULL default '0',
+ multiple tinyint(3) unsigned NOT NULL default '0',
+ required tinyint(3) unsigned NOT NULL default '0',
+ tags tinyint(3) unsigned NOT NULL default '0',
+ module varchar(255) NOT NULL default '',
+ weight tinyint(4) NOT NULL default '0',
+ PRIMARY KEY (vid)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['vocabulary_node_types'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {vocabulary_node_types} (
+ vid int(10) unsigned NOT NULL DEFAULT '0',
+ type varchar(32) NOT NULL DEFAULT '',
+ PRIMARY KEY (vid, type)
+ ) TYPE=MyISAM;",
+ );
+
+ $tables['watchdog'] = array(
+ 'schema' => 0,
+ 'create' => "CREATE TABLE {watchdog} (
+ wid int(5) NOT NULL auto_increment,
+ uid int(10) NOT NULL default '0',
+ type varchar(16) NOT NULL default '',
+ message longtext NOT NULL,
+ severity tinyint(3) unsigned NOT NULL default '0',
+ link varchar(255) NOT NULL default '',
+ location varchar(128) NOT NULL default '',
+ referer varchar(128) NOT NULL default '',
+ hostname varchar(128) NOT NULL default '',
+ timestamp int(11) NOT NULL default '0',
+ PRIMARY KEY (wid)
+ ) TYPE=MyISAM;",
+ );
+ }
+
+ return $tables;
+}
+
+?>
--- profiles/default.profile.orig 2006-04-21 11:40:15.000000000 -0400
+++ profiles/default.profile 2006-04-21 11:23:10.000000000 -0400
@@ -0,0 +1,17 @@
+