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

View File

@ -15,7 +15,7 @@ if (php_sapi_name() !== 'cli') // security precaution: forbit calling post_insta
} }
$verbose = false; $verbose = false;
$config = array( $config = array(
'php' => '/usr/bin/php', 'php' => PHP_BINARY,
'source_dir' => '/usr/share/egroupware', 'source_dir' => '/usr/share/egroupware',
'data_dir' => '/var/lib/egroupware', 'data_dir' => '/var/lib/egroupware',
'header' => '$data_dir/header.inc.php', // symlinked to source_dir by rpm '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(); set_distro_defaults();
// read config from command line // read config from command line
$argv = $_SERVER['argv']; $argv = str_replace(array("''", '""'), '', $_SERVER['argv']);
$prog = array_shift($argv); $prog = array_shift($argv);
// check if we have EGW_POST_INSTALL set and prepend it to the command line (command line has precedence) // 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 // not limiting memory, as backups might fail with limit we set
$setup_cli = $config['php'].' -d memory_limit=-1 '.$config['setup-cli']; $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 // --> new install
$extra_config = ''; $extra_config = '';
@ -319,8 +338,9 @@ if (!file_exists($config['header']) || filesize($config['header']) < 200) // def
run_cmd($config['php5enmod']); run_cmd($config['php5enmod']);
} }
// create header // create or edit header header
$setup_header = $setup_cli.' --create-header '.escapeshellarg($config['config_passwd'].','.$config['config_user']). $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']. ' --domain '.escapeshellarg($config['domain'].','.$config['db_name'].','.$config['db_user'].','.$config['db_pass'].
','.$config['db_type'].','.$config['db_host'].','.$config['db_port']); ','.$config['db_type'].','.$config['db_host'].','.$config['db_port']);
run_cmd($setup_header); run_cmd($setup_header);
@ -391,14 +411,6 @@ else
{ {
// --> existing install --> update // --> 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 // update egroupware, or single app(s), in later case skip backup
$setup_update = $setup_cli.' --update '.escapeshellarg('all,'.$config['config_user'].','.$config['config_passwd']. $setup_update = $setup_cli.' --update '.escapeshellarg('all,'.$config['config_user'].','.$config['config_passwd'].
(empty($config['install-update-app']) ? '' : ',no,'.$config['install-update-app'])); (empty($config['install-update-app']) ? '' : ',no,'.$config['install-update-app']));