コード例 #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;
 }