First commit of tag changes. bug-1444
[cacert-devel.git] / scripts / cron / updatesort.php
index ec4f408..12ef153 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/php -q
-<? /*
+<?php /*
     LibreSSL - CAcert web application
     Copyright (C) 2004-2008  CAcert Inc.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
-       include_once("../../includes/mysql.php");
+       require_once(dirname(__FILE__).'/../../includes/mysql.php');
+       require_once(dirname(__FILE__).'/../../includes/lib/account.php');
 
 
-
-       //mysql_query("update users set assurer=0");
-       $query = "select notary.`to` as uid from notary group by notary.`to` having sum(points)>=100;";
-       $res = mysql_query($query);
-       while($row = mysql_fetch_assoc($res))
-       {
-               $query = "update users set `assurer`='1' where `id`='${row['uid']}'";
-               //echo $query."\n";
-               mysql_query($query);
+       // Recalculate assurer flag for all accounts
+       if (!fix_assurer_flag()) {
+               fwrite(STDERR, "ERROR on fixing the assurer flag. Continuing anyway");
        }
 
 
@@ -72,6 +67,4 @@
        }
 
 
-
-
 ?>