Skip to content

Commit

Permalink
New feature #12120: direct action by php-cli (#638)
Browse files Browse the repository at this point in the history
Dev: target mandatory
Dev: 2 optionnal parameters function and options
  • Loading branch information
Shnoulle committed Feb 13, 2017
1 parent 75a0f47 commit 1f266ac
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions application/commands/PluginCommand.php
@@ -1,9 +1,9 @@
<?php
/*
* LimeSurvey (tm)
* Copyright (C) 2011 The LimeSurvey Project Team / Carsten Schmitz
* Copyright (C) 2011-2017 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* License: GNU/GPL License v3 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
Expand All @@ -15,13 +15,36 @@ class PluginCommand extends CConsoleCommand
{
public $connection;

/**
* Call for cron action
* @interval int minityes for interval if needed
* @return void
*/
public function actionCron($interval=null)
{
$pm = \Yii::app()->pluginManager;
$event = new PluginEvent('cron');
$event->set('interval', $interval);
$pm->dispatchEvent($event);
}

/**
* Call direct by command (it's default)
* @plugin string : the plugin name, target of action
* @function mixed : extra param for plugin if needed
* @options mixed : extra param for plugin if needed
* @return void
*/
public function actionIndex($target, $function=null,$option=null)
{
$pm = \Yii::app()->pluginManager;
$event = new PluginEvent('direct');
$event->set('target', $target);
$event->set('function', $function);
$event->set('option', $option);
$pm->dispatchEvent($event);
}

}

?>

0 comments on commit 1f266ac

Please sign in to comment.