drupal/drupal.patch

Sat, 27 Oct 2012 17:19:03 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 27 Oct 2012 17:19:03 +0200
changeset 748
7548d72a64e3
parent 734
6f237b68bce5
permissions
-rw-r--r--

Update version adjusting patch logic accordingly, correctly create
installation hierarchy, and introduce apache-php::with_xmlwriter
dependency required by rather important XML sitemap logic.

michael@529 1 Index: includes/bootstrap.inc
michael@529 2 --- includes/bootstrap.inc.orig 2008-02-11 15:36:21 +0100
michael@529 3 +++ includes/bootstrap.inc 2008-04-09 20:47:49 +0200
michael@530 4 @@ -730,6 +730,7 @@
michael@529 5 */
michael@530 6 function drupal_settings_initialize() {
michael@529 7 global $base_url, $base_path, $base_root;
michael@529 8 + global $base_url_local;
michael@529 9
michael@529 10 // Export the following settings.php variables to the global namespace
michael@530 11 global $databases, $cookie_domain, $conf, $installed_profile, $update_free_access, $db_url, $db_prefix, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url;
michael@530 12 @@ -1613,8 +1614,22 @@
michael@530 13 * equivalent using other environment variables.
michael@529 14 */
michael@529 15 function request_uri() {
michael@529 16 + global $base_url;
michael@529 17 + global $base_url_local;
michael@530 18 +
michael@529 19 if (isset($_SERVER['REQUEST_URI'])) {
michael@529 20 $uri = $_SERVER['REQUEST_URI'];
michael@529 21 + if (isset($base_url) && isset($base_url_local)) {
michael@529 22 + $parts = parse_url($base_url_local);
michael@529 23 + if ( strlen($uri) >= strlen($base_url_local)
michael@529 24 + && substr($uri, 0, strlen($base_url_local)) == $base_url_local) {
michael@529 25 + $uri = $base_url . substr($uri, strlen($base_url_local));
michael@529 26 + }
michael@529 27 + elseif ( strlen($uri) >= strlen($parts["path"])
michael@529 28 + && substr($uri, 0, strlen($parts["path"])) == $parts["path"]) {
michael@529 29 + $uri = $base_url . substr($uri, strlen($parts["path"]));
michael@529 30 + }
michael@529 31 + }
michael@529 32 }
michael@529 33 else {
michael@529 34 if (isset($_SERVER['argv'])) {
michael@530 35 @@ -1628,6 +1643,7 @@
michael@529 36 }
michael@529 37 }
michael@530 38 // Prevent multiple slashes to avoid cross site requests via the Form API.
michael@529 39 + if (substr($uri, 0, 1) == "/")
michael@530 40 $uri = '/' . ltrim($uri, '/');
michael@529 41
michael@529 42 return $uri;
michael@529 43 Index: includes/common.inc
michael@529 44 --- includes/common.inc.orig 2008-04-09 23:11:44 +0200
michael@529 45 +++ includes/common.inc 2008-06-26 20:16:16 +0200
michael@530 46 @@ -848,9 +848,14 @@
michael@529 47 }
michael@529 48
michael@529 49 // Construct the path to act on.
michael@529 50 - $path = isset($uri['path']) ? $uri['path'] : '/';
michael@529 51 - if (isset($uri['query'])) {
michael@530 52 - $path .= '?' . $uri['query'];
michael@529 53 + if (variable_get('proxy_server', '') != '') {
michael@529 54 + $path = $url;
michael@529 55 + }
michael@529 56 + else {
michael@529 57 + $path = isset($uri['path']) ? $uri['path'] : '/';
michael@529 58 + if (isset($uri['query'])) {
michael@529 59 + $path .= '?'. $uri['query'];
michael@529 60 + }
michael@529 61 }
michael@529 62
michael@530 63 // Merge the default headers.
michael@530 64 @@ -872,6 +877,14 @@
michael@530 65 $options['headers']['Authorization'] = 'Basic ' . base64_encode($uri['user'] . (isset($uri['pass']) ? ':' . $uri['pass'] : ''));
michael@529 66 }
michael@529 67
michael@529 68 + // If the proxy server required a username then attempt to authenticate with it
michael@529 69 + if (variable_get('proxy_username', '') != '') {
michael@529 70 + $username = variable_get('proxy_username', '');
michael@529 71 + $password = variable_get('proxy_password', '');
michael@529 72 + $auth_string = base64_encode($username . ($password != '' ? ':'. $password : ''));
michael@529 73 + $defaults['Proxy-Authorization'] = 'Proxy-Authorization: Basic '. $auth_string ."\r\n";
michael@529 74 + }
michael@529 75 +
michael@530 76 // If the database prefix is being used by SimpleTest to run the tests in a copied
michael@530 77 // database then set the user-agent header to the database prefix so that any
michael@530 78 // calls to other Drupal pages will run the SimpleTest prefixed database. The
michael@529 79 Index: modules/system/system.admin.inc
michael@748 80 --- modules/system/system.admin.inc.orig 2012-10-17 22:45:04.000000000 +0200
michael@748 81 +++ modules/system/system.admin.inc 2012-10-27 13:56:02.343450754 +0200
michael@748 82 @@ -1766,6 +1766,65 @@
michael@529 83 }
michael@529 84
michael@529 85 /**
michael@529 86 + * Form builder; Configure the site proxy settings.
michael@529 87 + *
michael@529 88 + * @ingroup forms
michael@529 89 + * @see system_settings_form()
michael@529 90 + */
michael@529 91 +function system_proxy_settings() {
michael@529 92 +
michael@529 93 + $form['forward_proxy'] = array(
michael@529 94 + '#type' => 'fieldset',
michael@529 95 + '#title' => t('Forward proxy settings'),
michael@529 96 + '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'),
michael@529 97 + );
michael@529 98 + $form['forward_proxy']['proxy_server'] = array(
michael@529 99 + '#type' => 'textfield',
michael@529 100 + '#title' => t('Proxy host name'),
michael@529 101 + '#default_value' => variable_get('proxy_server', ''),
michael@529 102 + '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.')
michael@529 103 + );
michael@529 104 + $form['forward_proxy']['proxy_port'] = array(
michael@529 105 + '#type' => 'textfield',
michael@529 106 + '#title' => t('Proxy port number'),
michael@529 107 + '#default_value' => variable_get('proxy_port', 8080),
michael@529 108 + '#description' => t('The port number of the proxy server, eg. 8080'),
michael@529 109 + );
michael@529 110 + $form['forward_proxy']['proxy_username'] = array(
michael@529 111 + '#type' => 'textfield',
michael@529 112 + '#title' => t('Proxy username'),
michael@529 113 + '#default_value' => variable_get('proxy_username', ''),
michael@529 114 + '#description' => t('The username used to authenticate with the proxy server.'),
michael@529 115 + );
michael@529 116 + $form['forward_proxy']['proxy_password'] = array(
michael@529 117 + '#type' => 'textfield',
michael@529 118 + '#title' => t('Proxy password'),
michael@529 119 + '#default_value' => variable_get('proxy_password', ''),
michael@529 120 + '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '')
michael@529 121 + );
michael@529 122 + $form['#validate'][] = 'system_proxy_settings_validate';
michael@529 123 +
michael@529 124 + return system_settings_form($form);
michael@529 125 +}
michael@529 126 +
michael@529 127 +/**
michael@529 128 + * Validate the submitted proxy form.
michael@529 129 + */
michael@529 130 +function system_proxy_settings_validate($form, &$form_state) {
michael@529 131 + // Validate the proxy settings
michael@529 132 + $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']);
michael@529 133 + if ($form_state['values']['proxy_server'] != '') {
michael@529 134 + // TCP allows the port to be between 0 and 65536 inclusive
michael@529 135 + if (!is_numeric($form_state['values']['proxy_port'])) {
michael@529 136 + form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.'));
michael@529 137 + }
michael@529 138 + elseif ($form_state['values']['proxy_port'] < 0 || $form_state['values']['proxy_port'] >= 65536) {
michael@529 139 + form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.'));
michael@529 140 + }
michael@529 141 + }
michael@529 142 +}
michael@529 143 +
michael@529 144 +/**
michael@529 145 * Form builder; Configure the site file handling.
michael@529 146 *
michael@529 147 * @ingroup forms
michael@529 148 Index: modules/system/system.module
michael@529 149 --- modules/system/system.module.orig 2008-04-09 23:11:49 +0200
michael@529 150 +++ modules/system/system.module 2008-04-24 11:43:47 +0200
michael@530 151 @@ -723,6 +723,14 @@
michael@530 152 'access arguments' => array('access administration pages'),
michael@529 153 'file' => 'system.admin.inc',
michael@529 154 );
michael@529 155 + $items['admin/settings/proxy'] = array(
michael@529 156 + 'title' => 'Proxy server',
michael@529 157 + 'description' => 'Configure settings when the site is behind a proxy server.',
michael@529 158 + 'page callback' => 'drupal_get_form',
michael@529 159 + 'page arguments' => array('system_proxy_settings'),
michael@529 160 + 'access arguments' => array('administer site configuration'),
michael@529 161 + 'file' => 'system.admin.inc',
michael@529 162 + );
michael@530 163 $items['admin/config/media/file-system'] = array(
michael@529 164 'title' => 'File system',
michael@529 165 'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
michael@530 166 Index: includes/install.core.inc
michael@530 167 --- includes/install.core.inc.orig 2012-08-01 18:27:42.000000000 +0200
michael@530 168 +++ includes/install.core.inc 2012-08-22 21:55:27.582420660 +0200
michael@748 169 @@ -1770,7 +1770,7 @@
michael@530 170 1 => st('Check for updates automatically'),
michael@530 171 2 => st('Receive e-mail notifications'),
michael@530 172 ),
michael@530 173 - '#default_value' => array(1, 2),
michael@529 174 + '#default_value' => array(),
michael@530 175 '#description' => st('The system will notify you when updates and important security releases are available for installed components. Anonymous information about your site is sent to <a href="@drupal">Drupal.org</a>.', array('@drupal' => 'http://drupal.org')),
michael@529 176 '#weight' => 15,
michael@529 177 );
michael@530 178 Index: sites/default/default.settings.php
michael@530 179 --- sites/default/default.settings.php.orig 2012-08-01 18:27:42.000000000 +0200
michael@530 180 +++ sites/default/default.settings.php 2012-08-22 21:39:06.793031214 +0200
michael@530 181 @@ -257,6 +257,24 @@
michael@530 182 # $base_url = 'http://www.example.com'; // NO trailing slash!
michael@529 183
michael@529 184 /**
michael@530 185 + * Local Base URL (optional).
michael@530 186 + *
michael@530 187 + * If you are running Drupal behind a reverse proxy, $base_url (see above)
michael@530 188 + * usually points to the URL of the reverse proxy. Drupal uses this for
michael@530 189 + * all sorts of external URLs. In order to correctly calculate sub-URLs
michael@530 190 + * below $base_url for embedded HTML forms, Drupal also has to know the
michael@530 191 + * URL on the local/origin server under which Drupal is contacted by the
michael@530 192 + * reverse proxy. This is what $base_url_local is for.
michael@530 193 + *
michael@530 194 + * Examples:
michael@530 195 + * $base_url_local = 'http://www.example.com:8080/drupal';
michael@530 196 + *
michael@530 197 + * It is not allowed to have a trailing slash; Drupal will add it
michael@530 198 + * for you.
michael@530 199 + */
michael@530 200 +# $base_url_local = 'http://www.example.com:8080/drupal'; // NO trailing slash!
michael@530 201 +
michael@530 202 +/**
michael@530 203 * PHP settings:
michael@529 204 *
michael@530 205 * To see what PHP settings are possible, including whether they can be set at

mercurial