Work on APS package

This commit is contained in:
Laurent Destailleur 2011-06-26 00:42:39 +00:00
parent fbe250b223
commit 0c5dbfc75a

View File

@ -1,4 +1,22 @@
<?php <?php
/*-----------------------------------------------------
*
*----------------------------------------------------- */
// This is list of predefined languages when script is ran:
// getenv("SETTINGS_admin_name")
// getenv("SETTINGS_admin_password")
// getenv("BASE_URL_SCHEME")
// getenv("BASE_URL_HOST")
// getenv("BASE_URL_PORT")
// getenv("BASE_URL_PATH")
// getenv("DB_main_NAME")
// getenv("DB_main_LOGIN")
// getenv("DB_main_PASSWORD")
// getenv("DB_main_HOST")
// getenv("DB_main_PORT")
// getenv("DB_main_HOST")
if(count($_SERVER['argv']) < 2) if(count($_SERVER['argv']) < 2)
@ -15,37 +33,25 @@ $command = $_SERVER['argv'][1];
//$command stores the argument with which the script was invoked. //$command stores the argument with which the script was invoked.
if($command == "install") if($command == "install")
{ {
$db_id = 'dolibarr'; $db_id = 'main';
//The database identifier value is to be substituted by the value //The database identifier value is to be substituted by the value
//defined in the application requirements section of the //defined in the application requirements section of the
//metadata file.For details, see the 6.3.1.1. Database requirement //metadata file.For details, see the 6.3.1.1. Database requirement
//type section of the Specification. //type section of the Specification.
$query_file = 'schema.sql'; //File containing list of SQL queries. $query_file = 'schema.sql'; //File containing list of SQL queries.
//List of database-related variables that are passed to the configuration //List of database-related variables that are passed to the configuration
//script. See the 6.3.1.1.1. Environment variables section of the //script. See the 6.3.1.1.1. Environment variables section of the
//Specification for details. //Specification for details.
$db_address = getenv("DB_${db_id}_HOST"); $db_address = getenv("DB_${db_id}_HOST");
/*if (fetch_env_var("DB_${db_id}_PORT") !== False) /*if (fetch_env_var("DB_${db_id}_PORT") !== False)
$db_address .= ':' . fetch_env_var("DB_${db_id}_PORT"); $db_address .= ':' . fetch_env_var("DB_${db_id}_PORT");
@ -53,68 +59,45 @@ $db_address = getenv("DB_${db_id}_HOST");
$dblogin = getenv("DB_${db_id}_LOGIN"); $dblogin = getenv("DB_${db_id}_LOGIN");
$dbpassword = getenv("DB_${db_id}_PASSWORD"); $dbpassword = getenv("DB_${db_id}_PASSWORD");
$dbname = getenv("DB_${db_id}_NAME"); $dbname = getenv("DB_${db_id}_NAME");
//PHP functions for connecting to the mysql server and //PHP functions for connecting to the mysql server and
//executing SQL queries. //executing SQL queries.
mysql_connect($dbaddress, $dblogin, $dbpassword); mysql_connect($dbaddress, $dblogin, $dbpassword);
mysql_select_db($dbname); mysql_select_db($dbname);
/* /*
$sql_queries = file($query_file); $sql_queries = file($query_file);
foreach ($sql_queries as $query) mysql_query($query); foreach ($sql_queries as $query) mysql_query($query);
*/ */
//Other code to be executed on invoking configure with //Other code to be executed on invoking configure with
//the install argument. //the install argument.
exit(0); exit(0);
} }
if($command == "remove") if($command == "remove")
{ {
//Code to be executed on invoking configure with the remove argument //Code to be executed on invoking configure with the remove argument
exit(0); exit(0);
} }
if($command == "upgrade") if($command == "upgrade")
{ {
//Code to be executed on invoking configure with the upgrade argument //Code to be executed on invoking configure with the upgrade argument
exit(0); exit(0);
} }
if($command == "configure") if($command == "configure")
{ {
//Code to be executed on invoking configure with the configure argument //Code to be executed on invoking configure with the configure argument
exit(0); exit(0);
} }
print "Error: unknown command $command.\n"; print "Error: unknown command $command.\n";
exit(1); exit(1);
?> ?>