Пример #1
0
 public function runAction()
 {
     if ($runId = Sync::run(SyncRule::load($this->params->get('id'), $this->db()))) {
         Notification::success('Source has successfully been synchronized');
         $this->redirectNow('director/list/syncrule');
     } else {
     }
 }
Пример #2
0
 protected function runScheduledSyncs()
 {
     // TODO: import-triggered:
     //      foreach $rule->involvedImports() -> if changedsince -> ... syncChangedRows
     foreach (SyncRule::loadAll($this->db) as $rule) {
         Benchmark::measure('Checking sync rule ' . $rule->rule_name);
         $mod = Sync::getExpectedModifications($rule);
         if (count($mod) > 0) {
             printf('Sync rule "%s" provides changes, triggering sync... ', $rule->rule_name);
             Benchmark::measure('Got modifications for sync rule ' . $rule->rule_name);
             if (Sync::run($rule)) {
                 Benchmark::measure('Successfully synced rule ' . $rule->rule_name);
                 print "SUCCEEDED\n";
             }
         }
     }
     return $this;
 }
Пример #3
0
 protected function getRowClasses($row)
 {
     if (!$this->revalidate) {
         return array();
     }
     try {
         // $mod = Sync::hasModifications(
         $mod = Sync::getExpectedModifications(SyncRule::load($row->id, $this->connection()));
         if (count($mod) > 0) {
             $row->rule_name = $row->rule_name . ' (' . count($mod) . ')';
             return 'pending-changes';
         } else {
             return 'in-sync';
         }
     } catch (Exception $e) {
         $row->rule_name = $row->rule_name . ' (' . $e->getMessage() . ')';
         return 'failing';
     }
 }