try installing MariaDB and PostgreSQL in one Travis run, enhanced post_install to install further domains

This commit is contained in:
Ralf Becker 2016-08-06 14:46:56 +02:00
parent 598e35fed6
commit 427620e9c4
2 changed files with 32 additions and 32 deletions

View File

@ -11,12 +11,6 @@ matrix:
allow_failures:
- php: hhvm
# test installation and run all tests with these databases
env:
matrix:
- DB=mysql
- DB=postgres
services:
- memcached
# - mysql we use mariadb instead installed via addons below
@ -70,19 +64,13 @@ before_script:
- sudo chown travis /var/lib/egroupware
script:
# install egroupware (PostgreSQL need some specific handling as it is not the default and we can not create users via sql)
- case $DB in
postgres)
psql -U postgres -c 'create database egroupware';
php doc/rpm-build/post_install.php --php `which php` --db_type pgsql --db_port 5432 --db_user postgres --db_pass ''
# install egroupware using MariaDB as domain "default"
- php doc/rpm-build/post_install.php --domain default
--source_dir `pwd` --start_db '' --autostart_db '' --start_webserver '' --webserver_user ''
;;
*)
php doc/rpm-build/post_install.php --php `which php`
# install egroupware using PostgreSQL as domain "pgsql", need some specific handling we can not create users via sql
- psql -U postgres -c 'create database egroupware';
- php doc/rpm-build/post_install.php --domain pgsql --db_type pgsql --db_port 5432 --db_user postgres --db_pass ''
--source_dir `pwd` --start_db '' --autostart_db '' --start_webserver '' --webserver_user ''
;;
esac
#- mysql -uroot -e 'show tables' egroupware
# Ubuntu has problems with #!/usr/bin/env php -dapc.enable=1, it stalls forever
- php -dapc.enable_cli=1 doc/test-cli.php
- ./doc/php_syntax_check.sh

View File

@ -15,7 +15,7 @@ if (php_sapi_name() !== 'cli') // security precaution: forbit calling post_insta
}
$verbose = false;
$config = array(
'php' => '/usr/bin/php',
'php' => PHP_BINARY,
'source_dir' => '/usr/share/egroupware',
'data_dir' => '/var/lib/egroupware',
'header' => '$data_dir/header.inc.php', // symlinked to source_dir by rpm
@ -165,7 +165,7 @@ function set_distro_defaults($distro=null)
set_distro_defaults();
// read config from command line
$argv = $_SERVER['argv'];
$argv = str_replace(array("''", '""'), '', $_SERVER['argv']);
$prog = array_shift($argv);
// check if we have EGW_POST_INSTALL set and prepend it to the command line (command line has precedence)
@ -254,7 +254,26 @@ check_fix_php_apc_ini();
// not limiting memory, as backups might fail with limit we set
$setup_cli = $config['php'].' -d memory_limit=-1 '.$config['setup-cli'];
if (!file_exists($config['header']) || filesize($config['header']) < 200) // default header redirecting to setup is 147 bytes
// if we have a header, include it
if (file_exists($config['header']) && filesize($config['header']) >= 200) // default header redirecting to setup is 147 bytes
{
$GLOBALS['egw_info'] = array(
'flags' => array(
'noapi' => true,
)
);
include $config['header'];
// get user from header and replace password, as we dont know it
$old_password = patch_header($config['header'],$config['config_user'],$config['config_passwd']);
// register a shutdown function to put old password back in any case
register_shutdown_function(function() use (&$config, $old_password)
{
patch_header($config['header'], $config['config_user'], $old_password);
});
}
// new header or does not include requested domain (!= "default") --> new install
if (!isset($GLOBALS['egw_domain']) || $config['domain'] !== 'default' && !isset($GLOBALS['egw_domain'][$config['domain']]))
{
// --> new install
$extra_config = '';
@ -319,8 +338,9 @@ if (!file_exists($config['header']) || filesize($config['header']) < 200) // def
run_cmd($config['php5enmod']);
}
// create header
$setup_header = $setup_cli.' --create-header '.escapeshellarg($config['config_passwd'].','.$config['config_user']).
// create or edit header header
$setup_header = $setup_cli.(isset($GLOBALS['egw_domain']) ? ' --edit-header ' : ' --create-header ').
escapeshellarg($config['config_passwd'].','.$config['config_user']).
' --domain '.escapeshellarg($config['domain'].','.$config['db_name'].','.$config['db_user'].','.$config['db_pass'].
','.$config['db_type'].','.$config['db_host'].','.$config['db_port']);
run_cmd($setup_header);
@ -391,14 +411,6 @@ else
{
// --> existing install --> update
// get user from header and replace password, as we dont know it
$old_password = patch_header($config['header'],$config['config_user'],$config['config_passwd']);
// register a shutdown function to put old password back in any case
register_shutdown_function(function() use (&$config, $old_password)
{
patch_header($config['header'], $config['config_user'], $old_password);
});
// update egroupware, or single app(s), in later case skip backup
$setup_update = $setup_cli.' --update '.escapeshellarg('all,'.$config['config_user'].','.$config['config_passwd'].
(empty($config['install-update-app']) ? '' : ',no,'.$config['install-update-app']));