From 70bf73c154306999f14a68548587247e5773b207 Mon Sep 17 00:00:00 2001 From: Steven Mondji-Lerider Date: Mon, 25 Feb 2013 08:59:48 +0000 Subject: [PATCH] Applying changeset r4112 to trunk + adding a second script for adding phpmyadmin user for the upgrades that failed to add it. --- .gitattributes | 1 + install/upgrades/3.0.0~3.php | 20 +++++++++++++------- install/upgrades/3.1.0~c.php | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 install/upgrades/3.1.0~c.php diff --git a/.gitattributes b/.gitattributes index 0096d97b..438d28a0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -523,6 +523,7 @@ install/upgrades/3.0.0~3.php -text install/upgrades/3.0.0~4.sh -text install/upgrades/3.1.0~a.sql -text install/upgrades/3.1.0~b.php -text +install/upgrades/3.1.0~c.php -text install/upgrades/README -text lang/.svnignore -text lang/README -text diff --git a/install/upgrades/3.0.0~3.php b/install/upgrades/3.0.0~3.php index c7ec62a2..22858ea3 100644 --- a/install/upgrades/3.0.0~3.php +++ b/install/upgrades/3.0.0~3.php @@ -1,17 +1,20 @@ + #!/usr/bin/php enabled=1; @@ -37,11 +40,14 @@ $db->query("select distinct uid,login,pass from db;"); //on insere dans dbusers avec enabled = admin $query=array(); while($db->next_record()){ - $query[]="insert into dbusers values('',".$db->f('uid').",'".$db->f('login')."','".$db->f('pass')."',\"ADMIN\");"; + $db2->query("select id from dbusers where name ='".$db->f('login')."' and password='".$db->f('pass')."';"); + if($db2->num_rows() ==0 ){ + $query[]="insert ignore into dbusers values('',".$db->f('uid').",'".$db->f('login')."','".$db->f('pass')."',\"ADMIN\");"; + } } + foreach ($query as $q){ -print_r($q); -$db->query($q); + $db->query($q); } //Updating mysql.db table to fix the "_" wildcard bug @@ -54,7 +60,7 @@ while($db->next_record()){ } foreach ($query2 as $q2){ -$db->query($q2); + $db->query($q2); } - +?> //done ? :) diff --git a/install/upgrades/3.1.0~c.php b/install/upgrades/3.1.0~c.php new file mode 100644 index 00000000..47858a53 --- /dev/null +++ b/install/upgrades/3.1.0~c.php @@ -0,0 +1,35 @@ +#!/usr/bin/php +enabled=1; + +$db->query("select distinct uid,login,pass from db;"); +//on insere dans dbusers avec enabled = admin +$query=array(); +while($db->next_record()){ + $db2->query("select id from dbusers where name ='".$db->f('login')."' and password='".$db->f('pass')."';"); + if($db2->num_rows() ==0 ){ + $query[]="insert ignore into dbusers values('',".$db->f('uid').",'".$db->f('login')."','".$db->f('pass')."',\"ADMIN\");"; + } +} + +foreach ($query as $q){ + $db->query($q); +} + +?> +//done ? :)