*/
-// $Id: gcm_daemon.php,v 1.6 2003-02-13 08:39:12 arjen Exp $
+// $Id: gcm_daemon.php,v 1.7 2003-02-14 06:35:09 arjen Exp $
ini_set('include_path', '.:./classes:../phpclasses');
$project_name = "gnucomo"; //name of the entire project
$app_name = "gcm_daemon"; //name of the application running
$developrelease = "TRUE"; //Indicates if special debug settings are needed
-$db_version = 28; //The db_version indicates what the level of
+$db_version = 30; //The db_version indicates what the level of
//the database should be. If the database is
//old an update will be generated.
$gcmd_version = 3; //This value indicates the active version of the gcm_daemon,
$local_sql = "SELECT MAX(notificationid) FROM notification " .
"WHERE notificationid > CAST ('" . $last_notification . "' AS BIGINT)";
$dbms->query($local_sql);
-
+
//Only process data if there are new notifications
if ($dbms->fetch_row() == "TRUE") {
+ if (intval($dbms->db_result_row[0])>0) {
$local_upper = $dbms->db_result_row[0] + 1;
- $local_sql = "SELECT COUNT(objectid), objectid FROM notification " .
+ $local_max = $dbms->db_result_row[0];
+ $local_sql = "SELECT COUNT(objectid), objectid FROM notification " .
"WHERE notificationid > CAST ('" . $last_notification ."' AS BIGINT) " .
"AND notificationid < CAST ('" . $local_upper .
"' AS BIGINT) GROUP BY objectid";
$local_sql = "UPDATE object SET notification_count = notification_count + " . $dbms->db_result_row[0] .
" WHERE objectid = '" . $dbms->db_result_row[1] . "'";
$local_dbms->query($local_sql);
- }
- }
+ }
- $local_sql = "UPDATE db_value SET setting_value = '" . $local_upper .
- "' WHERE setting = 'last_notification'";
- $dbms->query($local_sql);
-
+ $local_sql = "UPDATE db_value SET setting_value = '" . $local_max .
+ "' WHERE setting = 'last_notification'";
+ $dbms->query($local_sql);
+ }
+ }
}
?>