tbrehm
2008-12-16 2e1d4af13f48e0db06c93eff7d9d6f2ff7e17939
server/lib/classes/modules.inc.php
@@ -82,7 +82,6 @@
   function processDatalog() {
      global $app,$conf;
      
      // TODO: process only new entries.
      //* If its a multiserver setup
      if($app->db->dbHost != $app->dbmaster->dbHost) {
         $sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." OR server_id = 0) ORDER BY datalog_id";
@@ -110,7 +109,7 @@
               $app->db->query($sql);
               if($app->db->errorNumber > 0) {
                  $replication_error = true;
                  $app->log("Replication failed. Error: ".$app->db->errorMessage,LOGLEVEL_ERROR);
                  $app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage,LOGLEVEL_ERROR);
               }
               $app->log("Replicated from master: ".$sql,LOGLEVEL_DEBUG);
            }
@@ -126,7 +125,7 @@
               $app->db->query($sql);
               if($app->db->errorNumber > 0) {
                  $replication_error = true;
                  $app->log("Replication failed. Error: ".$app->db->errorMessage,LOGLEVEL_ERROR);
                  $app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage,LOGLEVEL_ERROR);
               }
               $app->log("Replicated from master: ".$sql,LOGLEVEL_DEBUG);
            }
@@ -138,7 +137,7 @@
               $app->db->query($sql);
               if($app->db->errorNumber > 0) {
                  $replication_error = true;
                  $app->log("Replication failed. Error: ".$app->db->errorMessage,LOGLEVEL_ERROR);
                  $app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage,LOGLEVEL_ERROR);
               }
               $app->log("Replicated from master: ".$sql,LOGLEVEL_DEBUG);
            }
@@ -151,7 +150,12 @@
               $app->dbmaster->query("UPDATE server SET updated = ".$d["datalog_id"]." WHERE server_id = ".$conf["server_id"]);
               $app->log("Processed datalog_id ".$d["datalog_id"],LOGLEVEL_DEBUG);
            } else {
               $app->log("Error in Repliction, changes were not processed.",LOGLEVEL_ERROR);
               $app->log("Error in Replication, changes were not processed.",LOGLEVEL_ERROR);
               /*
                * If there is any error in processing the datalog we can't continue, because
                * we do not know if the newer actions require this (old) one.
                */
               return;
            }
         }