diff --git a/doc/INSTALL.pgsql.txt b/doc/INSTALL.pgsql.txt deleted file mode 100644 index 7054c16..0000000 --- a/doc/INSTALL.pgsql.txt +++ /dev/null @@ -1,27 +0,0 @@ - -CREATE THE PostgreSQL DATABASE ------------------------------- - -Note that the database must be created with UTF-8 (Unicode) encoding. - -1. CREATE DATABASE USER - - This step is only necessary if you don't already have a user set up (e.g. - by your host) or you want to create new user for use with Drupal only. The - following command creates a new user named "username" and asks for a - password for that user: - - createuser --pwprompt --encrypted --no-adduser --no-createdb username - - If everything works correctly, you'll see a "CREATE USER" notice. - -2. CREATE THE DRUPAL DATABASE - - This step is only necessary if you don't already have a database set up (e.g. - by your host) or you want to create new database for use with Drupal only. - The following command creates a new database named "databasename", which is - owned by previously created "username": - - createdb --encoding=UNICODE --owner=username databasename - - If everything works correctly, you'll see a "CREATE DATABASE" notice. diff --git a/doc/MAINTAINERS.txt b/doc/MAINTAINERS.txt deleted file mode 100644 index da831f9..0000000 --- a/doc/MAINTAINERS.txt +++ /dev/null @@ -1,85 +0,0 @@ - -List of maintainers --------------------------------------------------------------------------------- - -LEGEND -====== - -- M: the maintainer -- S: status: - "supported" : someone is actually paid to look after this. - "maintained" : someone actually looks after it. - "fixes/patches" : it has a maintainer but they don't have time to - do much other than throw the odd patch in. - "orphan" : no current maintainer, but maybe you could take - the role as you write new code? - --------------------------------------------------------------------------------- - -BLOG API -M: James Walker -S: maintained - -DISTRIBUTED AUTHENTICATION MODULES -M: Moshe Weitzman -S: maintained - -DOCUMENTATION COORDINATOR -M: Steven Peck -S: maintained - -FILTER SYSTEM -M: Steven Wittens -S: maintained - -FORM SYSTEM -M: Károly Négyesi -S: maintained - -LOCALE MODULE -M: Gabor Hojtsy -S: maintained - -LOGGING -M: Khalid Baheyeldin -S: maintained - -MENU SYSTEM -M: Károly Négyesi -S: maintained - -PATH MODULE -M: Matt Westgate -S: maintained - -POSTGRESQL -M: Sammy Spets -S: maintained - -SECURITY COORDINATOR -M: Greg Knaddison -S: maintained - -STATISTICS MODULE -M: Jeremy Andrews -S: maintained - -THEME SYSTEM -M: Earl Miles - Joon Park -S: maintained - -UPDATE MODULE -M: Derek Wright -S: maintained - -XML-RPC SERVER/CLIENT -M: John VanDyk -S: maintained - -TRANSLATIONS COORDINATOR -M: Gerhard Killesreiter -S: maintained - -THE REST: -M: Dries diff --git a/install.php b/install.php deleted file mode 100644 index 0839d38..0000000 --- a/install.php +++ /dev/null @@ -1,1195 +0,0 @@ - st('Your web server does not appear to support any common database types. Check with your hosting provider to see if they offer any databases that Drupal supports.', array('@drupal-databases' => 'http://drupal.org/node/270#database')), - ); - } - else { - $form['basic_options'] = array( - '#type' => 'fieldset', - '#title' => st('Basic options'), - '#description' => '

'. st('To set up your @drupal database, enter the following information.', array('@drupal' => drupal_install_profile_name())) .'

', - ); - - if (count($db_types) > 1) { - $form['basic_options']['db_type'] = array( - '#type' => 'radios', - '#title' => st('Database type'), - '#required' => TRUE, - '#options' => $db_types, - '#default_value' => ($db_type ? $db_type : current($db_types)), - '#description' => st('The type of database your @drupal data will be stored in.', array('@drupal' => drupal_install_profile_name())), - ); - $db_path_description = st('The name of the database your @drupal data will be stored in. It must exist on your server before @drupal can be installed.', array('@drupal' => drupal_install_profile_name())); - } - else { - if (count($db_types) == 1) { - $db_types = array_values($db_types); - $form['basic_options']['db_type'] = array( - '#type' => 'hidden', - '#value' => $db_types[0], - ); - $db_path_description = st('The name of the %db_type database your @drupal data will be stored in. It must exist on your server before @drupal can be installed.', array('%db_type' => $db_types[0], '@drupal' => drupal_install_profile_name())); - } - } - - // Database name - $form['basic_options']['db_path'] = array( - '#type' => 'textfield', - '#title' => st('Database name'), - '#default_value' => $db_path, - '#size' => 45, - '#required' => TRUE, - '#description' => $db_path_description - ); - - // Database username - $form['basic_options']['db_user'] = array( - '#type' => 'textfield', - '#title' => st('Database username'), - '#default_value' => $db_user, - '#size' => 45, - '#required' => TRUE, - ); - - // Database username - $form['basic_options']['db_pass'] = array( - '#type' => 'password', - '#title' => st('Database password'), - '#default_value' => $db_pass, - '#size' => 45, - ); - - $form['advanced_options'] = array( - '#type' => 'fieldset', - '#title' => st('Advanced options'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#description' => st("These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings or check with your hosting provider.") - ); - - // Database host - $form['advanced_options']['db_host'] = array( - '#type' => 'textfield', - '#title' => st('Database host'), - '#default_value' => $db_host, - '#size' => 45, - // Hostnames can be 255 characters long. - '#maxlength' => 255, - '#required' => TRUE, - '#description' => st('If your database is located on a different server, change this.'), - ); - - // Database port - $form['advanced_options']['db_port'] = array( - '#type' => 'textfield', - '#title' => st('Database port'), - '#default_value' => $db_port, - '#size' => 45, - // The maximum port number is 65536, 5 digits. - '#maxlength' => 5, - '#description' => st('If your database server is listening to a non-standard port, enter its number.'), - ); - - // Table prefix - $prefix = ($profile == 'default') ? 'drupal_' : $profile .'_'; - $form['advanced_options']['db_prefix'] = array( - '#type' => 'textfield', - '#title' => st('Table prefix'), - '#default_value' => $db_prefix, - '#size' => 45, - '#description' => st('If more than one application will be sharing this database, enter a table prefix such as %prefix for your @drupal site here.', array('@drupal' => drupal_install_profile_name(), '%prefix' => $prefix)), - ); - - $form['save'] = array( - '#type' => 'submit', - '#value' => st('Save and continue'), - ); - - $form['errors'] = array(); - $form['settings_file'] = array('#type' => 'value', '#value' => $settings_file); - $form['_db_url'] = array('#type' => 'value'); - $form['#action'] = "install.php?profile=$profile". ($install_locale ? "&locale=$install_locale" : ''); - $form['#redirect'] = FALSE; - } - return $form; -} - -/** - * Form API validate for install_settings form. - */ -function install_settings_form_validate($form, &$form_state) { - global $db_url; - _install_settings_form_validate($form_state['values']['db_prefix'], $form_state['values']['db_type'], $form_state['values']['db_user'], $form_state['values']['db_pass'], $form_state['values']['db_host'], $form_state['values']['db_port'], $form_state['values']['db_path'], $form_state['values']['settings_file'], $form_state, $form); -} - -/** - * Helper function for install_settings_validate. - */ -function _install_settings_form_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_port, $db_path, $settings_file, &$form_state, $form = NULL) { - global $db_url; - - // Verify the table prefix - if (!empty($db_prefix) && is_string($db_prefix) && !preg_match('/^[A-Za-z0-9_.]+$/', $db_prefix)) { - form_set_error('db_prefix', st('The database table prefix you have entered, %db_prefix, is invalid. The table prefix can only contain alphanumeric characters, periods, or underscores.', array('%db_prefix' => $db_prefix)), 'error'); - } - - if (!empty($db_port) && !is_numeric($db_port)) { - form_set_error('db_port', st('Database port must be a number.')); - } - - // Check database type - if (!isset($form)) { - $_db_url = is_array($db_url) ? $db_url['default'] : $db_url; - $db_type = substr($_db_url, 0, strpos($_db_url, '://')); - } - $databases = drupal_detect_database_types(); - if (!in_array($db_type, $databases)) { - form_set_error('db_type', st("In your %settings_file file you have configured @drupal to use a %db_type server, however your PHP installation currently does not support this database type.", array('%settings_file' => $settings_file, '@drupal' => drupal_install_profile_name(), '%db_type' => $db_type))); - } - else { - // Verify - $db_url = $db_type .'://'. urlencode($db_user) . ($db_pass ? ':'. urlencode($db_pass) : '') .'@'. ($db_host ? urlencode($db_host) : 'localhost') . ($db_port ? ":$db_port" : '') .'/'. urlencode($db_path); - if (isset($form)) { - form_set_value($form['_db_url'], $db_url, $form_state); - } - $success = array(); - - $function = 'drupal_test_'. $db_type; - if (!$function($db_url, $success)) { - if (isset($success['CONNECT'])) { - form_set_error('db_type', st('In order for Drupal to work, and to continue with the installation process, you must resolve all permission issues reported above. We were able to verify that we have permission for the following commands: %commands. For more help with configuring your database server, see the Installation and upgrading handbook. If you are unsure what any of this means you should probably contact your hosting provider.', array('%commands' => implode($success, ', ')))); - } - else { - form_set_error('db_type', ''); - } - } - } -} - -/** - * Form API submit for install_settings form. - */ -function install_settings_form_submit($form, &$form_state) { - global $profile, $install_locale; - - // Update global settings array and save - $settings['db_url'] = array( - 'value' => $form_state['values']['_db_url'], - 'required' => TRUE, - ); - $settings['db_prefix'] = array( - 'value' => $form_state['values']['db_prefix'], - 'required' => TRUE, - ); - drupal_rewrite_settings($settings); - - // Continue to install profile step - install_goto("install.php?profile=$profile". ($install_locale ? "&locale=$install_locale" : '')); -} - -/** - * Find all .profile files. - */ -function install_find_profiles() { - return file_scan_directory('./profiles', '\.profile$', array('.', '..', 'CVS'), 0, TRUE, 'name', 0); -} - -/** - * Allow admin to select which profile to install. - * - * @return - * The selected profile. - */ -function install_select_profile() { - include_once './includes/form.inc'; - - $profiles = install_find_profiles(); - // 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) { - foreach ($profiles as $profile) { - if (!empty($_POST['profile']) && ($_POST['profile'] == $profile->name)) { - return $profile->name; - } - } - - install_task_list('profile-select'); - - drupal_set_title(st('Select an installation profile')); - print theme('install_page', drupal_get_form('install_select_profile_form', $profiles)); - exit; - } -} - -/** - * Form API array definition for the profile selection form. - * - * @param $form_state - * Array of metadata about state of form processing. - * @param $profile_files - * Array of .profile files, as returned from file_scan_directory(). - */ -function install_select_profile_form(&$form_state, $profile_files) { - $profiles = array(); - $names = array(); - - foreach ($profile_files as $profile) { - include_once($profile->filename); - - // Load profile details and store them for later retrieval. - $function = $profile->name .'_profile_details'; - if (function_exists($function)) { - $details = $function(); - } - $profiles[$profile->name] = $details; - - // Determine the name of the profile; default to file name if defined name - // is unspecified. - $name = isset($details['name']) ? $details['name'] : $profile->name; - $names[$profile->name] = $name; - } - - // Display radio buttons alphabetically by human-readable name. - natcasesort($names); - foreach ($names as $profile => $name) { - $form['profile'][$name] = array( - '#type' => 'radio', - '#value' => 'default', - '#return_value' => $profile, - '#title' => $name, - '#description' => isset($profiles[$profile]['description']) ? $profiles[$profile]['description'] : '', - '#parents' => array('profile'), - ); - } - $form['submit'] = array( - '#type' => 'submit', - '#value' => st('Save and continue'), - ); - return $form; -} - -/** - * Find all .po files for the current profile. - */ -function install_find_locales($profilename) { - $locales = file_scan_directory('./profiles/'. $profilename .'/translations', '\.po$', array('.', '..', 'CVS'), 0, FALSE); - array_unshift($locales, (object) array('name' => 'en')); - return $locales; -} - -/** - * Allow admin to select which locale to use for the current profile. - * - * @return - * The selected language. - */ -function install_select_locale($profilename) { - include_once './includes/file.inc'; - include_once './includes/form.inc'; - - // Find all available locales. - $locales = install_find_locales($profilename); - - // If only the built-in (English) language is available, - // and we are using the default profile, inform the user - // that the installer can be localized. Otherwise we assume - // the user know what he is doing. - if (count($locales) == 1) { - if ($profilename == 'default') { - install_task_list('locale-select'); - drupal_set_title(st('Choose language')); - if (!empty($_GET['localize'])) { - $output = '

'. st('With the addition of an appropriate translation package, this installer is capable of proceeding in another language of your choice. To install and use Drupal in a language other than English:') .'

'; - $output .= '
  • '. st('Determine if a translation of this Drupal version is available in your language of choice. A translation is provided via a translation package; each translation package enables the display of a specific version of Drupal in a specific language. Not all languages are available for every version of Drupal.', array('@translations' => 'http://localize.drupal.org')) .'
  • '; - $output .= '
  • '. st('If an alternative translation package of your choice is available, download and extract its contents to your Drupal root directory.') .'
  • '; - $output .= '
  • '. st('Return to choose language using the second link below and select your desired language from the displayed list. Reloading the page allows the list to automatically adjust to the presence of new translation packages.') .'
  • '; - $output .= '

'. st('Alternatively, to install and use Drupal in English, or to defer the selection of an alternative language until after installation, select the first link below.') .'

'; - $output .= '

'. st('How should the installation continue?') .'

'; - $output .= ''; - } - else { - $output = ''; - } - print theme('install_page', $output); - exit; - } - // One language, but not the default profile, assume - // the user knows what he is doing. - return FALSE; - } - else { - // Allow profile to pre-select the language, skipping the selection. - $function = $profilename .'_profile_details'; - if (function_exists($function)) { - $details = $function(); - if (isset($details['language'])) { - foreach ($locales as $locale) { - if ($details['language'] == $locale->name) { - return $locale->name; - } - } - } - } - - if (!empty($_POST['locale'])) { - foreach ($locales as $locale) { - if ($_POST['locale'] == $locale->name) { - return $locale->name; - } - } - } - - install_task_list('locale-select'); - - drupal_set_title(st('Choose language')); - print theme('install_page', drupal_get_form('install_select_locale_form', $locales)); - exit; - } -} - -/** - * Form API array definition for language selection. - */ -function install_select_locale_form(&$form_state, $locales) { - include_once './includes/locale.inc'; - $languages = _locale_get_predefined_list(); - foreach ($locales as $locale) { - // Try to use verbose locale name - $name = $locale->name; - if (isset($languages[$name])) { - $name = $languages[$name][0] . (isset($languages[$name][1]) ? ' '. st('(@language)', array('@language' => $languages[$name][1])) : ''); - } - $form['locale'][$locale->name] = array( - '#type' => 'radio', - '#return_value' => $locale->name, - '#default_value' => ($locale->name == 'en' ? TRUE : FALSE), - '#title' => $name . ($locale->name == 'en' ? ' '. st('(built-in)') : ''), - '#parents' => array('locale') - ); - } - $form['submit'] = array( - '#type' => 'submit', - '#value' => st('Select language'), - ); - return $form; -} - -/** - * Show an error page when there are no profiles available. - */ -function install_no_profile_error() { - install_task_list('profile-select'); - drupal_set_title(st('No profiles available')); - print theme('install_page', '

'. st('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; -} - - -/** - * Show an error page when Drupal has already been installed. - */ -function install_already_done_error() { - global $base_url; - - drupal_set_title(st('Drupal already installed')); - print theme('install_page', st('
  • To start over, you must empty your existing database.
  • To install to a different database, edit the appropriate settings.php file in the sites folder.
  • To upgrade an existing installation, proceed to the update script.
  • View your existing site.
', array('@base-url' => $base_url))); - exit; -} - -/** - * Tasks performed after the database is initialized. - */ -function install_tasks($profile, $task) { - global $base_url, $install_locale; - - // Bootstrap newly installed Drupal, while preserving existing messages. - $messages = isset($_SESSION['messages']) ? $_SESSION['messages'] : ''; - drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); - $_SESSION['messages'] = $messages; - - // URL used to direct page requests. - $url = $base_url .'/install.php?locale='. $install_locale .'&profile='. $profile; - - // Build a page for final tasks. - if (empty($task)) { - variable_set('install_task', 'profile-install'); - $task = 'profile-install'; - } - - // We are using a list of if constructs here to allow for - // passing from one task to the other in the same request. - - // Install profile modules. - if ($task == 'profile-install') { - $modules = variable_get('install_profile_modules', array()); - $files = module_rebuild_cache(); - variable_del('install_profile_modules'); - $operations = array(); - foreach ($modules as $module) { - $operations[] = array('_install_module_batch', array($module, $files[$module]->info['name'])); - } - $batch = array( - 'operations' => $operations, - 'finished' => '_install_profile_batch_finished', - 'title' => st('Installing @drupal', array('@drupal' => drupal_install_profile_name())), - 'error_message' => st('The installation has encountered an error.'), - ); - // Start a batch, switch to 'profile-install-batch' task. We need to - // set the variable here, because batch_process() redirects. - variable_set('install_task', 'profile-install-batch'); - batch_set($batch); - batch_process($url, $url); - } - // We are running a batch install of the profile's modules. - // This might run in multiple HTTP requests, constantly redirecting - // to the same address, until the batch finished callback is invoked - // and the task advances to 'locale-initial-import'. - if ($task == 'profile-install-batch') { - include_once 'includes/batch.inc'; - $output = _batch_page(); - } - - // Import interface translations for the enabled modules. - if ($task == 'locale-initial-import') { - if (!empty($install_locale) && ($install_locale != 'en')) { - include_once 'includes/locale.inc'; - // Enable installation language as default site language. - locale_add_language($install_locale, NULL, NULL, NULL, NULL, NULL, 1, TRUE); - // Collect files to import for this language. - $batch = locale_batch_by_language($install_locale, '_install_locale_initial_batch_finished'); - if (!empty($batch)) { - // Remember components we cover in this batch set. - variable_set('install_locale_batch_components', $batch['#components']); - // Start a batch, switch to 'locale-batch' task. We need to - // set the variable here, because batch_process() redirects. - variable_set('install_task', 'locale-initial-batch'); - batch_set($batch); - batch_process($url, $url); - } - } - // Found nothing to import or not foreign language, go to next task. - $task = 'configure'; - } - if ($task == 'locale-initial-batch') { - include_once 'includes/batch.inc'; - include_once 'includes/locale.inc'; - $output = _batch_page(); - } - - if ($task == 'configure') { - if (variable_get('site_name', FALSE) || variable_get('site_mail', FALSE)) { - // Site already configured: This should never happen, means re-running - // the installer, possibly by an attacker after the 'install_task' variable - // got accidentally blown somewhere. Stop it now. - install_already_done_error(); - } - $form = drupal_get_form('install_configure_form', $url); - - if (!variable_get('site_name', FALSE) && !variable_get('site_mail', FALSE)) { - // Not submitted yet: Prepare to display the form. - $output = $form; - drupal_set_title(st('Configure site')); - - // Warn about settings.php permissions risk - $settings_dir = './'. conf_path(); - $settings_file = $settings_dir .'/settings.php'; - if (!drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE) || !drupal_verify_install_file($settings_dir, FILE_NOT_WRITABLE, 'dir')) { - drupal_set_message(st('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, please consult the on-line handbook.', array('%dir' => $settings_dir, '%file' => $settings_file, '@handbook_url' => 'http://drupal.org/getting-started')), 'error'); - } - else { - drupal_set_message(st('All necessary changes to %dir and %file have been made. They have been set to read-only for security.', array('%dir' => $settings_dir, '%file' => $settings_file))); - } - - // Add JavaScript validation. - _user_password_dynamic_validation(); - drupal_add_js(drupal_get_path('module', 'system') .'/system.js', 'module'); - // We add these strings as settings because JavaScript translation does not - // work on install time. - drupal_add_js(array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail')), 'cleanURL' => array('success' => st('Your server has been successfully tested to support this feature.'), 'failure' => st('Your system configuration does not currently support this feature. The handbook page on Clean URLs has additional troubleshooting information.'), 'testing' => st('Testing clean URLs...'))), 'setting'); - drupal_add_js(' -// Global Killswitch -if (Drupal.jsEnabled) { - $(document).ready(function() { - Drupal.cleanURLsInstallCheck(); - Drupal.setDefaultTimezone(); - }); -}', 'inline'); - // Build menu to allow clean URL check. - menu_rebuild(); - } - - else { - $task = 'profile'; - } - } - - // If found an unknown task or the 'profile' task, which is - // reserved for profiles, hand over the control to the profile, - // so it can run any number of custom tasks it defines. - if (!in_array($task, install_reserved_tasks())) { - $function = $profile .'_profile_tasks'; - if (function_exists($function)) { - // The profile needs to run more code, maybe even more tasks. - // $task is sent through as a reference and may be changed! - $output = $function($task, $url); - } - - // If the profile doesn't move on to a new task we assume - // that it is done. - if ($task == 'profile') { - $task = 'profile-finished'; - } - } - - // Profile custom tasks are done, so let the installer regain - // control and proceed with importing the remaining translations. - if ($task == 'profile-finished') { - if (!empty($install_locale) && ($install_locale != 'en')) { - include_once 'includes/locale.inc'; - // Collect files to import for this language. Skip components - // already covered in the initial batch set. - $batch = locale_batch_by_language($install_locale, '_install_locale_remaining_batch_finished', variable_get('install_locale_batch_components', array())); - // Remove temporary variable. - variable_del('install_locale_batch_components'); - if (!empty($batch)) { - // Start a batch, switch to 'locale-remaining-batch' task. We need to - // set the variable here, because batch_process() redirects. - variable_set('install_task', 'locale-remaining-batch'); - batch_set($batch); - batch_process($url, $url); - } - } - // Found nothing to import or not foreign language, go to next task. - $task = 'finished'; - } - if ($task == 'locale-remaining-batch') { - include_once 'includes/batch.inc'; - include_once 'includes/locale.inc'; - $output = _batch_page(); - } - - // Display a 'finished' page to user. - if ($task == 'finished') { - drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_name()))); - $messages = drupal_set_message(); - $output = '

'. st('Congratulations, @drupal has been successfully installed.', array('@drupal' => drupal_install_profile_name())) .'

'; - $output .= '

'. (isset($messages['error']) ? st('Please review the messages above before continuing on to your new site.', array('@url' => url(''))) : st('You may now visit your new site.', array('@url' => url('')))) .'

'; - $task = 'done'; - } - - // The end of the install process. Remember profile used. - if ($task == 'done') { - // Rebuild menu to get content type links registered by the profile, - // and possibly any other menu items created through the tasks. - menu_rebuild(); - - // Register actions declared by any modules. - actions_synchronize(); - - // Randomize query-strings on css/js files, to hide the fact that - // this is a new install, not upgraded yet. - _drupal_flush_css_js(); - - variable_set('install_profile', $profile); - } - - // Set task for user, and remember the task in the database. - install_task_list($task); - variable_set('install_task', $task); - - // Output page, if some output was required. Otherwise it is possible - // that we are printing a JSON page and theme output should not be there. - if (isset($output)) { - print theme('maintenance_page', $output); - } -} - -/** - * Batch callback for batch installation of modules. - */ -function _install_module_batch($module, $module_name, &$context) { - _drupal_install_module($module); - // We enable the installed module right away, so that the module will be - // loaded by drupal_bootstrap in subsequent batch requests, and other - // modules possibly depending on it can safely perform their installation - // steps. - module_enable(array($module)); - $context['results'][] = $module; - $context['message'] = st('Installed %module module.', array('%module' => $module_name)); -} - -/** - * Finished callback for the modules install batch. - * - * Advance installer task to language import. - */ -function _install_profile_batch_finished($success, $results) { - variable_set('install_task', 'locale-initial-import'); -} - -/** - * Finished callback for the first locale import batch. - * - * Advance installer task to the configure screen. - */ -function _install_locale_initial_batch_finished($success, $results) { - variable_set('install_task', 'configure'); -} - -/** - * Finished callback for the second locale import batch. - * - * Advance installer task to the finished screen. - */ -function _install_locale_remaining_batch_finished($success, $results) { - variable_set('install_task', 'finished'); -} - -/** - * The list of reserved tasks to run in the installer. - */ -function install_reserved_tasks() { - return array('configure', 'profile-install', 'profile-install-batch', 'locale-initial-import', 'locale-initial-batch', 'profile-finished', 'locale-remaining-batch', 'finished', 'done'); -} - -/** - * Check installation requirements and report any errors. - */ -function install_check_requirements($profile, $verify) { - - // If Drupal is not set up already, we need to create a settings file. - if (!$verify) { - $writable = FALSE; - $conf_path = './'. conf_path(FALSE, TRUE); - $settings_file = $conf_path .'/settings.php'; - $file = $conf_path; - $exists = FALSE; - // Verify that the directory exists. - if (drupal_verify_install_file($conf_path, FILE_EXIST, 'dir')) { - // Check to make sure a settings.php already exists. - $file = $settings_file; - if (drupal_verify_install_file($settings_file, FILE_EXIST)) { - $exists = TRUE; - // If it does, make sure it is writable. - $writable = drupal_verify_install_file($settings_file, FILE_READABLE|FILE_WRITABLE); - } - } - if (!$exists) { - drupal_set_message(st('The @drupal installer requires that you create a settings file as part of the installation process. -
    -
  1. Copy the %default_file file to %file.
  2. -
  3. Change file permissions so that it is writable by the web server. If you are unsure how to grant file permissions, please consult the on-line handbook.
  4. -
-More details about installing Drupal are available in INSTALL.txt.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '%default_file' => $conf_path .'/default.settings.php', '@handbook_url' => 'http://drupal.org/server-permissions')), 'error'); - } - elseif (!$writable) { - drupal_set_message(st('The @drupal installer requires write permissions to %file during the installation process. If you are unsure how to grant file permissions, please consult the on-line handbook.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions')), 'error'); - } - } - - // Check the other requirements. - $requirements = drupal_check_profile($profile); - $severity = drupal_requirements_severity($requirements); - - // If there are issues, report them. - if ($severity == REQUIREMENT_ERROR) { - - foreach ($requirements as $requirement) { - if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) { - $message = $requirement['description']; - if (isset($requirement['value']) && $requirement['value']) { - $message .= ' ('. st('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) .')'; - } - drupal_set_message($message, 'error'); - } - } - } - if ($severity == REQUIREMENT_WARNING) { - - foreach ($requirements as $requirement) { - if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_WARNING) { - $message = $requirement['description']; - if (isset($requirement['value']) && $requirement['value']) { - $message .= ' ('. st('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) .')'; - } - drupal_set_message($message, 'warning'); - } - } - } -} - -/** - * Add the installation task list to the current page. - */ -function install_task_list($active = NULL) { - // Default list of tasks. - $tasks = array( - 'profile-select' => st('Choose profile'), - 'locale-select' => st('Choose language'), - 'requirements' => st('Verify requirements'), - 'database' => st('Set up database'), - 'profile-install-batch' => st('Install profile'), - 'locale-initial-batch' => st('Set up translations'), - 'configure' => st('Configure site'), - ); - - $profiles = install_find_profiles(); - $profile = isset($_GET['profile']) && isset($profiles[$_GET['profile']]) ? $_GET['profile'] : '.'; - $locales = install_find_locales($profile); - - // If we have only one profile, remove 'Choose profile' - // and rename 'Install profile'. - if (count($profiles) == 1) { - unset($tasks['profile-select']); - $tasks['profile-install-batch'] = st('Install site'); - } - - // Add tasks defined by the profile. - if ($profile) { - $function = $profile .'_profile_task_list'; - if (function_exists($function)) { - $result = $function(); - if (is_array($result)) { - $tasks += $result; - } - } - } - - if (count($locales) < 2 || empty($_GET['locale']) || $_GET['locale'] == 'en') { - // If not required, remove translation import from the task list. - unset($tasks['locale-initial-batch']); - } - else { - // If required, add remaining translations import task. - $tasks += array('locale-remaining-batch' => st('Finish translations')); - } - - // Add finished step as the last task. - $tasks += array( - 'finished' => st('Finished') - ); - - // Let the theming function know that 'finished' and 'done' - // include everything, so every step is completed. - if (in_array($active, array('finished', 'done'))) { - $active = NULL; - } - drupal_set_content('left', theme_task_list($tasks, $active)); -} - -/** - * Form API array definition for site configuration. - */ -function install_configure_form(&$form_state, $url) { - - $form['intro'] = array( - '#value' => st('To configure your website, please provide the following information.'), - '#weight' => -10, - ); - $form['site_information'] = array( - '#type' => 'fieldset', - '#title' => st('Site information'), - '#collapsible' => FALSE, - ); - $form['site_information']['site_name'] = array( - '#type' => 'textfield', - '#title' => st('Site name'), - '#required' => TRUE, - '#weight' => -20, - ); - $form['site_information']['site_mail'] = array( - '#type' => 'textfield', - '#title' => st('Site e-mail address'), - '#default_value' => ini_get('sendmail_from'), - '#description' => st("The From address in automated e-mails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this e-mail being flagged as spam.)"), - '#required' => TRUE, - '#weight' => -15, - ); - $form['admin_account'] = array( - '#type' => 'fieldset', - '#title' => st('Administrator account'), - '#collapsible' => FALSE, - ); - $form['admin_account']['account']['#tree'] = TRUE; - $form['admin_account']['markup'] = array( - '#value' => '

'. st('The administrator account has complete access to the site; it will automatically be granted all permissions and can perform any administrative activity. This will be the only account that can perform certain activities, so keep its credentials safe.') .'

', - '#weight' => -10, - ); - - $form['admin_account']['account']['name'] = array('#type' => 'textfield', - '#title' => st('Username'), - '#maxlength' => USERNAME_MAX_LENGTH, - '#description' => st('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.'), - '#required' => TRUE, - '#weight' => -10, - ); - - $form['admin_account']['account']['mail'] = array('#type' => 'textfield', - '#title' => st('E-mail address'), - '#maxlength' => EMAIL_MAX_LENGTH, - '#description' => st('All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), - '#required' => TRUE, - '#weight' => -5, - ); - $form['admin_account']['account']['pass'] = array( - '#type' => 'password_confirm', - '#required' => TRUE, - '#size' => 25, - '#weight' => 0, - ); - - $form['server_settings'] = array( - '#type' => 'fieldset', - '#title' => st('Server settings'), - '#collapsible' => FALSE, - ); - $form['server_settings']['date_default_timezone'] = array( - '#type' => 'select', - '#title' => st('Default time zone'), - '#default_value' => 0, - '#options' => _system_zonelist(), - '#description' => st('By default, dates in this site will be displayed in the chosen time zone.'), - '#weight' => 5, - ); - - $form['server_settings']['clean_url'] = array( - '#type' => 'radios', - '#title' => st('Clean URLs'), - '#default_value' => 0, - '#options' => array(0 => st('Disabled'), 1 => st('Enabled')), - '#description' => st('This option makes Drupal emit "clean" URLs (i.e. without ?q= in the URL).'), - '#disabled' => TRUE, - '#prefix' => '
', - '#suffix' => '
', - '#weight' => 10, - ); - - $form['server_settings']['update_status_module'] = array( - '#type' => 'checkboxes', - '#title' => st('Update notifications'), - '#options' => array(1 => st('Check for updates automatically')), - '#default_value' => array(1), - '#description' => st('With this option enabled, Drupal will notify you when new releases are available. This will significantly enhance your site\'s security and is highly recommended. This requires your site to periodically send anonymous information on its installed components to drupal.org. For more information please see the update notification information.', array('@drupal' => 'http://drupal.org', '@update' => 'http://drupal.org/handbook/modules/update')), - '#weight' => 15, - ); - - $form['submit'] = array( - '#type' => 'submit', - '#value' => st('Save and continue'), - '#weight' => 15, - ); - $form['#action'] = $url; - $form['#redirect'] = FALSE; - - // Allow the profile to alter this form. $form_state isn't available - // here, but to conform to the hook_form_alter() signature, we pass - // an empty array. - $hook_form_alter = $_GET['profile'] .'_form_alter'; - if (function_exists($hook_form_alter)) { - $hook_form_alter($form, array(), 'install_configure'); - } - return $form; -} - -/** - * Form API validate for the site configuration form. - */ -function install_configure_form_validate($form, &$form_state) { - if ($error = user_validate_name($form_state['values']['account']['name'])) { - form_error($form['admin_account']['account']['name'], $error); - } - if ($error = user_validate_mail($form_state['values']['account']['mail'])) { - form_error($form['admin_account']['account']['mail'], $error); - } - if ($error = user_validate_mail($form_state['values']['site_mail'])) { - form_error($form['site_information']['site_mail'], $error); - } -} - -/** - * 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()); -} - -// Start the installer. -install_main(); diff --git a/profiles/default/default.profile b/profiles/default/default.profile deleted file mode 100644 index 1d28ebc..0000000 --- a/profiles/default/default.profile +++ /dev/null @@ -1,150 +0,0 @@ - 'Drupal', - 'description' => 'Select this profile to enable some basic Drupal functionality and the default theme.' - ); -} - -/** - * Return a list of tasks that this profile supports. - * - * @return - * A keyed array of tasks the profile will perform during - * the final stage. The keys of the array will be used internally, - * while the values will be displayed to the user in the installer - * task list. - */ -function default_profile_task_list() { -} - -/** - * Perform any final installation tasks for this profile. - * - * The installer goes through the profile-select -> locale-select - * -> requirements -> database -> profile-install-batch - * -> locale-initial-batch -> configure -> locale-remaining-batch - * -> finished -> done tasks, in this order, if you don't implement - * this function in your profile. - * - * If this function is implemented, you can have any number of - * custom tasks to perform after 'configure', implementing a state - * machine here to walk the user through those tasks. First time, - * this function gets called with $task set to 'profile', and you - * can advance to further tasks by setting $task to your tasks' - * identifiers, used as array keys in the hook_profile_task_list() - * above. You must avoid the reserved tasks listed in - * install_reserved_tasks(). If you implement your custom tasks, - * this function will get called in every HTTP request (for form - * processing, printing your information screens and so on) until - * you advance to the 'profile-finished' task, with which you - * hand control back to the installer. Each custom page you - * return needs to provide a way to continue, such as a form - * submission or a link. You should also set custom page titles. - * - * You should define the list of custom tasks you implement by - * returning an array of them in hook_profile_task_list(), as these - * show up in the list of tasks on the installer user interface. - * - * Remember that the user will be able to reload the pages multiple - * times, so you might want to use variable_set() and variable_get() - * to remember your data and control further processing, if $task - * is insufficient. Should a profile want to display a form here, - * it can; the form should set '#redirect' to FALSE, and rely on - * an action in the submit handler, such as variable_set(), to - * detect submission and proceed to further tasks. See the configuration - * form handling code in install_tasks() for an example. - * - * Important: Any temporary variables should be removed using - * variable_del() before advancing to the 'profile-finished' phase. - * - * @param $task - * The current $task of the install system. When hook_profile_tasks() - * is first called, this is 'profile'. - * @param $url - * Complete URL to be used for a link or form action on a custom page, - * if providing any, to allow the user to proceed with the installation. - * - * @return - * An optional HTML string to display to the user. Only used if you - * modify the $task, otherwise discarded. - */ -function default_profile_tasks(&$task, $url) { - - // Insert default user-defined node types into the database. For a complete - // list of available node type attributes, refer to the node type API - // documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info. - $types = array( - array( - 'type' => 'page', - 'name' => st('Page'), - 'module' => 'node', - 'description' => st("A page, similar in form to a story, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a page entry does not allow visitor comments and is not featured on the site's initial home page."), - 'custom' => TRUE, - 'modified' => TRUE, - 'locked' => FALSE, - 'help' => '', - 'min_word_count' => '', - ), - array( - 'type' => 'story', - 'name' => st('Story'), - 'module' => 'node', - 'description' => st("A story, similar in form to a page, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a story entry. By default, a story entry is automatically featured on the site's initial home page, and provides the ability to post comments."), - 'custom' => TRUE, - 'modified' => TRUE, - 'locked' => FALSE, - 'help' => '', - 'min_word_count' => '', - ), - ); - - foreach ($types as $type) { - $type = (object) _node_type_set_defaults($type); - node_type_save($type); - } - - // Default page to not be promoted and have comments disabled. - variable_set('node_options_page', array('status')); - variable_set('comment_page', COMMENT_NODE_DISABLED); - - // Don't display date and author information for page nodes by default. - $theme_settings = variable_get('theme_settings', array()); - $theme_settings['toggle_node_info_page'] = FALSE; - variable_set('theme_settings', $theme_settings); - - // Update the menu router information. - menu_rebuild(); -} - -/** - * Implementation of hook_form_alter(). - * - * Allows the profile to alter the site-configuration form. This is - * called through custom invocation, so $form_state is not populated. - */ -function default_form_alter(&$form, $form_state, $form_id) { - if ($form_id == 'install_configure') { - // Set default for site name field. - $form['site_information']['site_name']['#default_value'] = $_SERVER['SERVER_NAME']; - } -} diff --git a/scripts/code-clean.sh b/scripts/code-clean.sh deleted file mode 100644 index 3338b6a..0000000 --- a/scripts/code-clean.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -find . -name "*~" -type f | xargs rm -f -find . -name ".#*" -type f | xargs rm -f -find . -name "*.rej" -type f | xargs rm -f -find . -name "*.orig" -type f | xargs rm -f -find . -name "DEADJOE" -type f | xargs rm -f -find . -type f | grep -v ".psp" | grep -v ".gif" | grep -v ".jpg" | grep -v ".png" | grep -v ".tgz" | grep -v ".ico" | grep -v "druplicon" | xargs perl -wi -pe 's/\s+$/\n/' -find . -type f | grep -v ".psp" | grep -v ".gif" | grep -v ".jpg" | grep -v ".png" | grep -v ".tgz" | grep -v ".ico" | grep -v "druplicon" | xargs perl -wi -pe 's/\t/ /g' diff --git a/scripts/code-style.pl b/scripts/code-style.pl deleted file mode 100644 index f71bef9..0000000 --- a/scripts/code-style.pl +++ /dev/null @@ -1,194 +0,0 @@ -#!/usr/bin/perl -w - -use Pod::Usage; -use Getopt::Long qw(GetOptions); -Getopt::Long::Configure ("bundling"); - -my %opt = ( "help" => 0, - 'debug' => 0, - ); - -if(!GetOptions(\%opt, - 'help|?', - 'debug', - )) { - pod2usage(-exitval => 1, 'verbose'=>0); -} - -pod2usage(-exitval => 0, -verbose => 2) if($opt{'help'}); - -$debug = $opt{'debug'}; - -$comment = 0; #flag used to signal we're inside /* */ -$program = 0; #flag used to signal we're inside -#read the file -while (<>) { - $org=$_; - s/\\["']//g; - # please don't use nested comments for now... thanks! - # handles comments // style, but don't mess with http:// - s/\/\/[^:].*//; - # handles comments /**/ on a single line - s/\/\*.*\*\///g; - # handles comments /**/ over several lines - if ($comment == 1) { - if (s/.*\*\///) { - $comment = 0; - } - else { - next; - } - } - if (s/\/\*.*//) { - $comment = 1; - } - if (/^\s*#/) { - next; - } - - if (s/<\?php//) { - $program = 1; - } - if (/\?>/) { - $program = 0; - } - - # enforce "bar". foo() ."bar" syntax - if (/^("[^"]*"|[^"])*("[^"]*")\.[^ ]/ && $program) { - $msg = "'\".' -> '\". '"; - } - elsif (/^("[^"]*"|[^"])*("[^"]*")\s+\./ && $program) { - $msg = "'\" .' -> '\".'"; - } - # enforce "bar". foo() ."bar" syntax - elsif (/^("[^"]*"|[^"])*[^ "]\.("[^"]*")/ && $program) { - $msg = "'.\"' -> '.\"'"; - } - elsif (/^("[^"]*"|[^"])*[^ "]\.\s+("[^"]*")/ && $program) { - $msg = "'. \"' -> '.\"'"; - } - # XHTML requires closing tag - elsif (/
/i) { - $msg = "'
' -> '
'"; - } - elsif (/\$REQUEST_URI/i) { - $msg = "the use of REQUEST_URI is prone to XSS exploits and does not work on IIS; use request_uri() instead"; - } - elsif (/\"REQUEST_URI\"/i) { - $msg = "the use of REQUEST_URI is prone to XSS exploits and does not work on IIS; use request_uri() instead"; - } - - # XHTML compatibility mode suggests a blank before / - # i.e.
- elsif (/<[a-z][^>]*[^ >]\/>/i) { - $msg = "'' -> ''"; - } - # we write '{' on the same line, not on the next - elsif (/^\s*{/ && $program) { - $msg = "take '{' to previous line"; - } - elsif (/([a-z])([A-Z])/) { - $msg = "no mixed case function or variable names, use lower case and _"; - } - elsif (/<[\/]*[A-Z]+[^>]*>/) { - $msg = "XHTML demands tags to be lowercase"; - } - - # trying to recognize splitted lines - # there are only a few valid last characters in programming mode, - # only sometimes it is ( if you use if/else with a single statement - - # from here on we need no more strings - while (s/^([^"]*)"[^"]*"/$1#/) {}; - while (s/^([^']*)'[^']*'/$1#/) {}; - - # it should be 'if (' all the time - if (/(^|[^a-zA-Z])(if|else|elseif|while|foreach|switch|return|for)\(/) { - $msg = "'(' -> ' ('"; - } - #elsif (/[^;{}:\s\n]\s*\n*$/ && $program && !/^[\s}]*(if|else)/) { - # $msg = "don't split lines"; - #} - elsif (/\}\s*else/) { - $msg = "'} else' -> '}\\nelse'"; - } - elsif (/[^{\s\n]\s*\n*$/ && $program && /^\s*(if|else)/) { - $msg = "every if/else needs a { at eol"; - } - elsif (/([\(\[]) / && $program) { - $msg = "'$1 ' -> '$1'"; - } - elsif (/\S ([\)\]])/ && $program) { - $msg = "' $1' -> '$1'"; - } - # but no brackets - elsif (/([a-z-A-Z_][a-zA-Z0-9_-]*)\s+\(/ && $program) { - if ($1 ne "switch" and $1 ne "if" and $1 ne "while" and $1 ne "foreach" and $1 ne "return" and $1 ne "for" and $1 ne "elseif") { - $msg = "'$1 (' -> '$1('"; - } - } - # there should be a space before '{' - if (/[^ ]{/ && $program) { - $msg = "missing space before '{'"; - } - # there should be a space after ',' - elsif (/[,][^ \n\r]/ && $program) { - $msg = "missing space after ','"; - } - # spaces before and after, only foreach may use $foo=>bar - elsif (/[^ =|\-|\+](\+|\-)[^ =>|\-|\+]/ && $program && !/foreach/) { - $msg = "'$1' -> ' $1 '"; - } - elsif (/[^ =](\*|==|\.=|=>|=|\|\|)[^ =>]/ && $program && !/foreach/) { - $msg = "'$1' -> ' $1 '"; - } - # ensure $bar["foo"] and $bar[$foo] and $bar[0] - elsif (/\[[^#][^\]]*\]/ && !/\[[0-9\$][^\]]*\]/ && !/\[\]/) { - $msg = "only [\"foo\"], [\$foo] or [0] is allowed"; - } - # first try to find missing quotes after = in (X)HTML tags - elsif (/<[^>]*=[a-zA-Z0-9][^>]*>/) { - $msg = "=... -> =\"...\""; - } - if (defined $msg) { - if ($debug==0) { - print $ARGV .":". $. .": $msg : ". $org; - } - undef $msg; - } - elsif ($debug==1) { - print $org; - } -} continue { - close ARGV if eof; -} - -__END__ - -=head1 NAME - -code-style.pl - Review drupal code for style - -=head1 SYNOPSIS - - code-style.pl [options] - - Options: - - -? --help detailed help message - -=head1 DESCRIPTION - -Originally written for Drupal (http://drupal.org/) to ensure stylish -code. This program reviews PHP code, and tries to show as many code -improvements as possible with no false positives. - -=head1 OPTIONS - - --comment - -=head1 EXAMPLES - - ./code-style.pl ../index.php - -=cut diff --git a/scripts/cron-curl.sh b/scripts/cron-curl.sh deleted file mode 100644 index 9b168ab..0000000 --- a/scripts/cron-curl.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -curl --silent --compressed http://example.com/cron.php diff --git a/scripts/cron-lynx.sh b/scripts/cron-lynx.sh deleted file mode 100644 index 904667a..0000000 --- a/scripts/cron-lynx.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -/usr/bin/lynx -source http://example.com/cron.php > /dev/null 2>&1 diff --git a/scripts/drupal.sh b/scripts/drupal.sh deleted file mode 100755 index 36b1f06..0000000 --- a/scripts/drupal.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/php -" -Example: {$script} "http://mysite.org/node" - -All arguments are long options. - - --help This page. - - --root Set the working directory for the script to the specified path. - To execute Drupal this has to be the root directory of your - Drupal installation, f.e. /home/www/foo/drupal (assuming Drupal - running on Unix). Current directory is not required. - Use surrounding quotation marks on Windows. - - --verbose This option displays the options as they are set, but will - produce errors from setting the session. - - URI The URI to execute, i.e. http://default/foo/bar for executing - the path '/foo/bar' in your site 'default'. URI has to be - enclosed by quotation marks if there are ampersands in it - (f.e. index.php?q=node&foo=bar). Prefix 'http://' is required, - and the domain must exist in Drupal's sites-directory. - - If the given path and file exists it will be executed directly, - i.e. if URI is set to http://default/bar/foo.php - and bar/foo.php exists, this script will be executed without - bootstrapping Drupal. To execute Drupal's cron.php, specify - http://default/cron.php as the URI. - - -To run this script without --root argument invoke it from the root directory -of your Drupal installation with - - ./scripts/{$script} -\n -EOF; - exit; -} - -// define default settings -$cmd = 'index.php'; -$_SERVER['HTTP_HOST'] = 'default'; -$_SERVER['PHP_SELF'] = '/index.php'; -$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; -$_SERVER['SERVER_SOFTWARE'] = 'PHP CLI'; -$_SERVER['REQUEST_METHOD'] = 'GET'; -$_SERVER['QUERY_STRING'] = ''; -$_SERVER['PHP_SELF'] = $_SERVER['REQUEST_URI'] = '/'; - -// toggle verbose mode -if (in_array('--verbose', $_SERVER['argv'])) { - $_verbose_mode = true; -} -else { - $_verbose_mode = false; -} - -// parse invocation arguments -while ($param = array_shift($_SERVER['argv'])) { - switch ($param) { - case '--root': - // change working directory - $path = array_shift($_SERVER['argv']); - if (is_dir($path)) { - chdir($path); - if ($_verbose_mode) { - echo "cwd changed to: {$path}\n"; - } - } - else { - echo "\nERROR: {$path} not found.\n\n"; - } - break; - - default: - if (substr($param, 0, 2) == '--') { - // ignore unknown options - break; - } - else { - // parse the URI - $path = parse_url($param); - - // set site name - if (isset($path['host'])) { - $_SERVER['HTTP_HOST'] = $path['host']; - } - - // set query string - if (isset($path['query'])) { - $_SERVER['QUERY_STRING'] = $path['query']; - parse_str($path['query'], $_GET); - $_REQUEST = $_GET; - } - - // set file to execute or Drupal path (clean URLs enabled) - if (isset($path['path']) && file_exists(substr($path['path'], 1))) { - $_SERVER['PHP_SELF'] = $_SERVER['REQUEST_URI'] = $path['path']; - $cmd = substr($path['path'], 1); - } - else if (isset($path['path'])) { - if (!isset($_GET['q'])) { - $_REQUEST['q'] = $_GET['q'] = $path['path']; - } - } - - // display setup in verbose mode - if ($_verbose_mode) { - echo "Hostname set to: {$_SERVER['HTTP_HOST']}\n"; - echo "Script name set to: {$cmd}\n"; - echo "Path set to: {$_GET['q']}\n"; - } - } - break; - } -} - -if (file_exists($cmd)) { - include $cmd; -} -else { - echo "\nERROR: {$cmd} not found.\n\n"; -} -exit();