[geeklog-cvs] geeklog: Add passwords to remote users in 1.8.0 upgrade

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Fri Apr 29 19:21:07 EDT 2011


changeset 8261:5e3bac1a0207
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/5e3bac1a0207
user: Tom <websitemaster at cogeco.net>
date: Fri Apr 29 18:57:55 2011 -0400
description:
Add passwords to remote users in 1.8.0 upgrade

diffstat:

 public_html/admin/install/lib-upgrade.php |   2 ++
 sql/updates/mssql_1.7.2_to_1.8.0.php      |  22 ++++++++++++++++++++++
 sql/updates/mysql_1.7.2_to_1.8.0.php      |  22 ++++++++++++++++++++++
 sql/updates/pgsql_1.7.2_to_1.8.0.php      |  22 ++++++++++++++++++++++
 4 files changed, 68 insertions(+), 0 deletions(-)

diffs (108 lines):

diff -r 6e50280b41ef -r 5e3bac1a0207 public_html/admin/install/lib-upgrade.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 = '';
diff -r 6e50280b41ef -r 5e3bac1a0207 sql/updates/mssql_1.7.2_to_1.8.0.php
--- 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"
  *
  */
diff -r 6e50280b41ef -r 5e3bac1a0207 sql/updates/mysql_1.7.2_to_1.8.0.php
--- 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"
  *
  */
diff -r 6e50280b41ef -r 5e3bac1a0207 sql/updates/pgsql_1.7.2_to_1.8.0.php
--- 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"
  *
  */



More information about the geeklog-cvs mailing list