Add optional setting to disable an rsync instance
This commit is contained in:
@@ -13,6 +13,7 @@ class DownloadDispatcher_Sync_Plugin_Rsync extends DownloadDispatcher_PluginBase
|
|||||||
protected $log;
|
protected $log;
|
||||||
|
|
||||||
protected $instance;
|
protected $instance;
|
||||||
|
protected $enabled;
|
||||||
protected $options;
|
protected $options;
|
||||||
protected $source;
|
protected $source;
|
||||||
protected $destination;
|
protected $destination;
|
||||||
@@ -26,12 +27,17 @@ class DownloadDispatcher_Sync_Plugin_Rsync extends DownloadDispatcher_PluginBase
|
|||||||
$this->log = $log;
|
$this->log = $log;
|
||||||
$this->instance = $instance;
|
$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->options = $this->config->get("sync.Rsync.{$this->instance}.options");
|
||||||
$this->source = $this->config->get("sync.Rsync.{$this->instance}.source");
|
$this->source = $this->config->get("sync.Rsync.{$this->instance}.source");
|
||||||
$this->destination = $this->config->get("sync.Rsync.{$this->instance}.destination");
|
$this->destination = $this->config->get("sync.Rsync.{$this->instance}.destination");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run() {
|
public function run() {
|
||||||
|
if ( ! $this->enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DownloadDispatcher_LogEntry::debug($this->log, "Running Rsync synchroniser: '{$this->instance}'");
|
DownloadDispatcher_LogEntry::debug($this->log, "Running Rsync synchroniser: '{$this->instance}'");
|
||||||
|
|
||||||
$command = "/usr/bin/rsync {$this->options} '{$this->source}' '{$this->destination}'";
|
$command = "/usr/bin/rsync {$this->options} '{$this->source}' '{$this->destination}'";
|
||||||
|
|||||||
Reference in New Issue
Block a user