Add passwords to remote users in 1.8.0 upgrade HEAD
authorTom <websitemaster@cogeco.net>
Fri, 29 Apr 2011 18:57:55 -0400
branchHEAD
changeset 8261 5e3bac1a0207
parent 8260 6e50280b41ef
child 8262 fa4e0c541458
Add passwords to remote users in 1.8.0 upgrade
public_html/admin/install/lib-upgrade.php
sql/updates/mssql_1.7.2_to_1.8.0.php
sql/updates/mysql_1.7.2_to_1.8.0.php
sql/updates/pgsql_1.7.2_to_1.8.0.php
--- a/public_html/admin/install/lib-upgrade.php	Fri Apr 29 19:03:36 2011 +0100
+++ b/public_html/admin/install/lib-upgrade.php	Fri Apr 29 18:57:55 2011 -0400
@@ -508,6 +508,8 @@
             update_ConfValuesFor180();
 
             update_ConfigSecurityFor180();
+            
+            update_UsersFor180();
 
             $current_gl_version = '1.8.0';
             $_SQL = '';
--- a/sql/updates/mssql_1.7.2_to_1.8.0.php	Fri Apr 29 19:03:36 2011 +0100
+++ b/sql/updates/mssql_1.7.2_to_1.8.0.php	Fri Apr 29 18:57:55 2011 -0400
@@ -62,6 +62,28 @@
 
 
 /**
+ * Add passwords for OAuth and OpenID users
+ *
+ */
+function update_UsersFor180()
+{
+    global $_TABLES;
+    
+    $passwords = array();
+    
+    $sql = "SELECT uid FROM {$_TABLES['users']} WHERE (remoteservice IS NOT NULL OR remoteservice != '') AND passwd = ''";
+    $result = DB_query($sql);
+    $nrows = DB_numRows($result);
+
+    for($i = 0; $i < $nrows; $i++) {
+        $A = DB_fetchArray($result);
+        
+        $passwords = USER_createPassword($A['uid']);
+    }    
+
+}
+
+/**
  * Add is new security rights for the new Group "Configuration Admin"
  *
  */
--- a/sql/updates/mysql_1.7.2_to_1.8.0.php	Fri Apr 29 19:03:36 2011 +0100
+++ b/sql/updates/mysql_1.7.2_to_1.8.0.php	Fri Apr 29 18:57:55 2011 -0400
@@ -62,6 +62,28 @@
 
 
 /**
+ * Add passwords for OAuth and OpenID users
+ *
+ */
+function update_UsersFor180()
+{
+    global $_TABLES;
+    
+    $passwords = array();
+    
+    $sql = "SELECT uid FROM {$_TABLES['users']} WHERE (remoteservice IS NOT NULL OR remoteservice != '') AND passwd = ''";
+    $result = DB_query($sql);
+    $nrows = DB_numRows($result);
+
+    for($i = 0; $i < $nrows; $i++) {
+        $A = DB_fetchArray($result);
+        
+        $passwords = USER_createPassword($A['uid']);
+    }    
+
+}
+
+/**
  * Add is new security rights for the new Group "Configuration Admin"
  *
  */
--- a/sql/updates/pgsql_1.7.2_to_1.8.0.php	Fri Apr 29 19:03:36 2011 +0100
+++ b/sql/updates/pgsql_1.7.2_to_1.8.0.php	Fri Apr 29 18:57:55 2011 -0400
@@ -63,6 +63,28 @@
 
 
 /**
+ * Add passwords for OAuth and OpenID users
+ *
+ */
+function update_UsersFor180()
+{
+    global $_TABLES;
+    
+    $passwords = array();
+    
+    $sql = "SELECT uid FROM {$_TABLES['users']} WHERE (remoteservice IS NOT NULL OR remoteservice != '') AND passwd = ''";
+    $result = DB_query($sql);
+    $nrows = DB_numRows($result);
+
+    for($i = 0; $i < $nrows; $i++) {
+        $A = DB_fetchArray($result);
+        
+        $passwords = USER_createPassword($A['uid']);
+    }    
+
+}
+
+/**
  * Add is new security rights for the new Group "Configuration Admin"
  *
  */