[pLog-svn] r2869 - plog/trunk

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Jan 29 18:55:29 GMT 2006


Author: oscar
Date: 2006-01-29 18:55:29 +0000 (Sun, 29 Jan 2006)
New Revision: 2869

Modified:
   plog/trunk/wizard.php
Log:
Now site admin users are recognized and the correct field is set in the 'users' table


Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php	2006-01-29 18:27:30 UTC (rev 2868)
+++ plog/trunk/wizard.php	2006-01-29 18:55:29 UTC (rev 2869)
@@ -1474,6 +1474,33 @@
             $this->Action( $actionInfo, $httpRequest );
         }
         
+        function updateAdminUsers()
+        {   
+            $numUpdated = 0;        
+            $query1 = "SELECT DISTINCT user_id FROM ".$this->dbPrefix."users_permissions WHERE permission_id = 1";
+
+            // total number of comments
+            $res1 = $this->db->Execute( $query1 );
+            if( !$res1 ) {
+                $this->message .= "Error performing changes to the users table (1)";
+                return false;
+            }
+            $numComments = Array();
+            while( $row = $res1->FetchRow()) {
+                $userId = $row["user_id"];
+                $update = "UPDATE ".$this->dbPrefix."users SET site_admin = ".Db::qstr($userId);
+                $result = $this->db->Execute( $update );
+                if( !$result ) {
+                    $this->message .= "Error updating user with id {$userId}<br/>";
+                }
+                else
+                    $numUpdated++;
+            }
+
+            $this->message .= "{$numUpdated} users updated<br/>";
+            return true;                        
+        }
+        
         function updateArticleCounters()
         {
             include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );        
@@ -1952,7 +1979,7 @@
             $this->message = "";
             
             $methods = Array( "updateArticleCounters", "updateCategoryCounters", "updateBlogCounters", "updateTrackbacks", 
-                              "updateLinkCategories", "updateAlbums", "updateComments" );
+                              "updateLinkCategories", "updateAlbums", "updateComments", "updateAdminUsers" );
             
             foreach( $methods as $method ) {
                 $result = $this->$method();



More information about the pLog-svn mailing list