first step to new setup command line interface (setup/setup-cli.php):

- atm. all manageheader functionality is accessible
- reworked manageheader.php using the new setup_header class shared with setup-cli.php
=> install & update via cli is comming the next days
Works in 1.2 if you drop setup-cli.php and class.setup_header.inc.php in a 1.2 install.
This commit is contained in:
Ralf Becker 2006-05-27 23:59:41 +00:00
parent 1059aa9dec
commit db4a9e00e5
5 changed files with 862 additions and 659 deletions

View File

@ -1,5 +1,7 @@
%1 '%2' does not exist, is not readable by the webserver or contains no egroupware installation! setup de %1 '%2' existiert NICHT, ist nicht vom Webserver lesbar oder enthält keine eGroupWare Installation!
%1 does not exist !!! setup de %1 existiert nicht!!!
%1 is %2%3 !!! setup de %1 ist %2%3!!!
%1, %2 or %3 the configuration file. setup de %1, %2 oder %3 der Konfigurationsdatei.
(searching accounts and changing passwords) setup de Benutzerkonten suchen und Passwörter ändern)
*** do not update your database via setup, as the update might be interrupted by the max_execution_time, which leaves your db in an unrecoverable state (your data is lost) !!! setup de *** Updaten Sie NICHT Ihre Datenbank via Setup, da das Update von der max_execution_time (max. Ausführungszeit für Skripte) unterbrochen werden kann. Ihre Datenbank ist dann in einem nicht mehr wiederherstellbaren Zustand (Ihre Daten sind VERLOREN)!!!
*** you have to do the changes manualy in your php.ini (usualy in /etc on linux) in order to get egw fully working !!! setup de *** Sie müssen die Änderungen manuell in Ihrer php.ini Datei (üblicherweise in /etc unter Linux) durchführen, um eGroupWare vollständig/fehlerfrei ausführen zu können!!!
@ -30,6 +32,7 @@ all users setup de Alle Benutzer
allow authentication via cookie setup de Erlaube Benutzerauthentifizierung über ein Cookie
allow password migration setup de Erlaube Password Migration
allowed migration types (comma-separated) setup de Erlauber Migrationstypen (Komma separiert)
alternatively domains can be accessed by logging in with <i>username@domain</i>. setup de Auf Domains kann alternative auch durch Anmelden als <i>benutzer@domain</i> zugegriffen werden.
analysis setup de Analyse
and reload your webserver, so the above changes take effect !!! setup de UND reloaden Sie ihren Webserver, damit die obigen Änderungen in Kraft treten!!!
app details setup de Details der Anwendung
@ -79,7 +82,7 @@ because the enable flag for this app is set to 0, or is undefined setup de weil
bottom setup de unten
but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>these automated scripts can easily destroy your data.</strong> setup de Aber wir <u>raten Ihnen dringend, eine Sicherungskopie</u> anzulegen f&uuml;r den Fall, dass dieses Skript Ihre bestehenden Daten besch&auml;digt!<br /><strong>Diese automatisierten Skripts k&ouml;nnen leicht Ihre Daten besch&auml;digen!.</strong>
cancel setup de Abbrechen
cannot create the header.inc.php due to file permission restrictions.<br /> instead you can %1 the file. setup de Kann die Datei header.inc.php wegen unzureichenden Zugriffsrechten nicht erzeugen.<br />Stattdessen können Sie die Datei %1.
cannot create the header.inc.php due to file permission restrictions.<br /> instead you can %1 or %2 the file. setup de Kann die Datei header.inc.php wegen unzureichenden Zugriffsrechten nicht erzeugen.<br />Stattdessen können Sie die Datei %1 oder %2.
change system-charset setup de Systemzeichensatz wechseln
charset setup de ISO-8859-1
charset to convert to setup de Zeichensatz in den konvertiert werden soll
@ -128,9 +131,9 @@ current system-charset setup de Aktueller Systemzeichensatz
current system-charset is %1. setup de Aktueller Systemzeichensatz ist %1.
current version setup de Gegenwärtige Version
currently installed languages: %1 <br /> setup de Gegenwärtig installierte Sprachen: %1 <br />
database setup de Datenbank
database instance (egw domain) setup de Datenbankinstanz (eGW Domain)
database successfully converted from '%1' to '%2' setup de Datenbank erfolgreich von "%1" nach "%2" konvertiert
datebase setup de Datenbank
datetime port.<br />if using port 13, please set firewall rules appropriately before submitting this page.<br />(port: 13 / host: 129.6.15.28) setup de Port für Datum/Zeitabfragen<br />Wenn der Port 13 verwendet wird, bitte VOR dem Absenden die Firewallregeln dementsprechend setzen.<br />(Port 13/Host: 129.6.15.28)
day setup de Tag
day of week<br />(0-6, 0=sunday) setup de Wochentag<br />(0-6, 0=Sonntag)
@ -176,7 +179,9 @@ enable mcrypt setup de MCrypt einschalten
enter some random text for app session encryption setup de Zufallstext zur Verschlüsselung der Anwendungssitzung
enter some random text for app_session <br />encryption (requires mcrypt) setup de Zufallstext zur Verschlüsselung der Anwendungssitzung<br />(benötigt mcrypt)
enter the full path for temporary files.<br />examples: /tmp, c:\temp setup de Vollständiger Pfad für temporäre Dateien.<br />Beispiel: /tmp, C:\TEMP
enter the full path for temporary files.<br />examples: /tmp, c:temp setup de Vollständiger Pfad für temporäre Dateien.<br />Beispiel: /tmp, C:\TEMP
enter the full path for users and group files.<br />examples: /files, e:\files setup de Vollständiger Pfad für Benutzer- und Gruppendateien.<br />Beispiel: /files, E:\Files
enter the full path for users and group files.<br />examples: /files, e:files setup de Vollständiger Pfad für Benutzer- und Gruppendateien.<br />Beispiel: /files, E:\Files
enter the full path to the backup directory.<br />if empty: files directory setup de Vollständiger Pfad für das Datensicherungsverzeichnis.<br />Wenn leer: Dateiverzeichnis
enter the hostname of the machine on which this server is running setup de Hostname des Computers auf dem der Server läuft
enter the location of egroupware's url.<br />example: http://www.domain.com/egroupware &nbsp; or &nbsp; /egroupware<br /><b>no trailing slash</b> setup de URL zur eGroupWare Installation.<br />Beispiel: http://www.domain.com/egroupware or /egroupware<br /><b>keinen nachfolgenden Slash /</b>
@ -233,7 +238,7 @@ import accounts from ldap to the egroupware accounts table (for a new install us
import has been completed! setup de Import ist beendet!
import ldap users/groups setup de LDAP-Benutzer/-Gruppen importieren
importing old settings into the new format.... setup de Importiere alte Einstellung in das neue Format ...
include root (this should be the same as server root unless you know what you are doing) setup de Include-Root (sollte das gleiche Verzeichnis wie die Server-Root sein, au&szlig;er Sie wissen was Sie tun)
include root setup de Include-Root
include_path need to contain "." - the current directory setup de include_path muss "." - das aktuelle Verzeichnis - enthalten
install setup de Installieren
install all setup de Alle Installieren
@ -266,9 +271,12 @@ ldap modify setup de LDAP
ldap root password setup de LDAP-Root-Passwort
ldap rootdn setup de LDAP rootdn
ldap search filter for accounts, default: "(uid=%user)", %domain=egw-domain setup de LDAP Suchfilter für Benutzerkonten, Vorgabe "(uid=%user)", %domain=eGW Domain
leave empty to keep current. setup de Leer lassen um das existierende Password zu behalten.
limit access setup de Zugang beschränken
limit access to setup to the following addresses, networks or hostnames (e.g. 127.0.0.1,10.1.1,myhost.dnydns.org) setup de Zugang zu Setup auf die folgenden IP Adressen, Netzwerke oder Hostnamen beschränken (z.B. 127.0.0.1,10.1.1,myhost.dnydns.org)
login as user postgres, eg. by using su as root setup de Als Benutzer postgres einlogen, zB. durch benutzen von su als root
login to mysql - setup de mysql aufrufen -
loginname needed for domain configuration setup de Benutzername für die Konfiguration der Domain
logout setup de Abmelden
mail domain (for virtual mail manager) setup de Mail Domain (für Virtual Mail Manager)
mail server login type setup de Mail Server Login Typ
@ -326,9 +334,10 @@ or http://webdav.domain.com (webdav) setup de oder http://webdav.domain.com (f
or we can attempt to create the database for you: setup de Oder wir können versuchen die Datenbank für Sie anzulegen:
or you can install a previous backup. setup de Oder Sie können eine vorherige Datensicherung installieren.
password for smtp-authentication setup de Passwort für SMTP Authentifizierung
password needed for configuration setup de Passwort wird für die Konfiguration benötgt
password needed for domain configuration. setup de Passwort für die Konfiguration der Domain.
password of db user setup de Passwort des Datenbank Benutzers
passwords did not match, please re-enter setup de Passworte stimmten nicht überein, bitte nocheinmal eingeben
path (not url!) to your egroupware installation. setup de Pfad (nicht Internetadresse/URL!) Ihrer eGroupWare Installation.
path information setup de Pfadinformationen
path to user and group files has to be outside of the webservers document-root!!! setup de Pfad zu Benutzer und Gruppen Dateien MUSS AUSSERHALB des Wurzelverzeichnisses (document root) des Webservers sein!!!
pear is needed by syncml or the ical import+export of calendar. setup de PEAR wird von SyncML oder dem iCal Import+Export des Kalenders benötigt.
@ -416,6 +425,7 @@ setup demo accounts in ldap setup de Demo-Benutzer in LDAP einrichten
setup main menu setup de Setup-Hauptmenü
setup the database setup de Datenbank einzurichten
setup/config admin login setup de Setup-/Konfigurationsadmin-Login
should be the same as server root unless you know what you are doing. setup de Sollte das gleiche Verzeichnis wie die Server-Root sein, au&szlig;er Sie wissen was Sie tun.
show 'powered by' logo on setup de Zeige "powered by" Logo
size setup de Größe
skip the installation tests (not recommended) setup de Installationstests überspringen (nicht empfohlen)
@ -493,6 +503,7 @@ user for smtp-authentication (leave it empty if no auth required) setup de Benut
usernames are casesensitive setup de Benutzername mit Unterscheidung zwischen Groß- und Kleinschreibung
users choice setup de Benutzerauswahl
utf-8 (unicode) setup de utf-8 (Unicode)
validation errors setup de Fehler bei der Prüfung der Eingaben
version setup de Version
version mismatch setup de Versionen passen nicht zueinander
view setup de Anzeigen
@ -510,7 +521,7 @@ would you like egroupware to cache the phpgw info array ? setup de Soll eGroupWa
would you like egroupware to check for a new version<br />when admins login ? setup de Soll eGroupWare nach neuen Versionen suchen,<br /> wenn sich ein Administrator anmeldet ?
would you like to show each application's upgrade status ? setup de Soll der Upgrade-Status aller Anwendungen angezeigt werden ?
writable by the webserver setup de schreibar durch den Webserver
write config setup de Konfiguration schreiben
write setup de Schreiben
year setup de Jahr
yes setup de Ja
yes, with lowercase usernames setup de Ja, mit kleingeschriebenen Benutzernamen
@ -522,6 +533,7 @@ you appear to have %1 support. setup de Sie scheinen %1 Unterst
you appear to have php session support. enabling php sessions. setup de Sie scheinen PHP Session Unterstützung zu haben. PHP Sessions eingeschaltet.
you appear to have xml support enabled setup de Sie scheinen XML Unterstützung zu haben.
you are ready for this stage, but this stage is not yet written.<br /> setup de Sie sind bereit für diesen Schritt, aber dieser Abschnitt wurde noch nicht geschrieben.<br />
you are using php version %1. egroupware now requires %2 or later, recommended is php %3. setup de Sie benutzen die PHP Version %1. eGroupWare benötigt mindestens die Version %2, empfohlen ist PHP %3.
you can install it by running: setup de Installation durch ausführen von:
you didn't enter a config password for domain %1 setup de Sie haben kein Passwort für die Domain %1 angegeben
you didn't enter a config username for domain %1 setup de Sie haben keinen Benutzernamen für die Domain %1 angegeben
@ -531,7 +543,7 @@ you do not have any languages installed. please install one now <br /> setup de
you have not created your header.inc.php yet!<br /> you can create it now. setup de Sie haben bisher noch keine header.inc.php angelegt!<br />Sie können sie jetzt anlegen.
you have successfully logged out setup de Sie haben sich erfolgreich abgemeldet.
you must enter a username for the admin setup de Sie müssen einen Benutzernamen für den Administrator eingeben!
you need to add some domains to your header.inc.php. setup de Sie müssen mindestens eine Domain zu Ihrer header.inc.php hinzufügen.
you need to add at least one egroupware domain / database instance. setup de Sie müssen mindestens eine eGroupWare Domain / Datenbank Instanz hinzufügen.
you need to select your current charset! setup de Sie müssen Ihren aktuellen Zeichensatz auswählen!
you should either uninstall and then reinstall it, or attempt manual repairs setup de Sie sollten entweder de- und neuinstallieren, oder manuelle Reparaturen versuchen
you will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/readme setup de Sie müssen das notwendige phpgwAccounts Schema auf Ihrem LDAP Server installieren - siehe <a href="../phpgwapi/doc/ldap/README" target="_blank">phpgwapi/doc/ldap/README</a>.

View File

@ -1,5 +1,7 @@
%1 '%2' does not exist, is not readable by the webserver or contains no egroupware installation! setup en %1 '%2' does NOT exist, is not readable by the webserver or contains no eGroupWare installation!
%1 does not exist !!! setup en %1 does not exist !!!
%1 is %2%3 !!! setup en %1 is %2%3 !!!
%1, %2 or %3 the configuration file. setup en %1, %2 or %3 the configuration file.
(searching accounts and changing passwords) setup en (searching accounts and changing passwords)
*** do not update your database via setup, as the update might be interrupted by the max_execution_time, which leaves your db in an unrecoverable state (your data is lost) !!! setup en *** Do NOT update your database via setup, as the update might be interrupted by the max_execution_time, which leaves your DB in an unrecoverable state (your data is lost) !!!
*** you have to do the changes manualy in your php.ini (usualy in /etc on linux) in order to get egw fully working !!! setup en *** You have to do the changes manualy in your php.ini (usualy in /etc on linux) in order to get eGW fully working !!!
@ -30,6 +32,7 @@ all users setup en All Users
allow authentication via cookie setup en Allow authentication via cookie
allow password migration setup en Allow password migration
allowed migration types (comma-separated) setup en Allowed migration types (comma-separated)
alternatively domains can be accessed by logging in with <i>username@domain</i>. setup en Alternatively domains can be accessed by logging in with <i>username@domain</i>.
analysis setup en Analysis
and reload your webserver, so the above changes take effect !!! setup en AND reload your webserver, so the above changes take effect !!!
app details setup en App details
@ -79,7 +82,7 @@ because the enable flag for this app is set to 0, or is undefined setup en becau
bottom setup en bottom
but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>these automated scripts can easily destroy your data.</strong> setup en but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>These automated scripts can easily destroy your data.</strong>
cancel setup en Cancel
cannot create the header.inc.php due to file permission restrictions.<br /> instead you can %1 the file. setup en Cannot create the header.inc.php due to file permission restrictions.<br /> Instead you can %1 the file.
cannot create the header.inc.php due to file permission restrictions.<br /> instead you can %1 or %2 the file. setup en Cannot create the header.inc.php due to file permission restrictions.<br /> Instead you can %1 or %2 the file.
change system-charset setup en Change system-charset
charset setup en ISO-8859-1
charset to convert to setup en Charset to convert to
@ -128,9 +131,9 @@ current system-charset setup en Current system-charset
current system-charset is %1. setup en Current system-charset is %1.
current version setup en Current Version
currently installed languages: %1 <br /> setup en Currently installed languages: %1 <br />
database setup en Database
database instance (egw domain) setup en Database instance (eGW domain)
database successfully converted from '%1' to '%2' setup en Database successfully converted from '%1' to '%2'
datebase setup en Datebase
datetime port.<br />if using port 13, please set firewall rules appropriately before submitting this page.<br />(port: 13 / host: 129.6.15.28) setup en Datetime port.<br />If using port 13, please set firewall rules appropriately before submitting this page.<br />(Port: 13 / Host: 129.6.15.28)
day setup en day
day of week<br />(0-6, 0=sunday) setup en day of week<br />(0-6, 0=sunday)
@ -233,7 +236,7 @@ import accounts from ldap to the egroupware accounts table (for a new install us
import has been completed! setup en Import has been completed!
import ldap users/groups setup en Import LDAP users/groups
importing old settings into the new format.... setup en Importing old settings into the new format....
include root (this should be the same as server root unless you know what you are doing) setup en Include Root (this should be the same as Server Root unless you know what you are doing)
include root setup en Include root
include_path need to contain "." - the current directory setup en include_path need to contain "." - the current directory
install setup en Install
install all setup en Install All
@ -266,9 +269,12 @@ ldap modify setup en LDAP Modify
ldap root password setup en LDAP root password
ldap rootdn setup en LDAP rootdn
ldap search filter for accounts, default: "(uid=%user)", %domain=egw-domain setup en LDAP search filter for accounts, default: "(uid=%user)", %domain=eGW-domain
leave empty to keep current. setup en Leave empty to keep current.
limit access setup en Limit access
limit access to setup to the following addresses, networks or hostnames (e.g. 127.0.0.1,10.1.1,myhost.dnydns.org) setup en Limit access to setup to the following addresses, networks or hostnames (e.g. 127.0.0.1,10.1.1,myhost.dnydns.org)
login as user postgres, eg. by using su as root setup en Login as user postgres, eg. by using su as root
login to mysql - setup en Login to mysql -
loginname needed for domain configuration setup en Loginname needed for domain configuration
logout setup en Logout
mail domain (for virtual mail manager) setup en Mail domain (for Virtual mail manager)
mail server login type setup en Mail server login type
@ -326,9 +332,10 @@ or http://webdav.domain.com (webdav) setup en or http://webdav.domain.com (WebDA
or we can attempt to create the database for you: setup en Or we can attempt to create the database for you:
or you can install a previous backup. setup en Or you can install a previous backup.
password for smtp-authentication setup en Password for SMTP-authentication
password needed for configuration setup en Password needed for configuration
password needed for domain configuration. setup en Password needed for domain configuration.
password of db user setup en Password of db user
passwords did not match, please re-enter setup en Passwords did not match, please re-enter
path (not url!) to your egroupware installation. setup en Path (not URL!) to your eGroupWare installation.
path information setup en Path information
path to user and group files has to be outside of the webservers document-root!!! setup en Path to user and group files HAS TO BE OUTSIDE of the webservers document-root!!!
pear is needed by syncml or the ical import+export of calendar. setup en PEAR is needed by SyncML or the iCal import+export of calendar.
@ -416,6 +423,7 @@ setup demo accounts in ldap setup en Setup demo accounts in LDAP
setup main menu setup en Setup Main Menu
setup the database setup en Setup the database
setup/config admin login setup en Setup/Config Admin Login
should be the same as server root unless you know what you are doing. setup en Should be the same as Server Root unless you know what you are doing.
show 'powered by' logo on setup en Show 'powered by' logo on
size setup en size
skip the installation tests (not recommended) setup en Skip the installation tests (not recommended)
@ -493,6 +501,7 @@ user for smtp-authentication (leave it empty if no auth required) setup en User
usernames are casesensitive setup en Usernames are casesensitive
users choice setup en Users Choice
utf-8 (unicode) setup en utf-8 (Unicode)
validation errors setup en Validation errors
version setup en version
version mismatch setup en Version Mismatch
view setup en View
@ -510,7 +519,7 @@ would you like egroupware to cache the phpgw info array ? setup en Would you lik
would you like egroupware to check for a new version<br />when admins login ? setup en Would you like eGroupWare to check for a new version<br />when admins login ?
would you like to show each application's upgrade status ? setup en Would you like to show each application's upgrade status ?
writable by the webserver setup en writable by the webserver
write config setup en Write config
write setup en Write
year setup en year
yes setup en Yes
yes, with lowercase usernames setup en Yes, with lowercase usernames
@ -522,6 +531,7 @@ you appear to have %1 support. setup en You appear to have %1 support.
you appear to have php session support. enabling php sessions. setup en You appear to have PHP session support. Enabling PHP sessions.
you appear to have xml support enabled setup en You appear to have XML support enabled
you are ready for this stage, but this stage is not yet written.<br /> setup en You are ready for this stage, but this stage is not yet written.<br />
you are using php version %1. egroupware now requires %2 or later, recommended is php %3. setup en You are using PHP version %1. eGroupWare now requires %2 or later, recommended is PHP %3.
you can install it by running: setup en You can install it by running:
you didn't enter a config password for domain %1 setup en You didn't enter a config password for domain %1
you didn't enter a config username for domain %1 setup en You didn't enter a config username for domain %1
@ -531,7 +541,7 @@ you do not have any languages installed. please install one now <br /> setup en
you have not created your header.inc.php yet!<br /> you can create it now. setup en You have not created your header.inc.php yet!<br /> You can create it now.
you have successfully logged out setup en You have successfully logged out
you must enter a username for the admin setup en You must enter a username for the admin
you need to add some domains to your header.inc.php. setup en You need to add some domains to your header.inc.php.
you need to add at least one egroupware domain / database instance. setup en You need to add at least one eGroupWare domain / database instance.
you need to select your current charset! setup en You need to select your current charset!
you should either uninstall and then reinstall it, or attempt manual repairs setup en You should either uninstall and then reinstall it, or attempt manual repairs
you will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/readme setup en You will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/README

File diff suppressed because it is too large Load Diff

419
setup/setup-cli.php Executable file
View File

@ -0,0 +1,419 @@
#!/usr/bin/php
<?php
/**************************************************************************\
* eGroupWare - Setup - Command line interface *
* http://www.egroupware.org *
* Written and (c) 2006 by Ralf Becker <RalfBecker-AT-outdoor-training.de> *
* ------------------------------------------------------------------------ *
* 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. *
\**************************************************************************/
/* $Id: class.socontacts_sql.inc.php 21634 2006-05-24 02:28:57Z ralfbecker $ */
/**
* Command line interface for setup
*
* @package addressbook
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2006 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
*/
chdir(dirname(__FILE__)); // to enable our relative pathes to work, if we are called with a path
if ($_SERVER['argc'] > 1)
{
$arguments = $_SERVER['argv'];
array_shift($arguments);
$action = array_shift($arguments);
}
else
{
$action = '--version';
}
if ((float) PHP_VERSION < '4.3')
{
fail(98,lang2('You are using PHP version %1. eGroupWare now requires %2 or later, recommended is PHP %3.',PHP_VERSION,'4.3','5+'));
}
switch($action)
{
case '--show-languages':
case '--show-lang':
echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8');
break;
case '--version':
case '--check':
do_check();
break;
case '--create-header':
case '--edit-header':
case '--update-header':
do_header($action == '--create-header',$arguments);
break;
case '--exit-codes':
list_exit_codes();
break;
default:
fail(20,lang2("Unknows option '%1' !!!",$action));
case '--help':
case '--usage':
do_usage();
break;
}
exit(0);
/**
* Dummy translation function, if we ever want to translate the command line interface
*
* @param string $message the message with %# replacements
* @param string $arg variable number of arguments
* @return string
*/
function lang2($message,$arg=null)
{
$args = func_get_args();
array_shift($args);
return str_replace(array('%1','%2','%3','%4','%5'),$args,$message);
}
/**
* Echos usage message
*/
function do_usage()
{
echo lang2('Usage: %1 {--version|--create-header|--edit-header|--install|--update} [additional options]',basename($_SERVER['argv'][0]))."\n\n";
echo '--install '.lang2('[comma-separated languages(en)],[charset(default depending on languages default)],[backup to install]')."\n";
echo '--show-languages '.lang2('get a list of availible languages')."\n";
echo '--update '.lang2('run a database schema update (if necessary)')."\n";
echo '--check '.lang2('checks eGroupWare\'s installed, it\'s versions and necessary upgrads (exits 0: eGW is up to date, 1: no header.inc.php exists, 2: header update necessary, 3: database schema update necessary)')."\n";
echo '--exit-codes '.lang2('list all exist codes of the command line interface, 0 means Ok')."\n";
echo "\n".lang2('Create or edit the eGroupWare configuration file: header.inc.php:')."\n";
echo '--create-header '.lang2('header-password[,header-user(admin)]')."\n";
echo '--edit-header '.lang2('[header-password],[header-user],[new-password],[new-user]')."\n";
echo "\n".lang2('Additional options and there defaults (int brackets)')."\n";
echo '--server-root '.lang2('path of eGroupWare install directory (default auto-detected)')."\n";
echo '--session-type '.lang2('{db|php(default)|php-restore}')."\n";
echo '--limit-access '.lang2('comma separated ip-addresses or host-names, default access to setup from everywhere')."\n";
echo '--mcrypt '.lang2('use mcrypt to crypt session-data: {off(default)|on},[mcrypt-init-vector(default randomly generated)],[mcrypt-version(default empty = recent)]')."\n";
echo '--db-persistent '.lang2('use persistent db connections: {on(default)|off}')."\n";
echo '--domain-selectbox '.lang2('{off(default)|on}')."\n";
echo "\n".lang2('Adding, editing or deleting an eGroupWare domain / database instance:')."\n";
echo '--domain '.lang2('add or edit a domain: [domain-name(default)],[db-name(egroupware)],[db-user(egroupware)],db-password,[db-type(mysql)],[db-host(localhost)],[db-port(db specific)],[config-user(as header)],[config-passwd(as header)]')."\n";
echo '--delete-domain '.lang2('domain-name')."\n";
}
/**
* detect eGW versions
*
* @return array array with versions (keys phpgwapi, current_header and header)
*/
function detect_versions()
{
$versions = null;
$GLOBALS['egw_info']['flags']['noapi'] = true;
if (!@include('../header.inc.php'))
{
if (!@include('../phpgwapi/setup/setup.inc.php'))
{
fail(99,lang2("eGroupWare sources in '%1' are not complete, file '%2' missing !!!",realpath('..'),'phpgwapi/setup/setup.inc.php')); // should not happen ;-)
}
return array(
'phpgwapi' => $setup_info['phpgwapi']['version'],
'current_header' => $setup_info['phpgwapi']['versions']['current_header'],
);
}
return $GLOBALS['egw_info']['server']['versions'];
}
/**
* Check if eGW is installed, which versions and if an update is needed
*/
function do_check()
{
$versions = detect_versions();
echo lang2('eGroupWare API version %1 found.',$versions['phpgwapi'])."\n";
if (isset($versions['header'])) // header.inc.php exists
{
echo lang2("eGroupWare configuration file (header.inc.php) version %1 exists%2",$versions['header'],
($versions['header'] == $versions['current_header'] ? ' '.lang2('and is up to date') : '')).".\n";
if ($versions['header'] != $versions['current_header'])
{
// exit-code 2: header.inc.php needs upgrading
fail(2,lang2('You need to upgrade your header to the new version %1 (using --edit-header)!',$versions['current_header']));
}
}
else
{
// exit-code 1: no header.inc.php
$this->check_fail_header_exists();
}
// ToDo: check if eGW needs a schema upgrade and exit(3) if so
}
function fail($exit_code,$message)
{
echo $message."\n";
exit($exit_code);
}
/**
* List all exit codes used by the command line interface
*
*/
function list_exit_codes()
{
error_reporting(error_reporting() & ~E_NOTICE);
$codes = array();
foreach(file(__FILE__) as $line)
{
if (preg_match('/fail\(([0-9]+),(.*)\);/',$line,$matches))
{
eval('$codes['.$matches[1].'] = '.$matches[2].';');
}
}
ksort($codes,SORT_NUMERIC);
foreach($codes as $num => $msg)
{
echo $num."\t".str_replace("\n","\n\t",$msg)."\n";
}
}
/**
* Check if we have a header.inc.php and fail with exit(10) if not
*
*/
function check_fail_header_exists()
{
if (!file_exists('../header.inc.php'))
{
fail(1,lang2('eGroupWare configuration file (header.inc.php) does NOT exist.')."\n".lang2('Use --create-header to create the configuration file (--usage gives more options).'));
}
}
/**
* Create, edit or update the header.inc.php
*
* @param boolean $create true = create new header, false = edit (or update) existing header
* @param array $arguments
* @return int
*/
function do_header($create,&$arguments)
{
// setting up the $GLOBALS['egw_setup'] object AND including the header.inc.php if it exists
$GLOBALS['egw_info'] = array(
'flags' => array(
'currentapp' => 'home',
'noapi' => true,
));
include('inc/functions.inc.php');
require_once('inc/class.setup_header.inc.php');
$GLOBALS['egw_setup']->header =& new setup_header();
if (!file_exists('../header.inc.php'))
{
if (!$create) $this->check_fail_header_exists();
$GLOBALS['egw_setup']->header->defaults(false);
}
else
{
if ($create) fail(11,lang2('eGroupWare configuration file header.inc.php already exists, you need to use --edit-header or delete it first!'));
// header.inc.php is already include by include('inc/functions.inc.php')!
unset($GLOBALS['egw_info']['flags']);
// check header-admin-user and -password
@list($password,$user) = explode(',',@$arguments[0]);
if (!$user) $user = 'admin';
require_once('inc/class.setup.inc.php');
if (!setup::check_auth($user,$password,$GLOBALS['egw_info']['server']['header_admin_user'],
$GLOBALS['egw_info']['server']['header_admin_password']))
{
fail(12,lang2('Access denied: wrong username or password for manage-header !!!'));
}
$GLOBALS['egw_info']['server']['server_root'] = EGW_SERVER_ROOT;
$GLOBALS['egw_info']['server']['include_root'] = EGW_INCLUDE_ROOT;
}
$options = array(
'--create-header' => array(
'header_admin_password' => 'egw_info/server/',
'header_admin_user' => 'egw_info/server/',
),
'--edit-header' => array(
'header_admin_password' => 'egw_info/server/',
'header_admin_user' => 'egw_info/server/',
'new_admin_password' => 'egw_info/server/header_admin_password',
'new_admin_user' => 'egw_info/server/header_admin_user',
),
'--server-root' => 'egw_info/server/server_root',
'--include-root' => 'egw_info/server/include_root',
'--session-type' => array(
'sessions_type' => array(
'type' => 'egw_info/server/',
'allowed' => array('php'=>'php4','php4'=>'php4','php-restore'=>'php4-restore','php4-restore'=>'php4-restore','db'=>'db'),
),
),
'--limit-access' => 'egw_info/server/setup_acl', // name used in setup
'--setup-acl' => 'egw_info/server/setup_acl', // alias to match the real name
'--mcrypt' => array(
'mcrypt_enabled' => array(
'type' => 'egw_info/server/',
'allowed' => array('on' => true,'off' => false),
),
'mcrypt_iv' => 'egw_info/server/',
'mcrypt' => 'egw_info/versions/mcrypt',
),
'--domain-selectbox' => array(
'show_domain_selectbox' => array(
'type' => 'egw_info/server/',
'allowed' => array('on' => true,'off' => false),
),
),
'--db-persistent' => array(
'db_persistent' => array(
'type' => 'egw_info/server/',
'allowed' => array('on' => true,'off' => false),
),
),
'--domain' => array(
'domain' => '@',
'db_name' => 'egw_domain/@/',
'db_user' => 'egw_domain/@/',
'db_pass' => 'egw_domain/@/',
'db_type' => 'egw_domain/@/',
'db_host' => 'egw_domain/@/',
'db_port' => 'egw_domain/@/',
'config_user' => 'egw_domain/@/',
'config_passwd' => 'egw_domain/@/',
),
'--delete-domain' => true,
);
array_unshift($arguments,$create ? '--create-header' : '--edit-header');
while(($arg = array_shift($arguments)))
{
$values = count($arguments) && substr($arguments[0],0,2) !== '--' ? array_shift($arguments) : 'on';
if ($arg == '--delete-domain')
{
if (!isset($GLOBALS['egw_domain'][$values])) fail(22,lang2("Domain '%1' does NOT exist !!!",$values));
unset($GLOBALS['egw_domain'][$values]);
continue;
}
if (!isset($options[$arg])) fail(20,lang2("Unknow option '%1' !!!",$arg));
$option = $options[$arg];
$values = !is_array($option) ? array($values) : explode(',',$values);
if (!is_array($option)) $option = array($option => $option);
$n = 0;
foreach($option as $name => $data)
{
if ($n >= count($values)) break;
if (!is_array($data)) $data = array('type' => $data);
$type = $data['type'];
$value = $values[$n];
if (isset($data['allowed']))
{
if (!isset($data['allowed'][$value]))
{
fail(21,lang2("'%1' is not allowed as %2. arguments of option %3 !!!",$value,1+$n,$arg));
}
$value = $data['allowed'][$value];
}
if ($type == '@')
{
$remember = $arg == '--domain' && !$value ? 'default' : $value;
if ($arg == '--domain' && (!isset($GLOBALS['egw_domain'][$remember]) || $create))
{
$GLOBALS['egw_domain'][$remember] = $GLOBALS['egw_setup']->header->domain_defaults($GLOBALS['egw_info']['server']['header_admin_user'],$GLOBALS['egw_info']['server']['header_admin_password']);
}
}
elseif ($value !== '')
{
set_value($GLOBALS,str_replace('@',$remember,$type),$name,$value);
if ($name == 'egw_info/server/server_root')
{
set_value($GLOBALS,'egw_info/server/include_root',$name,$value);
}
}
++$n;
}
}
if (($errors = $GLOBALS['egw_setup']->header->validation_errors($GLOBALS['egw_info']['server']['server_root'],$GLOBALS['egw_info']['server']['include_root'])))
{
echo '$GLOBALS[egw_info] = '; print_r($GLOBALS['egw_info']);
echo '$GLOBALS[egw_domain] = '; print_r($GLOBALS['egw_domain']);
echo "\n".lang2('Configuration errors:')."\n- ".implode("\n- ",$errors)."\n";
fail(23,lang2("You need to fix the above errors, before the configuration file header.inc.php can be written!"));
}
$header = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain'],
$GLOBALS['egw_info']['server']['server_root'],$GLOBALS['egw_info']['server']['include_root']);
echo $header;
if (file_exists('../header.inc.php') && is_writable('../header.inc.php') || is_writable('../'))
{
if (is_writable('../') && file_exists('../header.inc.php')) unlink('../header.inc.php');
if (($f = fopen('../header.inc.php','wb')) && fwrite($f,$header))
{
fclose($f);
echo "\n".lang2('header.inc.php successful written.')."\n\n";
exit(0);
}
}
fail(24,lang2("Failed writing configuration file header.inc.php, check the permissions !!!"));
}
function set_value($arr,$index,$name,$value)
{
if (substr($index,-1) == '/') $index .= $name;
$var =& $arr;
foreach(explode('/',$index) as $name)
{
$var =& $var[$name];
}
$var = strstr($name,'passw') ? md5($value) : $value;
}
if (!function_exists('generate_mcyrpt_iv'))
{
function generate_mcyrpt_iv()
{
srand((double)microtime()*1000000);
$random_char = array(
'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L',
'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
);
$iv = '';
for($i=0; $i<30; $i++)
{
$iv .= $random_char[rand(1,count($random_char))];
}
return $iv;
}
}

View File

@ -30,25 +30,32 @@ function setDefaultDBPort(selectBox,portField)
<!-- <tr>
<td>-->
<form name="domain_settings" action="manageheader.php" method="post">
<input type="hidden" name="setting[write_config]" value="true" />
<!-- <table style="border-spacing:5px;" border="0" width="100%" cellspacing="0" cellpadding="0">
<tbody>-->
<tr class="th">
<th colspan="2">{lang_settings}</th>
</tr>
<tr>
<td colspan="2"><strong>{lang_serverroot}</strong><br /><input type="text" name="setting[server_root]" size="80" value="{server_root}" /></td>
<td colspan="2">
<strong>{lang_serverroot}</strong> {lang_serverroot_descr}<br />
<input type="text" name="setting[server_root]" size="80" value="{server_root}" />
</td>
</tr>
<tr>
<td colspan="2"><strong>{lang_includeroot}</strong><br /><input type="text" name="setting[include_root]" size="80" value="{include_root}" /></td>
<td colspan="2">
<strong>{lang_includeroot}</strong> {lang_includeroot_descr}<br />
<input type="text" name="setting[include_root]" size="80" value="{include_root}" />
</td>
</tr>
<tr>
<td><strong>{lang_adminuser}</strong><br /><input type="text" name="setting[HEADER_ADMIN_USER]" size="30" value="{header_admin_user}" /></td>
<td><strong>{lang_adminuser}</strong><br /><input type="text" name="setting[header_admin_user]" size="30" value="{header_admin_user}" /></td>
<td>{lang_adminuser_descr}</td>
</tr>
<tr>
<td><strong>{lang_adminpass}</strong><br /><input type="password" name="setting[HEADER_ADMIN_PASSWORD]" size="30" value="{header_admin_password}" /><input type="hidden" name="setting[HEADER_ADMIN_PASS]" value="{header_admin_pass}" /></td>
<td>{lang_adminpass_descr} {lang_leave_empty}</td>
<td><strong>{lang_adminpass}</strong><br />
<input type="hidden" name="setting[header_admin_password]" value="{header_admin_password}" />
<input type="password" name="setting[new_admin_password]" size="30" value="" /></td>
<td>{lang_adminpass_descr}<br />{lang_leave_empty}</td>
</tr>
<tr>
<td><strong>{lang_setup_acl}</strong><br /><input type="text" name="setting[setup_acl]" size="30" value="{setup_acl}" /></td>
@ -73,7 +80,7 @@ function setDefaultDBPort(selectBox,portField)
</tr>
<tr>
<td><strong>{lang_enablemcrypt}</strong><br />
<select name="setting[enable_mcrypt]">
<select name="setting[mcrypt_enabled]">
<option value="True"{mcrypt_enabled_yes}>{lang_Yes}</option>
<option value="False"{mcrypt_enabled_no}>{lang_No}</option>
</select>
@ -81,7 +88,7 @@ function setDefaultDBPort(selectBox,portField)
<td>{lang_mcrypt_warning}</td>
</tr>
<tr>
<td><strong>{lang_mcryptversion}</strong><br /><input type="text" name="setting[mcrypt_version]" value="{mcrypt}" /></td>
<td><strong>{lang_mcryptversion}</strong><br /><input type="text" name="setting[mcrypt_version]" value="{mcrypt_version}" /></td>
<td>{lang_mcryptversiondescr}</td>
</tr>
<tr>
@ -90,7 +97,7 @@ function setDefaultDBPort(selectBox,portField)
</tr>
<tr>
<td><strong>{lang_domselect}</strong><br />
<select name="setting[domain_selectbox]">
<select name="setting[show_domain_selectbox]">
<option value="True"{domain_selectbox_yes}>{lang_Yes}</option>
<option value="False"{domain_selectbox_no}>{lang_No}</option>
</select></td>
@ -107,7 +114,7 @@ function setDefaultDBPort(selectBox,portField)
</tr>
{comment_r}
<tr>
<td colspan="2">{errors}</td>
<td colspan="2">{actions}</td>
</tr>
<!-- </tbody>
</table>-->
@ -173,8 +180,10 @@ function setDefaultDBPort(selectBox,portField)
<td>{lang_configuser_descr}</td>
</tr>
<tr>
<td><strong>{lang_configpass}</strong><br /><input type="password" name="setting_{db_domain}[config_pass]" value="{config_pass}" /><input type="hidden" name="setting_{db_domain}[config_password]" value="{config_password}" /></td>
<td>{lang_passforconfig} {lang_leave_empty}</td>
<td><strong>{lang_configpass}</strong><br />
<input type="hidden" name="setting_{db_domain}[config_passwd]" value="{config_passwd}" />
<input type="password" name="setting_{db_domain}[new_config_passwd]" value="" /></td>
<td>{lang_passforconfig}<br />{lang_leave_empty}</td>
</tr>
</table>
<!-- END domain -->