Commit 8d8c9b48 authored by Francois Marier's avatar Francois Marier
Browse files

Changes to the way we handle config.php and the debconf questions

There are two files in /etc/mahara: config.debconf.php and config.php.  Both of these have symlinks in /var/www/mahara.

config.debconf.php is managed by debconf and is overwritten everytime the package is reconfigured.  It is not marked as a config file.

config.php includes config.debconf.php first in order to allow users to overwrite the debconf settings.  It is marked as a config file so that it's not overwritten automatically at configure time.
parent 33c40340
......@@ -23,5 +23,5 @@ function restart_apache2 {
}
function set_config {
perl -i -e '$field=shift;$value=shift if (scalar(@ARGV)>1);$value||="";while (<>) { s/(?:\s*\/\/\s*)?(\$cfg->$field.*=\s*).*/$1'\''$value'\'';/; print; }' $1 $2 /var/www/mahara/config.php
perl -i -e '$field=shift;$value=shift if (scalar(@ARGV)>1);$value||="";while (<>) { s/(?:\s*\/\/\s*)?(\$cfg->$field.*=\s*).*/$1'\''$value'\'';/; print; }' $1 $2 /etc/mahara/config.debconf.php
}
<?php
// WARNING: DO NOT EDIT THIS FILE!
//
// It is automatically generated by debconf and will be overwritten
// everytime the mahara Debian package is upgraded.
//
// Your local customizations should go into /etc/mahara/config.php
$cfg->dbhost = 'localhost';
$cfg->dbport = '';
$cfg->dbname = 'mahara';
$cfg->dbuser = 'mahara';
$cfg->wwwroot = 'http://localhost/mahara/';
$cfg->smtphosts = '';
$cfg->dataroot = '/var/lib/mahara';
?>
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Penny Leach <penny@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
$cfg = new StdClass;
require('config.debconf.php');
// database connection details
$cfg->dbtype = 'postgres8';
//$cfg->dbhost = 'localhost';
//$cfg->dbport = 5432;
//$cfg->dbname = 'mahara';
//$cfg->dbuser = 'mahara';
$cfg->dbpass = 'mahara';
//$cfg->dbprefix = '';
// wwwroot - the web-visible path to your Mahara installation
// Normally, this is automatically detected - if it doesn't work for you
// then try specifying it here
//$cfg->wwwroot = 'http://myhost.com/mahara/';
// dataroot - uploaded files are stored here
// must be writable by the webserver and outside document root.
// Mahara will NOT RUN if this is inside your document root, because
// this is a big security hole.
//$cfg->dataroot = '/path/to/uploaddir';
// system mail address. emails out come from this address.
// if not specified, will default to noreply@ automatically detected host.
// if that doesn't work or you want something else, then specify it here.
// $cfg->noreplyaddress = 'noreply@myhost.com'
// Logging configuration
// For each log level, you can specify where the messages are displayed.
// LOG_TARGET_SCREEN makes the error messages go to the screen - useful
// when debugging but not on a live site!
// LOG_TARGET_ERRORLOG makes the error messages go to the log as specified
// by the apache ErrorLog directive. It's probably useful to have this on
// for all log levels.
// You can combine them with bitwise operations,
// e.g. LOG_TARGET_SCREEN | LOG_TARGET_ERRORLOG
//
// This configuration is suitable for people running Mahara for the first
// time. You will immediately see environment errors, and so can correct
// them. You will be able to see other debugging information in your error
// logs. Once your site is up and running you might want to remove the
// environment level logging completely, and just log everything else to
// the error log.
$cfg->log_dbg_targets = LOG_TARGET_ERRORLOG;
$cfg->log_info_targets = LOG_TARGET_ERRORLOG;
$cfg->log_warn_targets = LOG_TARGET_ERRORLOG;
$cfg->log_environ_targets = LOG_TARGET_SCREEN | LOG_TARGET_ERRORLOG;
// This configuration is suitable for developers. You will see all errors
// and they will also be in the logs.
//$cfg->log_dbg_targets = LOG_TARGET_SCREEN | LOG_TARGET_ERRORLOG;
//$cfg->log_info_targets = LOG_TARGET_SCREEN | LOG_TARGET_ERRORLOG;
//$cfg->log_warn_targets = LOG_TARGET_SCREEN | LOG_TARGET_ERRORLOG;
//$cfg->log_environ_targets = LOG_TARGET_SCREEN | LOG_TARGET_ERRORLOG;
// The log levels that will generate backtraces. Useful for development,
// but probably only warnings are useful on a live site.
//$cfg->log_backtrace_levels = LOG_LEVEL_WARN | LOG_LEVEL_ENVIRON;
$cfg->log_backtrace_levels = LOG_LEVEL_WARN;
// Developer mode
// When set, the following things (among others) will happen:
//
// * 'debug.js' will be included on each page. You can edit this file to add
// debugging javascript at your discretion
// * 'debug.css' will be included on each page. You can edit this file to add
// debugging CSS at your discretion
// * firebuglite will be included, if you are not using Firefox
// * the unpacked version of MochiKit will be used
//
// These options are a performance hit otherwise, enable when you are
// developing for Mahara
$cfg->developermode = false;
// capture performance information and print it
// $cfg->perftofoot = true; // needs a call to mahara_performance_info (smarty callback) - see default theme's footer.tpl
// $cfg->perftolog = true;
// if neither are set, performance info wont be captured.
// mail handling
// if you want mahara to use smtp servers to send mail, enter one or more here
// blank means mahara will use the default PHP method.
// $cfg->smtphosts = 'mail.a.com;mail.b.com';
// If you have specified an smtp server above, and the server requires authentication,
// enter them here
// $cfg->smtpuser = '';
// $cfg->smtppass = '';
// xmlrpc
// if you're running in a configuration where the host contacting you will be
// using an IP address that is not the same as the IP address that is registered
// for its host name, then you should change the value below to 'true'.
$cfg->xmlrpc_allow_masquerading = false;
?>
etc/mahara
var/www/mahara
usr/share/mahara
var/lib/mahara
......
htdocs/* var/www/mahara
htdocs/.htaccess var/www/mahara
debian/apache.conf.template usr/share/mahara/
debian/config.debconf.php etc/mahara/
var/www/mahara/js/MochiKit/Packed.js var/www/mahara/js/MochiKit/setup.js
etc/mahara/config.debconf.php var/www/mahara/config.debconf.php
etc/mahara/config.php var/www/mahara/config.php
......@@ -26,8 +26,6 @@ APACHE_CONF_FILE=/etc/apache/conf.d/100-mahara
case "$1" in
configure)
cp /var/www/mahara/config-dist.php /var/www/mahara/config.php
# Configure Mahara
db_get mahara/db_host
set_config dbhost "${RET}"
......
......@@ -26,8 +26,6 @@ APACHE_CONF_FILE=/etc/apache2/sites-available/mahara
case "$1" in
configure)
cp /var/www/mahara/config-dist.php /var/www/mahara/config.php
# Configure Mahara
db_get mahara/db_host
set_config dbhost "${RET}"
......
......@@ -13,13 +13,21 @@ configure-stamp:
build: configure-stamp
install: configure-stamp
dh_testdir
dh_testroot
dh_installdirs
cp $(CURDIR)/debian/config.php $(CURDIR)/debian/mahara-apache2/etc/mahara/
cp $(CURDIR)/debian/config.php $(CURDIR)/debian/mahara-apache/etc/mahara/
clean:
dh_testdir
dh_testroot
rm -f configure-stamp
dh_clean
binary:
binary: build install
dh_testdir
dh_testroot
dh_installchangelogs
......@@ -30,13 +38,12 @@ binary:
dh_compress
dh_fixperms
cat debian/commonfunctions.sh >> debian/mahara-apache2.postinst.debhelper
cat debian/commonfunctions.sh >> debian/mahara-apache2.postrm.debhelper
cat debian/commonfunctions.sh >> debian/mahara-apache.postinst.debhelper
cat debian/commonfunctions.sh >> debian/mahara-apache.postrm.debhelper
cat $(CURDIR)/debian/commonfunctions.sh >> $(CURDIR)/debian/mahara-apache2.postinst.debhelper
cat $(CURDIR)/debian/commonfunctions.sh >> $(CURDIR)/debian/mahara-apache2.postrm.debhelper
cat $(CURDIR)/debian/commonfunctions.sh >> $(CURDIR)/debian/mahara-apache.postinst.debhelper
cat $(CURDIR)/debian/commonfunctions.sh >> $(CURDIR)/debian/mahara-apache.postrm.debhelper
dh_installdeb
dh_installdirs
dh_install
dh_link
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment