From e02869e66b00b68e52f196b980dcd2b9dde9824f Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Tue, 10 Jan 2012 01:32:01 +0000 Subject: [PATCH] Add optional setting to disable an rsync instance --- source/lib/DownloadDispatcher/Sync/Plugin/Rsync.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/lib/DownloadDispatcher/Sync/Plugin/Rsync.class.php b/source/lib/DownloadDispatcher/Sync/Plugin/Rsync.class.php index e5e61b4..f5108d3 100644 --- a/source/lib/DownloadDispatcher/Sync/Plugin/Rsync.class.php +++ b/source/lib/DownloadDispatcher/Sync/Plugin/Rsync.class.php @@ -13,6 +13,7 @@ class DownloadDispatcher_Sync_Plugin_Rsync extends DownloadDispatcher_PluginBase protected $log; protected $instance; + protected $enabled; protected $options; protected $source; protected $destination; @@ -26,12 +27,17 @@ class DownloadDispatcher_Sync_Plugin_Rsync extends DownloadDispatcher_PluginBase $this->log = $log; $this->instance = $instance; + $this->enabled = $this->config->get("sync.Rsync.{$this->instance}.enabled", true); $this->options = $this->config->get("sync.Rsync.{$this->instance}.options"); $this->source = $this->config->get("sync.Rsync.{$this->instance}.source"); $this->destination = $this->config->get("sync.Rsync.{$this->instance}.destination"); } public function run() { + if ( ! $this->enabled) { + return; + } + DownloadDispatcher_LogEntry::debug($this->log, "Running Rsync synchroniser: '{$this->instance}'"); $command = "/usr/bin/rsync {$this->options} '{$this->source}' '{$this->destination}'";