/[smecontribs]/rpms/ocsinventory/contribs7/ocsinventory-r1423.patch
ViewVC logotype

Contents of /rpms/ocsinventory/contribs7/ocsinventory-r1423.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Wed Mar 18 14:37:45 2009 UTC (15 years, 8 months ago) by slords
Branch: MAIN
CVS Tags: ocsinventory-1_02_1-1_el4_sme, ocsinventory-1_02-0_10_rc3_el4_sme_2, HEAD
* Wed Mar 13 2009 Daniel B. <daniel@firewall-services.com> 1.02-0.10.rc3.el4.2
- Changes for SME Server (apache=>www)

1 --- trunk/server/ocsreports/install.php 2008/03/04 17:07:55 1108
2 +++ trunk/server/ocsreports/install.php 2008/10/16 15:56:16 1423
3 @@ -94,15 +94,15 @@
4 else
5 $instOk = true;
6 }
7 -if( ! $instOk ) {
8 +if( $hnd = @fopen("dbconfig.inc.php", "r") ) {
9 + fclose($hnd);
10 + require("dbconfig.inc.php");
11 + $valNme = $_SESSION["COMPTE_BASE"];
12 + $valPass = $_SESSION["PSWD_BASE"];
13 + $valServ = $_SESSION["SERVEUR_SQL"];
14 +}
15
16 - if( $hnd = @fopen("dbconfig.inc.php", "r") ) {
17 - fclose($hnd);
18 - require("dbconfig.inc.php");
19 - $valNme = $_SESSION["COMPTE_BASE"];
20 - $valPass = $_SESSION["PSWD_BASE"];
21 - $valServ = $_SESSION["SERVEUR_SQL"];
22 - }
23 +if( ! $instOk ) {
24
25 echo "<br><form name='fsub' action='install.php' method='POST'><table width='100%'>
26 <tr>
27 @@ -162,7 +162,8 @@
28 }
29
30 if($_POST["fin"]=="fin") {
31 - if(!@mysql_connect($_POST["host"],"ocs","ocs")) {
32 + // Configuration done, so try with account from config file
33 + if(!@mysql_connect($valServ,$valNme,$valPass)) {
34 if(mysql_errno()==0) {
35 echo "<br><center><font color=red><b>ERROR: MySql authentication problem. You must add the 'old-passwords' in your mysql configuration file (my.ini). Then restart mysql, and relaunch install.php</b><br></font></center>";
36 die();
37 @@ -185,10 +186,7 @@
38 die();
39 }
40
41 -fwrite($ch,"<?php \n\$_SESSION[\"SERVEUR_SQL\"]=\"".$_POST["host"]."\";\n\$_SESSION[\"COMPTE_BASE\"]=\"ocs\";\n\$_SESSION[\"PSWD_BASE\"]=\"ocs\";\n?>");
42 -fclose($ch);
43 -
44 -echo "<br><center><font color=green><b>MySql config file successfully written</b></font></center>";
45 +$keepuser=false;
46
47 $db_file = "files/ocsbase.sql";
48 if($dbf_handle = @fopen($db_file, "r")) {
49 @@ -201,7 +199,12 @@
50 foreach ( explode(";", "$sql_query") as $sql_line) {
51 $li++;
52 if(!mysql_query($sql_line)) {
53 - if( mysql_errno()==1062 || mysql_errno()==1061 || mysql_errno()==1044 || mysql_errno()==1065 || mysql_errno()==1060 || mysql_errno()==1054 || mysql_errno()==1091 || mysql_errno()==1061)
54 + if (mysql_errno()==1044 && strpos($sql_line, "GRANT ALL")!==false) {
55 + // Provided user not MySQL Administror
56 + $keepuser=true;
57 + continue;
58 + }
59 + if( mysql_errno()==1062 || mysql_errno()==1061 || mysql_errno()==1065 || mysql_errno()==1060 || mysql_errno()==1054 || mysql_errno()==1091 || mysql_errno()==1061)
60 continue;
61
62 if( mysql_errno()==1071 ) {
63 @@ -230,6 +233,19 @@
64 die();
65 }
66
67 +if ($keepuser) {
68 + // Provided user not MySQL Administror
69 + // Keep the account used for migration
70 + fwrite($ch,"<?php \n\$_SESSION[\"SERVEUR_SQL\"]=\"".$_POST["host"]."\";\n\$_SESSION[\"COMPTE_BASE\"]=\"".$_POST["name"]."\";\n\$_SESSION[\"PSWD_BASE\"]=\"".$_POST["pass"]."\";\n?>");
71 + fclose($ch);
72 + echo "<br><center><font color=green><b>MySql config file successfully written (using ".$_POST["name"]." account)</b></font></center>";
73 +} else {
74 + // Use account created during installation
75 + fwrite($ch,"<?php \n\$_SESSION[\"SERVEUR_SQL\"]=\"".$_POST["host"]."\";\n\$_SESSION[\"COMPTE_BASE\"]=\"ocs\";\n\$_SESSION[\"PSWD_BASE\"]=\"ocs\";\n?>");
76 + fclose($ch);
77 + echo "<br><center><font color=green><b>MySql config file successfully written (using new ocs account)</b></font></center>";
78 +}
79 +
80 if($dejaLance>0)
81 echo "<br><center><font color=green><b>Existing database updated</b></font></center>";
82

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed