diff --git a/build/aps/APP-META-1.1.xml b/build/aps/APP-META-1.1.xml index f67866cae3e..00fd8574f09 100755 --- a/build/aps/APP-META-1.1.xml +++ b/build/aps/APP-META-1.1.xml @@ -1,7 +1,7 @@ - Dolibarr + Dolibarr ERP-CRM __VERSION__ __RELEASE__ http://www.dolibarr.org/ @@ -13,10 +13,10 @@ Laurent Destailleur http://www.nltechno.com - uuid:714f0a7b-85d6-4eb8-b68e-40f9acbb3103 + uuid:e743ee30-9fe8-11e0-a32e-0025115d642c - Dolibarr ERP - CRM, the easy to use software to manage small or medium companies, freelancers or foundations + Dolibarr ERP-CRM, the easy to use software to manage small or medium companies, freelancers or foundations Dolibarr is a free modular software (you see only features you need) to manage small and medium companies, freelancers @@ -71,6 +71,7 @@ standalone software. Dolibarr is designed to provide simplicity to end-user. + Laurent Destailleur http://www.nltechno.com - uuid:714f0a7b-85d6-4eb8-b68e-40f9acbb3103 + uuid:e743ee30-9fe8-11e0-a32e-0025115d642c Dolibarr ERP - CRM, the easy to use software to manage small or medium companies, freelancers or foundations diff --git a/build/aps/configure.php b/build/aps/configure.php index 605cedf3482..62ca849d62a 100755 --- a/build/aps/configure.php +++ b/build/aps/configure.php @@ -5,56 +5,52 @@ // This is list of predefined languages when script is ran. // We set them manually for test purpose -putenv("SETTINGS_admin_name")='admin'; -putenv("SETTINGS_admin_password")='admin-ad'; -putenv("BASE_URL_SCHEME")='http'; -putenv("BASE_URL_HOST")='localhost'; -putenv("BASE_URL_PORT")=80; -putenv("BASE_URL_PATH")='/'; -putenv("WEB___DIR")='/var/wwww/dolibarr'; -putenv("DB_main_NAME")='dolibarr'; -putenv("DB_main_HOST")='localhost'; -putenv("DB_main_PORT")='3306'; -putenv("DB_main_LOGIN")='root'; -putenv("DB_main_PASSWORD")='root'; - +putenv('SETTINGS_admin_name=admin'); +putenv('SETTINGS_admin_password=admin-ad'); +putenv('BASE_URL_SCHEME=http'); +putenv('BASE_URL_HOST=localhost'); +putenv('BASE_URL_PORT=0'); +putenv('BASE_URL_PATH=/'); +//putenv('WEB___DIR=/var/wwww/dolibarr/htdocs'); // WEB___DIR is dir to htdocs +putenv('WEB___DIR=../htdocs'); // WEB___DIR is dir to htdocs +putenv('DB_main_NAME=dolibarr'); +putenv('DB_main_HOST=localhost'); +putenv('DB_main_PORT=3306'); +putenv('DB_main_LOGIN=root'); +putenv('DB_main_PASSWORD=root'); +// Check parameters if(count($_SERVER['argv']) < 2) { - print "Usage: configure (install | upgrade | configure | remove)\n"; + print "Usage: configure.php (install | upgrade | configure | remove)\n"; exit(1); } +$command = $_SERVER['argv'][1]; //$command stores the argument with which the script was invoked. -$command = $_SERVER['argv'][1]; - -//$command stores the argument with which the script was invoked. if($command == "install") { $db_id = 'main'; $rootdir = getenv("WEB___DIR"); - $datadir = getenv("WEB___DIR").'/dolibarr_documents'; + if ($rootdir != '/') $rootdir = preg_replace('/\/$/','',$rootdir); // Remove last / + $datadir = $rootdir.'/dolibarr_documents'; //List of database-related variables that are passed to the configuration //script. See the 6.3.1.1.1. Environment variables section of the //Specification for details. $db_address = getenv("DB_${db_id}_HOST"); - - /*if (fetch_env_var("DB_${db_id}_PORT") !== False) - $db_address .= ':' . fetch_env_var("DB_${db_id}_PORT"); - */ - + $db_port = getenv("DB_${db_id}_PORT"); $dblogin = getenv("DB_${db_id}_LOGIN"); $dbpassword = getenv("DB_${db_id}_PASSWORD"); $dbname = getenv("DB_${db_id}_NAME"); + //PHP functions for connecting to the mysql server and //executing SQL queries. //mysql_connect($dbaddress, $dblogin, $dbpassword); //mysql_select_db($dbname); - /* $sql_queries = file($query_file); foreach ($sql_queries as $query) mysql_query($query); @@ -64,29 +60,58 @@ if($command == "install") //Other code to be executed on invoking configure with //the install argument. - // Create document directories - print "Create directory ".$datadir.'/dolibarr_documents'."\n"; - mkdir($datadir.'/dolibarr_documents'); + // Create empty config file + $file=$rootdir.'/conf/conf.php'; + print "Create conf file ".$file."\n"; + $fp = fopen($file, 'wb'); + if ($fp) + { + fclose($fp); + chmod($file,0775); + } + else + { + print "configure.php install: Unable to write file $file.\n"; + exit(1); + } - // Create install.forced.php - print "Create file ".$rootdir.'/install/install.forced.php'."\n"; - $file_source='build/aps/install.forced.php.install'; + // Create empty directory that will be used by software to store uploaded documents + print "Create directory ".$datadir."\n"; + @mkdir($datadir); + chmod($datadir,0775); + + // Create install.forced.php into htdocs/install directory with value. + // This will set parameters of install for web installer wizard. + $file_source=$rootdir.'/../build/aps/install.forced.php.install'; $file=$rootdir.'/install/install.forced.php'; + print "Create file ".$file.' from '.$file_source."\n"; - $modify_hash=array(); // TODO Add substitution here + $modify_hash=array( + 'WEB___DIR'=>$rootdir, + 'DB_'.$db_id.'_HOST'=>$db_address, + 'DB_'.$db_id.'_PORT'=>$db_port, + 'DB_'.$db_id.'_LOGIN'=>$dblogin, + 'DB_'.$db_id.'_PASSWORD'=>$dbpassword, + 'DB_'.$db_id.'_NAME'=>$dbname + ); - $file_content = read_file($file_source); + $file_content = fread(fopen($file_source, 'r'), filesize($file_source)); foreach($modify_hash as $param => $val){ $file_content = str_replace($param, php_quote($val), $file_content); } $fp = fopen($file, 'wb'); - if (!$fp) + if ($fp) { - print "Unable to write file $file.\n"; - exit(1); + fputs($fp, $file_content); + fputs($fp, "\n"); + fclose($fp); + chmod($file,0775); + } + else + { + print "configure.php install: Unable to write file $file.\n"; + exit(2); } - fputs($fp, $content, strlen($content)); - fclose($fp); exit(0); } @@ -109,6 +134,18 @@ if($command == "configure") exit(0); } -print "Error: unknown command $command.\n"; +print "configure.php: Error: unknown command $command.\n"; exit(1); + + + +// Content of file-util.php we need + +function php_quote($val) +{ + $res_val = str_replace("\\", "\\\\", $val); + $res_val = str_replace("'", "\\'", $res_val); + return $res_val; +} + ?> \ No newline at end of file diff --git a/build/aps/install.forced.php.install b/build/aps/install.forced.php.install index c03eb712c72..d2c6204cc30 100755 --- a/build/aps/install.forced.php.install +++ b/build/aps/install.forced.php.install @@ -1,7 +1,14 @@ #---------------------------------------------------------------------------- @@ -48,7 +48,7 @@ if (-d "/usr/src/RPM") { use vars qw/ $REVISION $VERSION /; -$REVISION='$Revision: 1.104 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1; +$REVISION='$Revision: 1.105 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1; $VERSION="1.0 (build $REVISION)"; @@ -595,8 +595,8 @@ if ($nboftargetok) { close SPECFROM; close SPECTO; print "Version set to $MAJOR.$MINOR.$newbuild\n"; - $cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure\""; - $ret=`$cmd`; + #$cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure\""; + #$ret=`$cmd`; $cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure.php\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure.php\""; $ret=`$cmd`; $cmd="cp -pr \"$BUILDROOT/$PROJECT/doc/images\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/images\"";