# HG changeset patch # User Michael Schloh von Bennewitz # Date 1346171325 -7200 # Node ID 7d4d11d301d6f749b24b877d78b9a73016f74d52 # Parent 3b08e6396b455bc84ce4d083d9b9cc9a672a0d6b Import package vendor original specs for necessary manipulations. diff -r 3b08e6396b45 -r 7d4d11d301d6 drupal/drupal-apache.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drupal/drupal-apache.conf Tue Aug 28 18:28:45 2012 +0200 @@ -0,0 +1,116 @@ +## +## drupal-apache.conf -- Drupal Apache Custom Configuration +## + +ServerRoot @l_prefix@ +ServerAdmin root@@l_hostname@.@l_domainname@ +ServerName @l_hostname@.@l_domainname@ +ServerTokens Prod +User @l_rusr@ +Group @l_rgrp@ +Listen 127.0.0.1:8080 + +# runtime files +PidFile @l_prefix@/var/drupal/run/apache.pid +ScoreBoardFile @l_prefix@/var/drupal/run/apache.sb +LockFile @l_prefix@/var/drupal/run/apache.lck + +# include apache-php +Include @l_prefix@/etc/apache/apache.d/apache-php.conf + +# server behaviour +Timeout 300 +KeepAlive on +MaxKeepAliveRequests 100 +KeepAliveTimeout 15 +MinSpareServers 5 +MaxSpareServers 10 +StartServers 5 +MaxClients 15 +MaxRequestsPerChild 500 +HostnameLookups off +UseCanonicalName on + +# access logging +LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined +LogFormat "%h %l %u %t \"%r\" %>s %b" common +LogFormat "%{Referer}i -> %U" referer +LogFormat "%{User-agent}i" agent +CustomLog @l_prefix@/var/drupal/log/apache.access.log common + +# error logging +LogLevel warn +ErrorLog @l_prefix@/var/drupal/log/apache.error.log +ServerSignature on + +# secure root directory + + Options FollowSymLinks + AllowOverride None + + +# browser specifics +BrowserMatch "Mozilla/2" nokeepalive +BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 +BrowserMatch "RealPlayer 4\.0" force-response-1.0 +BrowserMatch "Java/1\.0" force-response-1.0 +BrowserMatch "JDK/1\.0" force-response-1.0 + +# SSL/TLS support + + SSLRandomSeed startup builtin + SSLRandomSeed connect builtin + SSLMutex sem + SSLSessionCache shmcb:@l_prefix@/var/drupal/run/apache.scache(512000) + SSLSessionCacheTimeout 300 + SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL + SetEnvIf User-Agent ".*MSIE.*" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + +# configure PHP for Drupal +AddType application/x-httpd-php .php +php_admin_flag magic_quotes_gpc off +php_admin_flag register_globals off +php_admin_flag session.auto_start off +php_admin_value session.save_handler user +php_admin_value session.cache_limiter none +php_admin_value error_reporting 6135 +php_admin_value memory_limit 64M +php_admin_value mbstring.http_input pass +php_admin_value mbstring.http_output pass +php_admin_flag mbstring.encoding_translation off +php_admin_value include_path .:@l_prefix@/share/drupal/includes +php_admin_value upload_max_filesize 2M +php_admin_value post_max_size 8M + +# configure Drupal +RewriteEngine on +RewriteRule ^/$ /drupal/ [R,L] +Alias /drupal @l_prefix@/share/drupal +DocumentRoot @l_prefix@/share/drupal +DirectoryIndex index.php +ErrorDocument 404 /index.php +ExpiresByType text/html A1 + + Options -Indexes +FollowSymLinks + AllowOverride All + Order allow,deny + Allow from all + RewriteEngine On + RewriteBase /drupal + + + SetOutputFilter DEFLATE + + + SetOutputFilter DEFLATE + + diff -r 3b08e6396b45 -r 7d4d11d301d6 drupal/drupal-cron.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drupal/drupal-cron.sh Tue Aug 28 18:28:45 2012 +0200 @@ -0,0 +1,8 @@ +#!/bin/sh +## +## drupal-cron.sh -- Drupal Cron Job +## + +server=`grep '^Listen' @l_prefix@/etc/drupal/drupal-apache.conf | head -1 | awk '{ print $2; }'` +@l_prefix@/lib/openpkg/curl --silent --compressed http://$server/cron.php || true + diff -r 3b08e6396b45 -r 7d4d11d301d6 drupal/drupal-setup.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drupal/drupal-setup.sh Tue Aug 28 18:28:45 2012 +0200 @@ -0,0 +1,189 @@ +#!@l_bash@ +## +## drupal-setup.sh -- Drupal RDBMS Setup Utility +## + +# command line argument sanity check +prg="$0" +if [ $# -eq 0 ]; then + echo "$prg:ERROR: invalid command line" 1>&2 + echo "$prg:USAGE: $prg install []" 1>&2 + echo "$prg:USAGE: $prg uninstall" 1>&2 + echo "$prg:USAGE: $prg backup []" 1>&2 + echo "$prg:USAGE: $prg restore [|]" 1>&2 + echo "$prg:USAGE: $prg edit" 1>&2 + exit 1 +fi + +# database configuration +db_dir="@l_prefix@/var/drupal/db" +db_dump="@l_prefix@/var/drupal/dump" +db_type="@l_dbtype@" +db_name="drupal" +db_user="drupal" +db_pass="drupal" + +# determine RDBMS-specific details +if [ ".$db_type" = .mysql ]; then + db_sname="mysql" + db_suser=`grep "^user" @l_prefix@/etc/mysql/my.pwd |\ + sed -e 's;^user[^=]*= *;;' -e 's; *$;;'` + db_spass=`grep "^password" @l_prefix@/etc/mysql/my.pwd |\ + sed -e 's;^password[^=]*= *;;' -e 's; *$;;'` +elif [ ".$db_type" = .pgsql ]; then + db_sname=`grep "^superuser_database" @l_prefix@/var/postgresql/db/pg_superuser.conf |\ + sed -e 's;^ *superuser_database="\(.*\)".*;\1;'` + db_suser=`grep "^superuser_username" @l_prefix@/var/postgresql/db/pg_superuser.conf |\ + sed -e 's;^ *superuser_username="\(.*\)".*;\1;'` + db_spass=`grep "^superuser_password" @l_prefix@/var/postgresql/db/pg_superuser.conf |\ + sed -e 's;^ *superuser_password="\(.*\)".*;\1;'` +fi + +# dispatch operation +cmd="${1:-"install"}" +shift +case "$cmd" in + install ) + ## + ## create the database + ## + + if [ $# -gt 0 ]; then + db_dir="$1" + shift + fi + if [ ".$db_type" = .mysql ]; then + # FIXME: MySQL 5.0 still doesn't allow easy relocation of tablespaces + @l_prefix@/bin/mysqladmin --user="$db_suser" --password="$db_spass" create "$db_name" + ( echo "GRANT ALL PRIVILEGES ON $db_name.* TO $db_user@localhost IDENTIFIED BY '$db_pass';" + echo "FLUSH PRIVILEGES;" + ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" "$db_sname" + elif [ ".$db_type" = .pgsql ]; then + ( echo "CREATE ROLE $db_user LOGIN ENCRYPTED PASSWORD '$db_pass' NOCREATEDB NOCREATEUSER;" + echo "CREATE TABLESPACE $db_name OWNER $db_user LOCATION '$db_dir';" + echo "CREATE DATABASE $db_name OWNER $db_user TABLESPACE $db_name ENCODING 'UTF8' TEMPLATE template0;" + ) | PGPASSWORD="$db_spass" @l_prefix@/bin/psql -q -U "$db_suser" -d "$db_sname" -f- + fi + + # activate configuration directory + # (is automatically deactivated by installer afterwards) + if [ ".$DRUPAL_SETUP_RESTORE" = . ]; then + chmod 777 @l_prefix@/share/drupal/sites/default + fi + ;; + + uninstall ) + ## + ## remove the database + ## + + if [ ".$db_type" = .mysql ]; then + ( echo "DROP DATABASE $db_name;" + ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" "$db_sname" + elif [ ".$db_type" = .pgsql ]; then + ( echo "DROP DATABASE $db_name;" + echo "DROP TABLESPACE $db_name;" + echo "DROP ROLE $db_user;" + ) | PGPASSWORD="$db_spass" @l_prefix@/bin/psql -q -U "$db_suser" -d "$db_sname" -f- + fi + + # remove the generated configuration + if [ ".$DRUPAL_SETUP_RESTORE" = . ]; then + rm -f @l_prefix@/share/drupal/sites/default/settings.php + fi + ;; + + backup ) + ## + ## backup the database + ## + + # determine dumpfile + if [ $# -gt 0 ]; then + # manually managed dumpfile + dumpfile="$1" + else + # automatically managed (rotated) dumpfile + rm -f $db_dump/drupal-dump-9.sql.gz >/dev/null 2>&1 || true + i=8 + while [ $i -ge 0 ]; do + if [ -f $db_dump/drupal-dump-$i.sql.bz2 ]; then + mv $db_dump/drupal-dump-$i.sql.bz2 $db_dump/drupal-dump-`expr $i + 1`.sql.bz2 + fi + i=`expr $i - 1` + done + dumpfile="$db_dump/drupal-dump-0.sql.bz2" + fi + + # dump database content to dumpfile (compressed plain SQL format) + umask 007 + if [ ".$db_type" = .mysql ]; then + @l_prefix@/bin/mysqldump --user="$db_suser" --password="$db_spass" "$db_name" | \ + @l_prefix@/lib/openpkg/bzip2 -9 >$dumpfile + elif [ ".$db_type" = .pgsql ]; then + PGPASSWORD="$db_spass" @l_prefix@/bin/pg_dump -U "$db_suser" -S "$db_suser" "$db_name" | \ + @l_prefix@/lib/openpkg/bzip2 -9 >$dumpfile + fi + chown @l_rusr@:@l_rgrp@ $dumpfile >/dev/null 2>&1 || true + chmod 640 $dumpfile >/dev/null 2>&1 || true + ;; + + restore ) + ## + ## restore the database + ## + + # determine dumpfile + if [ $# -gt 0 ]; then + dumpfile="$1" + else + dumpfile="0" + fi + case "$dumpfile" in + [0-9] ) dumpfile="$db_dump/drupal-dump-$dumpfile.sql.bz2" ;; + esac + if [ ! -f $dumpfile ]; then + echo "drupal-setup:restore:ERROR: no such dump file: $dumpfile" 1>&2 + exit 1 + fi + + # optionally stop Drupal + eval `@l_prefix@/bin/openpkg rc drupal status 2>/dev/null || true` + if [ ".$drupal_active" = .yes ]; then + @l_prefix@/bin/openpkg rc drupal stop >/dev/null 2>&1 || true + fi + + # drop old and initialize new database + DRUPAL_SETUP_RESTORE=1 + export DRUPAL_SETUP_RESTORE + $prg uninstall || exit $? + $prg install || exit $? + + # restore database content from dumpfile (compressed plain SQL format) + if [ ".$db_type" = .mysql ]; then + @l_prefix@/lib/openpkg/bzip2 -d -c $dumpfile | \ + @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" "$db_name" >/dev/null + elif [ ".$db_type" = .pgsql ]; then + @l_prefix@/lib/openpkg/bzip2 -d -c $dumpfile | \ + PGPASSWORD="$db_spass" @l_prefix@/bin/psql -q -U "$db_suser" -d "$db_name" -f- >/dev/null + fi + + # optionally restart Drupal + if [ ".$drupal_active" = .yes ]; then + @l_prefix@/bin/openpkg rc drupal start >/dev/null 2>&1 || true + fi + ;; + + edit ) + ## + ## interactively edit the database + ## + + if [ ".$db_type" = .mysql ]; then + @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" "$db_name" + elif [ ".$db_type" = .pgsql ]; then + PGPASSWORD="$db_spass" @l_prefix@/bin/psql -U "$db_suser" -d "$db_name" + fi + ;; +esac + diff -r 3b08e6396b45 -r 7d4d11d301d6 drupal/drupal.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drupal/drupal.patch Tue Aug 28 18:28:45 2012 +0200 @@ -0,0 +1,373 @@ +Fix Reverse Proxy Support: +http://drupal.org/node/244593 +http://drupal.org/files/issues/drupal_80.patch + +Index: includes/bootstrap.inc +--- includes/bootstrap.inc.orig 2008-02-11 15:36:21 +0100 ++++ includes/bootstrap.inc 2008-04-09 20:47:49 +0200 +@@ -272,6 +272,7 @@ + */ + function conf_init() { + global $base_url, $base_path, $base_root; ++ global $base_url_local; + + // Export the following settings.php variables to the global namespace + global $db_url, $db_prefix, $cookie_domain, $conf, $installed_profile, $update_free_access; +@@ -723,9 +724,22 @@ + * generate an equivalent using other environment variables. + */ + function request_uri() { ++ global $base_url; ++ global $base_url_local; + + if (isset($_SERVER['REQUEST_URI'])) { + $uri = $_SERVER['REQUEST_URI']; ++ if (isset($base_url) && isset($base_url_local)) { ++ $parts = parse_url($base_url_local); ++ if ( strlen($uri) >= strlen($base_url_local) ++ && substr($uri, 0, strlen($base_url_local)) == $base_url_local) { ++ $uri = $base_url . substr($uri, strlen($base_url_local)); ++ } ++ elseif ( strlen($uri) >= strlen($parts["path"]) ++ && substr($uri, 0, strlen($parts["path"])) == $parts["path"]) { ++ $uri = $base_url . substr($uri, strlen($parts["path"])); ++ } ++ } + } + else { + if (isset($_SERVER['argv'])) { +@@ -792,6 +806,7 @@ + } + } + // Prevent multiple slashes to avoid cross site requests via the FAPI. ++ if (substr($uri, 0, 1) == "/") + $uri = '/'. ltrim($uri, '/'); + + return $uri; +Index: sites/default/default.settings.php +--- sites/default/default.settings.php.orig 2007-12-20 10:35:10 +0100 ++++ sites/default/default.settings.php 2008-04-09 20:47:32 +0200 +@@ -126,6 +126,24 @@ + # $base_url = 'http://www.example.com'; // NO trailing slash! + + /** ++ * Local Base URL (optional). ++ * ++ * If you are running Drupal behind a reverse proxy, $base_url (see above) ++ * usually points to the URL of the reverse proxy. Drupal uses this for ++ * all sorts of external URLs. In order to correctly calculate sub-URLs ++ * below $base_url for embedded HTML forms, Drupal also has to know the ++ * URL on the local/origin server under which Drupal is contacted by the ++ * reverse proxy. This is what $base_url_local is for. ++ * ++ * Examples: ++ * $base_url_local = 'http://www.example.com:8080/drupal'; ++ * ++ * It is not allowed to have a trailing slash; Drupal will add it ++ * for you. ++ */ ++# $base_url_local = 'http://www.example.com:8080/drupal'; // NO trailing slash! ++ ++/** + * PHP settings: + * + * To see what PHP settings are possible, including whether they can + +----------------------------------------------------------------------------- + +1. Support HTTP Proxies (mainly for update checks, RSS fetching, etc) +http://drupal.org/node/7881 +http://drupal.org/files/issues/proxy_11.patch +(post-adjusted and improved by RSE) + +2. Fix CSS Cache Building Procedure +http://drupal.org/node/275381 +http://drupal.org/files/issues/drupal-css-cache-building.patch +(created by RSE) + +Index: includes/common.inc +--- includes/common.inc.orig 2008-04-09 23:11:44 +0200 ++++ includes/common.inc 2008-06-26 20:16:16 +0200 +@@ -439,13 +439,27 @@ + case 'http': + $port = isset($uri['port']) ? $uri['port'] : 80; + $host = $uri['host'] . ($port != 80 ? ':'. $port : ''); +- $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15); ++ if (variable_get('proxy_server', '') != '') { ++ $proxy_server = variable_get('proxy_server', ''); ++ $proxy_port = variable_get('proxy_port', 8080); ++ $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15); ++ } ++ else { ++ $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15); ++ } + break; + case 'https': + // Note: Only works for PHP 4.3 compiled with OpenSSL. + $port = isset($uri['port']) ? $uri['port'] : 443; + $host = $uri['host'] . ($port != 443 ? ':'. $port : ''); +- $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20); ++ if (variable_get('proxy_server', '') != '') { ++ $proxy_server = variable_get('proxy_server', ''); ++ $proxy_port = variable_get('proxy_port', 8080); ++ $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15); ++ } ++ else { ++ $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20); ++ } + break; + default: + $result->error = 'invalid schema '. $uri['scheme']; +@@ -462,9 +476,14 @@ + } + + // Construct the path to act on. +- $path = isset($uri['path']) ? $uri['path'] : '/'; +- if (isset($uri['query'])) { +- $path .= '?'. $uri['query']; ++ if (variable_get('proxy_server', '') != '') { ++ $path = $url; ++ } ++ else { ++ $path = isset($uri['path']) ? $uri['path'] : '/'; ++ if (isset($uri['query'])) { ++ $path .= '?'. $uri['query']; ++ } + } + + // Create HTTP request. +@@ -482,6 +501,14 @@ + $defaults['Authorization'] = 'Authorization: Basic '. base64_encode($uri['user'] . (!empty($uri['pass']) ? ":". $uri['pass'] : '')); + } + ++ // If the proxy server required a username then attempt to authenticate with it ++ if (variable_get('proxy_username', '') != '') { ++ $username = variable_get('proxy_username', ''); ++ $password = variable_get('proxy_password', ''); ++ $auth_string = base64_encode($username . ($password != '' ? ':'. $password : '')); ++ $defaults['Proxy-Authorization'] = 'Proxy-Authorization: Basic '. $auth_string ."\r\n"; ++ } ++ + foreach ($headers as $header => $value) { + $defaults[$header] = $header .': '. $value; + } +Index: modules/system/system.admin.inc +--- modules/system/system.admin.inc.orig 2008-03-25 12:58:16 +0100 ++++ modules/system/system.admin.inc 2008-04-24 11:43:07 +0200 +@@ -1363,6 +1363,65 @@ + } + + /** ++ * Form builder; Configure the site proxy settings. ++ * ++ * @ingroup forms ++ * @see system_settings_form() ++ */ ++function system_proxy_settings() { ++ ++ $form['forward_proxy'] = array( ++ '#type' => 'fieldset', ++ '#title' => t('Forward proxy settings'), ++ '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'), ++ ); ++ $form['forward_proxy']['proxy_server'] = array( ++ '#type' => 'textfield', ++ '#title' => t('Proxy host name'), ++ '#default_value' => variable_get('proxy_server', ''), ++ '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.') ++ ); ++ $form['forward_proxy']['proxy_port'] = array( ++ '#type' => 'textfield', ++ '#title' => t('Proxy port number'), ++ '#default_value' => variable_get('proxy_port', 8080), ++ '#description' => t('The port number of the proxy server, eg. 8080'), ++ ); ++ $form['forward_proxy']['proxy_username'] = array( ++ '#type' => 'textfield', ++ '#title' => t('Proxy username'), ++ '#default_value' => variable_get('proxy_username', ''), ++ '#description' => t('The username used to authenticate with the proxy server.'), ++ ); ++ $form['forward_proxy']['proxy_password'] = array( ++ '#type' => 'textfield', ++ '#title' => t('Proxy password'), ++ '#default_value' => variable_get('proxy_password', ''), ++ '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '') ++ ); ++ $form['#validate'][] = 'system_proxy_settings_validate'; ++ ++ return system_settings_form($form); ++} ++ ++/** ++ * Validate the submitted proxy form. ++ */ ++function system_proxy_settings_validate($form, &$form_state) { ++ // Validate the proxy settings ++ $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']); ++ if ($form_state['values']['proxy_server'] != '') { ++ // TCP allows the port to be between 0 and 65536 inclusive ++ if (!is_numeric($form_state['values']['proxy_port'])) { ++ form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.')); ++ } ++ elseif ($form_state['values']['proxy_port'] < 0 || $form_state['values']['proxy_port'] >= 65536) { ++ form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.')); ++ } ++ } ++} ++ ++/** + * Form builder; Configure the site file handling. + * + * @ingroup forms +Index: modules/system/system.module +--- modules/system/system.module.orig 2008-04-09 23:11:49 +0200 ++++ modules/system/system.module 2008-04-24 11:43:47 +0200 +@@ -55,7 +55,7 @@ + $output .= '
  • '. t('support for enabling and disabling themes, which determine the design and presentation of your site. Drupal comes packaged with several core themes and additional contributed themes are available at the Drupal.org theme page.', array('@themes' => url('admin/build/themes'), '@drupal-themes' => 'http://drupal.org/project/themes')) .'
  • '; + $output .= '
  • '. t('a robust caching system that allows the efficient re-use of previously-constructed web pages and web page components. Drupal stores the pages requested by anonymous users in a compressed format; depending on your site configuration and the amount of your web traffic tied to anonymous visitors, Drupal\'s caching system may significantly increase the speed of your site.', array('@cache-settings' => url('admin/settings/performance'))) .'
  • '; + $output .= '
  • '. t('a set of routine administrative operations that rely on a correctly-configured cron maintenance task to run automatically. A number of other modules, including the feed aggregator, ping module and search also rely on cron maintenance tasks. For more information, see the online handbook entry for configuring cron jobs.', array('@cron' => url('admin/reports/status'), '@handbook' => 'http://drupal.org/cron')) .'
  • '; +- $output .= '
  • '. t('basic configuration options for your site, including date and time settings, file system settings, clean URL support, site name and other information, and a site maintenance function for taking your site temporarily off-line.', array('@date-settings' => url('admin/settings/date-time'), '@file-system' => url('admin/settings/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@site-maintenance' => url('admin/settings/site-maintenance'))) .'
  • '; ++ $output .= '
  • '. t('basic configuration options for your site, including date and time settings, file system settings, clean URL support, proxy server settings, a href="@site-info">site name and other information, and a site maintenance function for taking your site temporarily off-line.', array('@date-settings' => url('admin/settings/date-time'), '@file-system' => url('admin/settings/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@site-maintenance' => url('admin/settings/site-maintenance'))) .'
  • '; + $output .= '

    '. t('For more information, see the online handbook entry for System module.', array('@system' => 'http://drupal.org/handbook/modules/system/')) .'

    '; + return $output; + case 'admin': +@@ -406,6 +406,14 @@ + 'access arguments' => array('administer site configuration'), + 'file' => 'system.admin.inc', + ); ++ $items['admin/settings/proxy'] = array( ++ 'title' => 'Proxy server', ++ 'description' => 'Configure settings when the site is behind a proxy server.', ++ 'page callback' => 'drupal_get_form', ++ 'page arguments' => array('system_proxy_settings'), ++ 'access arguments' => array('administer site configuration'), ++ 'file' => 'system.admin.inc', ++ ); + $items['admin/settings/file-system'] = array( + 'title' => 'File system', + 'description' => 'Tell Drupal where to store uploaded files and how they are accessed.', + +----------------------------------------------------------------------------- + +Disable "Update notifications" check by default during installation. + +Index: install.php +--- install.php.orig 2008-02-08 23:00:45 +0100 ++++ install.php 2008-05-09 13:18:09 +0200 +@@ -1069,7 +1069,7 @@ + '#type' => 'checkboxes', + '#title' => st('Update notifications'), + '#options' => array(1 => st('Check for updates automatically')), +- '#default_value' => array(1), ++ '#default_value' => array(), + '#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, + ); + +----------------------------------------------------------------------------- + +No need to always expand the "Menu settings" on node edit pages. + +Index: modules/menu/menu.module +--- modules/menu/menu.module.orig 2008-04-09 23:11:48 +0200 ++++ modules/menu/menu.module 2008-05-16 20:03:48 +0200 +@@ -366,7 +366,7 @@ + '#title' => t('Menu settings'), + '#access' => user_access('administer menu'), + '#collapsible' => TRUE, +- '#collapsed' => FALSE, ++ '#collapsed' => TRUE, + '#tree' => TRUE, + '#weight' => -2, + '#attributes' => array('class' => 'menu-item-form'), + +----------------------------------------------------------------------------- + +Use a larger text-area on node edit pages. + +Index: modules/node/node.pages.inc +--- modules/node/node.pages.inc.orig 2008-02-27 20:44:44 +0100 ++++ modules/node/node.pages.inc 2008-05-16 20:06:45 +0200 +@@ -287,7 +287,8 @@ + '#type' => 'textarea', + '#title' => check_plain($label), + '#default_value' => $include ? $node->body : ($node->teaser . $node->body), +- '#rows' => 20, ++ '#rows' => 30, ++ '#cols' => 80, + '#required' => ($word_count > 0), + ); + +----------------------------------------------------------------------------- + +Avoid incorrect ordering of BLOG entries by removing the +db_rewrite_sql() calls which seem to introduce a wrong ordering. + +Index: modules/blog/blog.module +--- modules/blog/blog.module.orig 2008-05-19 09:27:35 +0200 ++++ modules/blog/blog.module 2008-07-29 21:20:42 +0200 +@@ -182,13 +182,13 @@ + * Helper function to determine if a user has blog posts already. + */ + function _blog_post_exists($account) { +- return (bool)db_result(db_query_range(db_rewrite_sql("SELECT 1 FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1"), $account->uid, 0, 1)); ++ return (bool)db_result(db_query_range("SELECT 1 FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1", $account->uid, 0, 1)); + } + + /** + * Implementation of hook_block(). + * +- * Displays the most recent 10 blog titles. ++ * Displays the most recent 5 blog titles. + */ + function blog_block($op = 'list', $delta = 0) { + global $user; +@@ -198,7 +198,7 @@ + } + else if ($op == 'view') { + if (user_access('access content')) { +- $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10); ++ $result = db_query_range("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC", 0, 5); + if ($node_title_list = node_title_list($result)) { + $block['content'] = $node_title_list; + $block['content'] .= theme('more_link', url('blog'), t('Read the latest blog entries.')); +Index: modules/blog/blog.pages.inc +--- modules/blog/blog.pages.inc.orig 2009-09-14 17:08:00 +0200 ++++ modules/blog/blog.pages.inc 2009-09-19 08:53:18 +0200 +@@ -25,7 +25,7 @@ + + $output = theme('item_list', $items); + +- $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid); ++ $result = pager_query("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC", variable_get('default_nodes_main', 10), 0, NULL, $account->uid); + $has_posts = FALSE; + + while ($node = db_fetch_object($result)) { +@@ -64,7 +64,7 @@ + + $output = theme('item_list', $items); + +- $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10)); ++ $result = pager_query("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC", variable_get('default_nodes_main', 10)); + $has_posts = FALSE; + + while ($node = db_fetch_object($result)) { +@@ -87,7 +87,7 @@ + * Menu callback; displays an RSS feed containing recent blog entries of a given user. + */ + function blog_feed_user($account) { +- $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->uid, 0, variable_get('feed_default_items', 10)); ++ $result = db_query_range("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC", $account->uid, 0, variable_get('feed_default_items', 10)); + $channel['title'] = t("!name's blog", array('!name' => $account->name)); + $channel['link'] = url('blog/'. $account->uid, array('absolute' => TRUE)); + +@@ -102,7 +102,7 @@ + * Menu callback; displays an RSS feed containing recent blog entries of all users. + */ + function blog_feed_last() { +- $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get('feed_default_items', 10)); ++ $result = db_query_range("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC", 0, variable_get('feed_default_items', 10)); + $channel['title'] = t('!site_name blogs', array('!site_name' => variable_get('site_name', 'Drupal'))); + $channel['link'] = url('blog', array('absolute' => TRUE)); + diff -r 3b08e6396b45 -r 7d4d11d301d6 drupal/drupal.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drupal/drupal.spec Tue Aug 28 18:28:45 2012 +0200 @@ -0,0 +1,268 @@ +## +## drupal.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2011 OpenPKG Foundation e.V. +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# package information +Name: drupal +Summary: Content Management Platform +URL: http://www.drupal.org/ +Vendor: Dries Buytaert et al. +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: PLUS +Group: CMS +License: GPL +Version: 6.22 +Release: 20110526 + +# package options +%option with_mysql yes +%option with_pgsql no +%option with_dcron no + +# checking for option conflicts +%if "%{with_mysql}" == "no" && "%{with_pgsql}" == "no" + %{error:one of the build-time options 'with_mysql' or 'with_pgsql' have to be enabled} +%endif +%if "%{with_mysql}" == "yes" && "%{with_pgsql}" == "yes" + %{error:only one of the build-time options 'with_mysql' or 'with_pgsql' can be enabled at a time} +%endif + +# list of sources +Source0: http://ftp.drupal.org/files/projects/drupal-%{version}.tar.gz +Source1: drupal-setup.sh +Source2: drupal-cron.sh +Source3: drupal-apache.conf +Source4: rc.drupal +Patch0: drupal.patch + +# build information +BuildPreReq: OpenPKG, openpkg >= 20100101, infozip +PreReq: OpenPKG, openpkg >= 20100101 +PreReq: pcre, pcre::with_utf8 +PreReq: apache +PreReq: apache::with_mod_deflate = yes +PreReq: apache-php +PreReq: apache-php::with_ctype = yes +PreReq: apache-php::with_gd = yes +PreReq: apache-php::with_mbstring = yes +PreReq: apache-php::with_session = yes +PreReq: apache-php::with_mm = yes +PreReq: apache-php::with_xml = yes +PreReq: apache-php::with_xslt = yes +PreReq: apache-php::with_sendmail = yes +%if "%{with_mysql}" == "yes" +PreReq: apache-php::with_mysql = yes +%endif +%if "%{with_pgsql}" == "yes" +PreReq: apache-php::with_pgsql = yes +%endif +%if "%{with_dcron}" == "yes" +PreReq: dcron +%endif +PreReq: MTA + +%description + Drupal is a dynamic web site platform which allows an individual + or community of users to publish, manage and organize a + variety of content, Drupal integrates many popular features of + content management systems, weblogs, collaborative tools and + discussion-based community software into one easy-to-use package. + +%track + prog drupal = { + version = %{version} + url = http://ftp.drupal.org/files/projects/ + regex = drupal-(6\.\d+)\.tar\.gz + } + +%prep + # unpack core distribution + %setup -q -n drupal-%{version} + + # apply local patches + %patch -p0 + +%build + +%install + # create installation hierarchy + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/sbin \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ + $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/sites \ + $RPM_BUILD_ROOT%{l_prefix}/share/drupal \ + $RPM_BUILD_ROOT%{l_prefix}/var/drupal/files \ + $RPM_BUILD_ROOT%{l_prefix}/var/drupal/run \ + $RPM_BUILD_ROOT%{l_prefix}/var/drupal/log \ + $RPM_BUILD_ROOT%{l_prefix}/var/drupal/dump \ + $RPM_BUILD_ROOT%{l_prefix}/var/drupal/db + + # avoid copying unnecessary text files + find . -name "*.orig" -print | xargs rm -f + rm -f CHANGELOG.txt COPYRIGHT.txt INSTALL.*.txt INSTALL.txt + rm -f LICENSE.txt MAINTAINERS.txt UPGRADE.txt + + # install all files (and strip down installation afterwards) + cp -rp * .htaccess \ + $RPM_BUILD_ROOT%{l_prefix}/share/drupal/ + + # pre-configure settings.php + %{l_shtool} subst \ +%if "%{with_mysql}" == "yes" + -e 's|^\( *\$db_url\) *=.*$|\1 = "mysql://drupal:drupal@127.0.0.1/drupal";|' \ +%endif +%if "%{with_pgsql}" == "yes" + -e 's|^\( *\$db_url\) *=.*$|\1 = "pgsql://drupal:drupal@127.0.0.1/drupal";|' \ +%endif + $RPM_BUILD_ROOT%{l_prefix}/share/drupal/sites/default/default.settings.php + + # set data location + ln -s ../../../../var/drupal/files \ + $RPM_BUILD_ROOT%{l_prefix}/share/drupal/sites/default/files + + # install run-command script +%if "%{with_dcron}" == "yes" + l_drupal_cron="no" +%else + l_drupal_cron="yes" +%endif + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + -e "s;@l_drupal_cron@;$l_drupal_cron;g" \ + %{SOURCE rc.drupal} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # install database setup script +%if "%{with_mysql}" == "yes" + l_dbtype="mysql" +%endif +%if "%{with_pgsql}" == "yes" + l_dbtype="pgsql" +%endif + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + -e "s;@l_dbtype@;$l_dbtype;g" \ + -e "s;@l_bash@;%{l_bash};g" \ + %{SOURCE drupal-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-setup + + # install crond(8) job script + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE drupal-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-cron +%if "%{with_dcron}" == "yes" + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs + echo "*/5 * * * * su %{l_rusr} -c %{l_prefix}/sbin/drupal-cron" \ + >$RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs/drupal +%endif + + # install custom Apache configuration + l_hostname=`%{l_shtool} echo -e %h` + l_domainname=`%{l_shtool} echo -e %d | cut -c2-` + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + -e "s;@l_hostname@;$l_hostname;g" \ + -e "s;@l_domainname@;$l_domainname;g" \ + %{SOURCE drupal-apache.conf} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/ + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%config %{l_prefix}/etc/drupal' \ +%if "%{with_dcron}" == "yes" + '%not %dir %{l_prefix}/etc/dcron' \ + '%not %dir %{l_prefix}/etc/dcron/crontabs' \ + '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dcron/crontabs/drupal' \ +%endif + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal' \ + '%attr(555,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal/sites/default' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/drupal' + +%files -f files + +%clean + +%post + if [ $1 -eq 1 ]; then + # display final hints on initial installation + ( echo "1. To complete this installation of Drupal please start the RDBMS" + echo " and initialize the Drupal database like this:" +%if "%{with_mysql}" == "yes" + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start" +%endif +%if "%{with_pgsql}" == "yes" + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start" +%endif + echo " \$ $RPM_INSTALL_PREFIX/sbin/drupal-setup install" + echo "" + echo "2. Now start Drupal by running the command" + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc drupal start" + echo " and connect with a browser to the URL:" + echo " http://127.0.0.1:8080/drupal/install.php" + echo " Follow the instructions. On the page \"Database configuration\"" +%if "%{with_mysql}" == "yes" + echo " use database type \"mysql\", database name \"drupal\", database" +%endif +%if "%{with_pgsql}" == "yes" + echo " use database type \"pgsql\", database name \"drupal\", database" +%endif + echo " username \"drupal\" and database password \"drupal\". Also create" + echo " an account and login. The first account will automatically become" + echo " the main administrator account with total control over Drupal." + echo "" + echo "3. By default, Drupal runs its own Apache server on IPv4 address" + echo " 127.0.0.1, TCP port 8080. Please change this by editing the" + echo " \"Listen 127.0.0.1:8080\" directive in" + echo " $RPM_INSTALL_PREFIX/etc/drupal/drupal-apache.conf" + echo " Also do not forget to cp -p" + echo " $RPM_INSTALL_PREFIX/share/drupal/sites/default/settings.php" + echo " $RPM_INSTALL_PREFIX/share/drupal/sites/settings.php" + echo " and adjust the \$base_url variable." + echo "" + echo "4. Access Drupal via:" + echo " http://127.0.0.1:8080/drupal/ (website view)" + echo " http://127.0.0.1:8080/drupal/admin (website admin)" + ) | %{l_rpmtool} msg -b -t notice + fi + if [ $1 -eq 2 ]; then + # display final hints on update installation + ( echo "Please perform a Drupal database upgrade by visiting the" + echo " http://127.0.0.1:8080/drupal/update.php" + echo "page on your Drupal website." + ) | %{l_rpmtool} msg -b -t notice + + # after upgrade, restart service + eval `%{l_rc} drupal status 2>/dev/null` + [ ".$drupal_active" = .yes ] && %{l_rc} drupal restart + fi + exit 0 + +%preun + if [ $1 -eq 0 ]; then + # before erase, stop service and remove log files + %{l_rc} drupal stop 2>/dev/null + $RPM_INSTALL_PREFIX/sbin/drupal-setup uninstall >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/drupal/files/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/drupal/log/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/drupal/run/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/drupal/dump/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/drupal/db/* >/dev/null 2>&1 || true + fi + exit 0 + diff -r 3b08e6396b45 -r 7d4d11d301d6 drupal/rc.drupal --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drupal/rc.drupal Tue Aug 28 18:28:45 2012 +0200 @@ -0,0 +1,65 @@ +#!@l_prefix@/bin/openpkg rc +## +## rc.drupal -- Run-Commands +## + +%config + drupal_enable="$openpkg_rc_def" + drupal_cron="@l_drupal_cron@" + drupal_backup="daily" + +%status -u @l_susr@ -o + drupal_usable="no" + drupal_active="no" + @l_prefix@/sbin/apache -t \ + -f @l_prefix@/etc/drupal/drupal-apache.conf 2>/dev/null && \ + drupal_usable="yes" + [ -f @l_prefix@/var/drupal/run/apache.pid ] && \ + kill -0 `cat @l_prefix@/var/drupal/run/apache.pid` && \ + drupal_active="yes" + echo "drupal_enable=\"$drupal_enable\"" + echo "drupal_usable=\"$drupal_usable\"" + echo "drupal_active=\"$drupal_active\"" + +%start -u @l_susr@ + rcService drupal enable yes || exit 0 + rcService drupal active yes && exit 0 + @l_prefix@/sbin/apache \ + -f @l_prefix@/etc/drupal/drupal-apache.conf + +%stop -u @l_susr@ + rcService drupal enable yes || exit 0 + rcService drupal active no && exit 0 + [ -f @l_prefix@/var/drupal/run/apache.pid ] && \ + kill -TERM `cat @l_prefix@/var/drupal/run/apache.pid` + sleep 2 + +%restart -u @l_susr@ + rcService drupal enable yes || exit 0 + rcService drupal active no && exit 0 + rc drupal stop start + +%quarterly -u @l_rusr@ + rcService drupal enable yes || exit 0 + if [ ".$drupal_cron" = .yes ]; then + @l_prefix@/sbin/drupal-cron + fi + +%hourly -u @l_rusr@ + rcService drupal enable yes || exit 0 + if [ ".$drupal_backup" = .hourly ]; then + @l_prefix@/sbin/drupal-setup backup || exit $? + fi + +%daily -u @l_rusr@ + rcService drupal enable yes || exit 0 + if [ ".$drupal_backup" = .daily ]; then + @l_prefix@/sbin/drupal-setup backup || exit $? + fi + +%weekly -u @l_rusr@ + rcService drupal enable yes || exit 0 + if [ ".$drupal_backup" = .weekly ]; then + @l_prefix@/sbin/drupal-setup backup || exit $? + fi +