Sprout from master 2005-12-08 15:25:01 UTC Elan Ruusamäe <glen@pld-linux.org> '- fix textarea'
Delete:
drupal-cron.patch
drupal-emptypass.patch
drupal-replication.patch
drupal-sitesdir.patch
drupal-themedir2.patch
drupal-topdir.patch
drupal.PLD
drupal.conf
drupal.cron
+++ /dev/null
---- ./includes/bootstrap.inc 2005-10-11 10:02:05.000000000 +0300
-+++ /tmp/bootstrap.inc 2005-10-11 10:01:51.000000000 +0300
-@@ -50,7 +50,7 @@
-
- $confdir = '/etc/drupal/sites';
- $uri = explode('/', $_SERVER['PHP_SELF']);
-- $server = explode('.', rtrim($_SERVER['HTTP_HOST'], '.'));
-+ $server = explode('.', rtrim(@$_SERVER['HTTP_HOST'], '.'));
- for ($i = count($uri) - 1; $i > 0; $i--) {
- for ($j = count($server); $j > 0; $j--) {
- $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
---- ./includes/session.inc 2005-08-10 23:43:03.000000000 +0300
-+++ /tmp/session.inc 2005-10-11 10:03:38.000000000 +0300
-@@ -25,7 +25,7 @@
- $result = db_query_range("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = '%s' AND u.status < 3", $key, 0, 1);
-
- if (!db_num_rows($result)) {
-- db_query("INSERT INTO {sessions} (sid, uid, hostname, timestamp) VALUES ('%s', 0, '%s', %d)", $key, $_SERVER["REMOTE_ADDR"], time());
-+ db_query("INSERT INTO {sessions} (sid, uid, hostname, timestamp) VALUES ('%s', 0, '%s', %d)", $key, @$_SERVER["REMOTE_ADDR"], time());
- $result = db_query("SELECT u.* FROM {users} u WHERE u.uid = 0");
- }
-
---- ./cron.php~ 2005-01-09 11:22:38.000000000 +0200
-+++ ./cron.php 2005-12-05 13:27:39.904990542 +0200
-@@ -12,6 +12,7 @@
- // If not in 'safe mode', increase the maximum execution time:
- if (!ini_get('safe_mode')) {
- set_time_limit(240);
-+ ini_set('memory_limit', '12M');
- }
-
- // Check if the last cron run completed
+++ /dev/null
-# without replication patch:
-#--- ./includes/database.mysql.inc~ 2005-04-14 21:50:23.000000000 +0300
-#+++ ./includes/database.mysql.inc 2005-05-18 18:48:24.970031862 +0300
-#@@ -28,7 +28,7 @@
-# $url['host'] = $url['host'] .':'. $url['port'];
-# }
-#
-#- $connection = mysql_connect($url['host'], $url['user'], $url['pass'], TRUE) or die(mysql_error());
-#+ $connection = mysql_connect($url['host'], $url['user'], @$url['pass'], TRUE) or die(mysql_error());
-# mysql_select_db(substr($url['path'], 1)) or die('unable to select database');
-#
-# return $connection;
---- ./includes/database.mysql.inc~ 2005-10-28 22:32:31.000000000 +0300
-+++ ./includes/database.mysql.inc 2005-10-28 22:32:57.000000000 +0300
-@@ -29,7 +29,7 @@
- }
-
- // For replication setups, we will assume that dieing is bad
-- $connection = mysql_connect($url['host'], $url['user'], $url['pass'], TRUE);
-+ $connection = mysql_connect($url['host'], $url['user'], @$url['pass'], TRUE);
- if(!is_resource($connection) && $critical) {
- die(mysql_error());
- }
+++ /dev/null
-Replication patch from
-http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/crackerjm/replication/
-
---- /dev/null 2005-02-16 21:06:48.000000000 +0200
-+++ ./README.replication 2005-08-15 16:08:52.000000000 +0300
-@@ -0,0 +1,34 @@
-+
-+This README.txt and patch are for Mysql Replication. This assumes that you have
-+a master replication server and slave server(s) up and running already. If
-+you don't, then there is no purpose for reading this. If you need help for
-+replication, please read this link.
-+ http://dev.mysql.com/doc/mysql/en/Replication.html
-+
-+NOTE: This is meant for drupal 4.6.0
-+
-+Now, in includes/conf.php you have a line that looks simalar to this
-+ $db_url = "mysql://username:password@localhost/database";
-+Comment at the line so that it looks like this
-+ //$db_url = "mysql://username:password@localhost/database";
-+
-+Add the following lines below it to look like this:
-+ $db_url = array();
-+ $db_url['default'] = "mysql://username:password@localhost/database";
-+ $db_url['slave1'] = "mysql://username:password@host/database";
-+ //$db_url['slave2'] = "mysql://username:password@host/database";
-+
-+The 'default' is your MASTER server, the slaves are just that. make
-+sure that you have added the appropriate users to the servers so that
-+if you are using round robin DNS or something to that effect, that
-+way you don't end up with permission denied.
-+
-+patch your code with replication.patch and there ya go
-+
-+***********
-+NEW: This revision of code supports the dead slave servers!
-+ caveat though, if ALL of your slaves are dead, then you will
-+ end up in a infinitely recursive loop searching for slave servers.
-+ Hopefully in the next revision of this, I will try to come up with
-+ a way to stop this recursion without the use of flags.
-+***********
-diff -urN drupal-4.6.0/includes/database.inc drupal-test/includes/database.inc
---- drupal-4.6.0/includes/database.inc 2005-04-08 09:24:10.000000000 -0500
-+++ drupal-test/includes/database.inc 2005-05-29 09:30:18.710563836 -0500
-@@ -119,11 +119,98 @@
- die('Unsupported database type');
- }
-
-- $db_conns[$name] = db_connect($connect_url);
--
-+ if($name == 'default') {
-+ // die on failure
-+ $db_conns[$name] = db_connect($connect_url, true);
-+ }
-+ else {
-+ $db_conns[$name] = db_connect($connect_url);
-+ }
-+
- }
- // Set the active connection.
-- $active_db = $db_conns[$name];
-+ if($name != 'default' && $db_conns[$name] === false){
-+ print "Bad slave, killing $name\n";
-+ db_find_slave(true); // kill bad slave
-+ db_set_active(db_find_slave());
-+ }
-+ else {
-+ $active_db = $db_conns[$name];
-+ }
-+}
-+
-+function _is_commit($query) {
-+ $commits = array('insert', 'alter', 'update', 'delete', 'flush', 'lock');
-+ foreach($commits as $type) {
-+ if(preg_match("/^$type/i", $query)) {
-+ return true;
-+ }
-+ }
-+ return false;
-+}
-+
-+function db_find_slave($killslave = false) {
-+ global $db_url;
-+ static $slave ;
-+
-+ if(!_replication_ready())
-+ return 'default';
-+
-+ if(!is_array($slave)){
-+ $slave = array();
-+ // initialize a local copy
-+ foreach($db_url as $key=>$value) {
-+ if(stristr($key, 'slave')) {
-+ $slave[] = $key;
-+ }
-+ }
-+ /**
-+ * Since this is the first iteration of the loop, we reset the array to
-+ * ensure we return the first element.
-+ */
-+ return reset($slave);
-+ }
-+
-+ if(empty($slave)) {
-+ return 'default';
-+ }
-+
-+ // Failed to connect, remove from the list
-+ if($killslave){
-+ array_shift($slave);
-+ }
-+
-+ $url = next($slave);
-+
-+ if($url === false){
-+ // walked past of the end of the array, start over at first element
-+ $url = reset($slave);
-+ }
-+
-+ return $url;
-+}
-+
-+function _replication_ready() {
-+ global $db_url;
-+ static $ready;
-+
-+ if(isset($ready)) {
-+ return $ready;
-+ }
-+
-+ if(is_array($db_url)) {
-+ foreach($db_url as $key=>$value) {
-+ if(stristr($key, 'slave')) {
-+ // Found at least ONE element with the word slave in it
-+ // break the search to save on cycles
-+ $ready = true;
-+ return true;
-+ }
-+ }
-+ }
-+
-+ $ready = false;
-+ return false;
- }
-
- /**
-diff -urN drupal-4.6.0/includes/database.mysql.inc drupal-test/includes/database.mysql.inc
---- drupal-4.6.0/includes/database.mysql.inc 2005-04-14 13:50:23.000000000 -0500
-+++ drupal-test/includes/database.mysql.inc 2005-05-29 09:28:22.490546558 -0500
-@@ -20,7 +20,7 @@
- * performance, however, when the overhead to connect to your database is high
- * (e.g. your database and web server live on different machines).
- */
--function db_connect($url) {
-+function db_connect($url, $critical = false) {
- $url = parse_url($url);
-
- // Allow for non-standard MySQL port.
-@@ -28,10 +28,16 @@
- $url['host'] = $url['host'] .':'. $url['port'];
- }
-
-- $connection = mysql_connect($url['host'], $url['user'], $url['pass'], TRUE) or die(mysql_error());
-- mysql_select_db(substr($url['path'], 1)) or die('unable to select database');
-+ // For replication setups, we will assume that dieing is bad
-+ $connection = mysql_pconnect($url['host'], $url['user'], $url['pass'], TRUE);
-+ if(!is_resource($connection) && $critical) {
-+ die(mysql_error());
-+ }
-+ // We die on bad slaves. These should be taken care of
-+ // maybe hook this somehow or something
-+ mysql_select_db(substr($url['path'], 1)) or die(mysql_error());
-
-- return $connection;
-+ return ($connection)?$connection:false;
- }
-
- /**
-@@ -40,14 +46,38 @@
- function _db_query($query, $debug = 0) {
- global $active_db;
- global $queries;
-+ global $db_url;
-
- if (variable_get('dev_query', 0)) {
- list($usec, $sec) = explode(' ', microtime());
- $timer = (float)$usec + (float)$sec;
- }
-
-+ /**
-+ * If the db_url isn't an array, then we can assume that this server is not
-+ * ready for a replication setup. This outer if is purely for a speed as
-+ * calling PHP's builtin functions are way faster than user functions.
-+ * So, if its an array and has more than one element, we shall atleast check
-+ * to see if it's possibly ready for a replication enviorment. However,
-+ * if no [slave#] elements are found, then we assume normal operations.
-+ */
-+ if(is_array($db_url) && sizeof($db_url) > 1 && _replication_ready() )
-+ {
-+ if (_is_commit($query) === true){
-+ db_set_active('default');
-+ }
-+ else
-+ {
-+ // no checks as _replication_ready() verifies
-+ // that there is atleast one slave
-+ db_set_active(db_find_slave());
-+ }
-+ }
-+
-+
- $result = mysql_query($query, $active_db);
-
-+
- if (variable_get('dev_query', 0)) {
- list($usec, $sec) = explode(' ', microtime());
- $stop = (float)$usec + (float)$sec;
-@@ -67,6 +97,7 @@
- }
- }
-
-+
- /**
- * Fetch one result row from the previous query as an object.
- *
-@@ -239,4 +270,4 @@
- * @} End of "ingroup database".
- */
-
--?>
-\ No newline at end of file
-+?>
---- ./sites/default/settings.php~ 2005-08-15 16:41:07.000000000 +0300
-+++ ./sites/default/settings.php 2005-08-15 16:42:47.000000000 +0300
-@@ -77,8 +77,15 @@
- * Database URL format:
- * $db_url = 'mysql://username:password@localhost/database';
- * $db_url = 'pgsql://username:password@localhost/database';
-+ *
-+ * Database URL format with MySQL replication:
-+ * $db_url = array();
-+ * $db_url['default'] = "mysql://username:password@localhost/database";
-+ * $db_url['slave1'] = "mysql://username:password@host/database";
- */
--$db_url = 'mysql://username:password@localhost/database';
-+$db_url = array();
-+$db_url['default'] = 'mysql://mysql:@localhost/drupal';
-+#$db_url['slave1'] = "mysql://mysql:@mysql-slave/drupal";
- $db_prefix = '';
-
- /**
---- ./includes/database.mysql.inc~ 2005-10-28 22:31:38.000000000 +0300
-+++ ./includes/database.mysql.inc 2005-10-28 22:31:53.000000000 +0300
-@@ -29,7 +29,7 @@
- }
-
- // For replication setups, we will assume that dieing is bad
-- $connection = mysql_pconnect($url['host'], $url['user'], $url['pass'], TRUE);
-+ $connection = mysql_connect($url['host'], $url['user'], $url['pass'], TRUE);
- if(!is_resource($connection) && $critical) {
- die(mysql_error());
- }
+++ /dev/null
-diff -ur ./includes/bootstrap.inc ../drupal1/includes/bootstrap.inc
---- ./includes/bootstrap.inc 2005-04-05 22:00:24.000000000 +0300
-+++ ./drupal1/includes/bootstrap.inc 2005-05-19 18:20:06.845355509 +0300
-@@ -48,7 +48,7 @@
- return $conf;
- }
-
-- $confdir = 'sites';
-+ $confdir = '/etc/webapps/drupal/sites';
- $uri = explode('/', $_SERVER['PHP_SELF']);
- $server = explode('.', rtrim($_SERVER['HTTP_HOST'], '.'));
- for ($i = count($uri) - 1; $i > 0; $i--) {
+++ /dev/null
---- ../includes/theme.inc 2005-05-20 16:55:04.000000000 +0300
-+++ /tmp/theme.inc 2005-05-21 15:10:45.000000000 +0300
-@@ -74,7 +74,7 @@
- else {
- // File is a template/theme
- // Load its CSS, if it exists
-- if (file_exists($stylesheet = dirname($themes[$theme]->filename) .'/style.css')) {
-+ if (file_exists('htdocs/' . ($stylesheet = dirname($themes[$theme]->filename) .'/style.css'))) {
- theme_add_style($stylesheet);
- }
- }
+++ /dev/null
---- ./index.php~ 2004-08-21 09:42:34.000000000 +0300
-+++ ./index.php 2005-05-20 14:10:24.260339523 +0300
-@@ -9,6 +9,7 @@
- * prints the appropriate page.
- */
-
-+chdir('..');
- include_once 'includes/bootstrap.inc';
- drupal_page_header();
- include_once 'includes/common.inc';
---- drupal-4.6.2/xmlrpc.php~ 2004-08-21 09:42:34.000000000 +0300
-+++ drupal-4.6.2/xmlrpc.php 2005-07-06 18:44:26.000000000 +0300
-@@ -6,6 +6,7 @@
- * PHP page for handling incoming XML-RPC requests from clients.
- */
-
-+chdir('..');
- include_once 'includes/bootstrap.inc';
- include_once 'includes/common.inc';
- include_once 'includes/xmlrpc.inc';
+++ /dev/null
-About Drupal PLD packaging.
-
-I've attempted to make drupal packages with security in mind that code and html
-documents are separated.
-
-Therefore the files needed for web access are in separate htdocs/ directory and
-as drupal is not designed itself with such layout in mind, there are symlinks
-pointing to web root in modules dir. Could have accomplished this with
-patching, but that would need too much research how the drupal works.
-
-With this packaging logic You can easily setup your Drupal instance with
-non-Apache web server (like lighttpd) just pointing the document root to
-/usr/share/drupal/htdocs.
-
-Only exception for now is tinymce module which creates alias to shared tinymce
-package. but that single alias is easy to add at least in lighttpd.
+++ /dev/null
-#
-# Apache/PHP/Drupal settings.
-
-# Default setup is for running drupal in vhost.
-# You can setup drupal as alias /drupal, but you need to comment/uncomment few things.
-#
-# Please note that drupal-ID's don't work in subdirs, you need vhost for that.
-
-<Directory /usr/share/drupal/htdocs>
- Options FollowSymLinks
- AllowOverride None
- <IfModule mod_access.c>
- order allow,deny
- allow from all
- </IfModule>
-
- # Set the default handler.
- <IfModule mod_dir.c>
- DirectoryIndex index.php
- </IfModule>
-
- # Override PHP settings. More exist in sites/default/settings.php, but
- # the following cannot be changed at runtime. The first IfModule is
- # for Apache 1.3, the second for Apache 2.
- # php4 module under Apache 1.3
- <IfModule mod_php4.c>
- php_value magic_quotes_gpc 0
- php_value register_globals 0
- php_value session.auto_start 0
- php_value memory_limit 12M
- </IfModule>
- # php5 module under Apache 1.3
- <IfModule mod_php5.c>
- php_value magic_quotes_gpc 0
- php_value register_globals 0
- php_value session.auto_start 0
- php_value memory_limit 12M
- </IfModule>
-
- # php under Apache 2.x module
- <IfModule sapi_apache2.c>
- php_value magic_quotes_gpc 0
- php_value register_globals 0
- php_value session.auto_start 0
- php_value memory_limit 12M
- </IfModule>
-
- # Reduce the time dynamically generated pages are cache-able.
- <IfModule mod_expires.c>
- ExpiresByType text/html A1
- </IfModule>
-
- # Various rewrite rules.
- <IfModule mod_rewrite.c>
- RewriteEngine on
-
- # Modify the RewriteBase if you are using Drupal in a subdirectory and
- # the rewrite rules are not working properly.
- # Enable RewriteBase if you have drupal configured in virtualhost root.
- #RewriteBase /drupal
-
- # Rewrite old-style URLs of the form 'node.php?id=x'.
- #RewriteCond %{REQUEST_FILENAME} !-f
- #RewriteCond %{REQUEST_FILENAME} !-d
- #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
- #RewriteRule node.php index.php?q=node/view/%1 [L]
-
- # Rewrite old-style URLs of the form 'module.php?mod=x'.
- #RewriteCond %{REQUEST_FILENAME} !-f
- #RewriteCond %{REQUEST_FILENAME} !-d
- #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
- #RewriteRule module.php index.php?q=%1 [L]
-
- # Rewrite current-style URLs of the form 'index.php?q=x'.
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteCond %{REQUEST_FILENAME} !-d
- RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
- </IfModule>
-
- # Customized error messages.
- ErrorDocument 404 /index.php
-</Directory>
-
-# If having drupal installed as /drupal
-#<IfModule mod_alias.c>
-# Alias /drupal/files /var/lib/drupal
-# Alias /drupal /usr/share/drupal/htdocs
-#</IfModule>
-#
-#<Location /drupal>
-# # Customized error messages.
-# ErrorDocument 404 /drupal/index.php
-#</Location>
-
-<Directory /var/lib/drupal>
- allow from all
-</Directory>
-
-<VirtualHost *:80>
- ServerName drupal
- ServerAlias www.drupal
- DocumentRoot /usr/share/drupal/htdocs
-
- <IfModule mod_alias.c>
- Alias /files /var/lib/drupal
- </IfModule>
-</VirtualHost>
-
-# vim: filetype=apache ts=4 sw=4 et
+++ /dev/null
-# cron for Drupal.
-# bounce messages back to root
-MAILTO=root
-
-0 * * * * http cd /usr/share/drupal && /usr/bin/php cron.php
-
-# vim:syn=crontab