hasBeenDisabled()) { return; } $this->runScheduledImports() ->runScheduledSyncs() ->syncCoreStages() ->runScheduledDeployments() ; } public function renderconfigAction() { IcingaConfig::generate($this->db()); } protected function hasBeenDisabled() { return false; } protected function runScheduledImports() { foreach (ImportSource::loadAll($this->db()) as $source) { Benchmark::measure('Starting with import ' . $source->source_name); try { $import = new Import($source); if ($import->providesChanges()) { printf('Import "%s" provides changes, triggering run... ', $source->source_name); Benchmark::measure('Found changes for ' . $source->source_name); if ($import->run()) { Benchmark::measure('Import succeeded for ' . $source->source_name); print "SUCCEEDED\n"; } } } catch (Exception $e) { echo $this->screen->colorize('ERROR: ' . $e->getMessage(), 'red') . "\n"; Benchmark::measure('FAILED'); } } return $this; } 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); $sync = new Sync($rule); if ($sync->hasModifications()) { printf('Sync rule "%s" provides changes, triggering sync... ', $rule->rule_name); Benchmark::measure('Got modifications for sync rule ' . $rule->rule_name); if ($sync->apply()) { Benchmark::measure('Successfully synced rule ' . $rule->rule_name); print "SUCCEEDED\n"; } } } return $this; } protected function syncCoreStages() { return $this; } protected function runScheduledDeployments() { return $this; } }