-function notificationstats ()
-{
-
- // OBSOLETE //
-
-/* This routine will determine how many new notifications have arrived and will
- * update the statistics in the object-table to keep the performance acceptable
- * INPUT : NONE
- * OUTPUT : NONE
- */
-
- global $dbms, $class_settings;
-
- //Find records in log that still have to be processed.
- $local_sql = "SELECT setting_value FROM db_value WHERE setting = 'last_notification'";
- $dbms->query($local_sql);
- $local_dbms = copy_db_class($dbms, $class_settings->database());
-
- //Determine the last notification
- if ($dbms->fetch_row() == "TRUE") {
- $last_notification = $dbms->db_result_row[0];
- }
-
- //Determine how many records we are going to analyse.
- $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_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";
- $dbms->query($local_sql);
-
-
- for ($i=0; $i < $dbms->num_rows(); $i++) {
- $dbms->fetch_row();
-
- $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_max .
- "' WHERE setting = 'last_notification'";
- $dbms->query($local_sql);
- }
- }
-}