diff --git a/language/en-GB/en-GB.plg_system_sitesauce.ini b/language/en-GB/en-GB.plg_system_sitesauce.ini index 93c0c5a..a03264a 100644 --- a/language/en-GB/en-GB.plg_system_sitesauce.ini +++ b/language/en-GB/en-GB.plg_system_sitesauce.ini @@ -8,4 +8,6 @@ PLG_SYSTEM_SITESAUCE_QUICKICON_LABEL_DESC="The text used in the QuickIcon" PLG_SYSTEM_SITESAUCE_QUICKICON_ICON_LABEL="QuickIcon Icon" PLG_SYSTEM_SITESAUCE_QUICKICON_ICON_DESC="The FontAwesome Icon used in the QuickIcon" PLG_SYSTEM_SITESAUCE_DEPLOY_STARTED="Deploy Started" -PLG_SYSTEM_SITESAUCE_DEPLOY_FAILED="Deploy Started" \ No newline at end of file +PLG_SYSTEM_SITESAUCE_DEPLOY_FAILED="Deploy Started" +PLG_SYSTEM_SITESAUCE_ENABLE_AUTODEPLOY_LABEL="Enable Automaic Deploy" +PLG_SYSTEM_SITESAUCE_ENABLE_AUTODEPLOY_DESC="Deploy the site after each content save / delete / publish / unpublish" \ No newline at end of file diff --git a/sitesauce.php b/sitesauce.php index 7af1251..1e92bc9 100644 --- a/sitesauce.php +++ b/sitesauce.php @@ -9,10 +9,21 @@ class plgSystemSitesauce extends JPlugin */ protected $app; - /*** - * @param $context - * @return array|void - */ + public function onContentAfterSave() + { + $this->automaticDeploy(); + } + + public function onContentAfterDelete() + { + $this->automaticDeploy(); + } + + public function onContentChangeState() + { + $this->automaticDeploy(); + } + public function onGetIcons($context) { if ($context !== 'mod_quickicon') { @@ -84,4 +95,13 @@ protected function deploy() $this->app->enqueueMessage('PLG_SYSTEM_SITESAUCE_DEPLOY_FAILED'); $this->app->redirect(\JRoute::_('index.php', false)); } + + protected function automaticDeploy() + { + if (!$this->params->get('autodeploy', false)) { + return; + } + + JHttpFactory::getHttp()->get($this->params->get('build_hook')); + } } diff --git a/sitesauce.xml b/sitesauce.xml index fb817d4..08f92eb 100644 --- a/sitesauce.xml +++ b/sitesauce.xml @@ -24,6 +24,10 @@ + + + +