summaryrefslogtreecommitdiffstats
path: root/ocsinventory-upgrade.patch
diff options
context:
space:
mode:
Diffstat (limited to 'ocsinventory-upgrade.patch')
-rw-r--r--ocsinventory-upgrade.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/ocsinventory-upgrade.patch b/ocsinventory-upgrade.patch
new file mode 100644
index 0000000..bd8626a
--- /dev/null
+++ b/ocsinventory-upgrade.patch
@@ -0,0 +1,49 @@
+diff -up ocsreports/install.php.orig ocsreports/install.php
+--- ocsreports/install.php.orig 2011-10-27 18:04:00.011717775 +0200
++++ ocsreports/install.php 2011-10-27 18:16:38.947261089 +0200
+@@ -99,10 +99,32 @@ if( isset($_POST["name"])) {
+ if( $hnd = @fopen("dbconfig.inc.php", "r") ) {
+ fclose($hnd);
+ require("dbconfig.inc.php");
+- $valNme = COMPTE_BASE;
+- $valPass = PSWD_BASE;
+- $valServ = SERVER_WRITE;
+- $valdatabase = DB_NAME;
++ if (defined('COMPTE_BASE')) { // Upgrade from 2.0.x
++ $valNme = COMPTE_BASE;
++ } else if (isset($_SESSION["COMPTE_BASE"])) { // Upgrade from 1.3.x
++ $valNme = $_SESSION["COMPTE_BASE"];
++ } else { // Fresh install
++ $valNme = '';
++ }
++ if (defined('PSWD_BASE')) {
++ $valPass = PSWD_BASE;
++ } else if (isset($_SESSION["PSWD_BASE"])) {
++ $valPass = $_SESSION["PSWD_BASE"];
++ } else {
++ $valPass = '';
++ }
++ if (defined('SERVER_WRITE')) {
++ $valServ = SERVER_WRITE;
++ } else if (isset($_SESSION["SERVEUR_SQL"])) {
++ $valServ = $_SESSION["SERVEUR_SQL"];
++ } else {
++ $valServ = '';
++ }
++ if (defined('DB_NAME')) {
++ $valdatabase = DB_NAME;
++ } else { // Upgrade from 1.3.x
++ $valdatabase = 'ocsweb';
++ }
+ }
+
+ if( ! $instOk ) {
+@@ -113,7 +135,7 @@ if( ! $instOk ) {
+ $name_field=array("name","pass","database","host");
+ $tab_name= array($l->g(247).": ",$l->g(248).": ",$l->g(1233).":",$l->g(250).":");
+ $type_field= array(0,4,0,0);
+- $value_field=array($valNme,$valPass,(isset($valdatabase) && $valdatabase!= 'DB_NAME'? $valdatabase: "ocsweb"),$valServ);
++ $value_field=array($valNme,$valPass,$valdatabase,$valServ);
+
+ $tab_typ_champ=show_field($name_field,$type_field,$value_field);
+ tab_modif_values($tab_name,$tab_typ_champ,$tab_hidden,$title="",$comment="",$name_button="INSTALL",$showbutton='BUTTON',$form_name);