Commit 56258225 authored by kroky6's avatar kroky6

[NEW] list:execute console command allowing execution of any action defined in...

[NEW] list:execute console command allowing execution of any action defined in a PluginListExecute block on any tiki page
parent b2a308d2
......@@ -2631,6 +2631,7 @@ lib/core/Tiki/Command/IndexOptimizeCommand.php -text
lib/core/Tiki/Command/IndexRebuildCommand.php -text
lib/core/Tiki/Command/InstallCommand.php -text
lib/core/Tiki/Command/LessCompileCommand.php -text
lib/core/Tiki/Command/ListExecuteCommand.php -text
lib/core/Tiki/Command/MailInPollCommand.php -text
lib/core/Tiki/Command/MailQueueSendCommand.php -text
lib/core/Tiki/Command/MultiTikiListCommand.php -text
......
......@@ -106,6 +106,7 @@ if ($isInstalled && ! $installer->requiresUpdate()) {
$console->add(new Tiki\Command\IndexRebuildCommand);
$console->add(new Tiki\Command\IndexOptimizeCommand);
$console->add(new Tiki\Command\IndexCatchUpCommand);
$console->add(new Tiki\Command\ListExecuteCommand);
$console->add(new Tiki\Command\MailInPollCommand);
$console->add(new Tiki\Command\MailQueueSendCommand);
$console->add(new Tiki\Command\NotificationDigestCommand);
......@@ -134,6 +135,7 @@ if ($isInstalled && ! $installer->requiresUpdate()) {
$console->add(new Tiki\Command\UnavailableCommand('index:rebuild'))->ignoreValidationErrors();
$console->add(new Tiki\Command\UnavailableCommand('index:optimize'))->ignoreValidationErrors();
$console->add(new Tiki\Command\UnavailableCommand('index:catch-up'))->ignoreValidationErrors();
$console->add(new Tiki\Command\UnavailableCommand('list:execute'))->ignoreValidationErrors();
$console->add(new Tiki\Command\UnavailableCommand('mail-in:poll'))->ignoreValidationErrors();
$console->add(new Tiki\Command\UnavailableCommand('mail-queue:send'))->ignoreValidationErrors();
$console->add(new Tiki\Command\UnavailableCommand('notification:digest'))->ignoreValidationErrors();
......
<?php
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: NotificationDigestCommand.php 57969 2016-03-17 20:07:40Z jonnybradley $
namespace Tiki\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ListExecuteCommand extends Command
{
protected function configure()
{
$this
->setName('list:execute')
->setDescription('Performs Plugin ListExecute command on a particular page')
->addArgument(
'page',
InputArgument::REQUIRED,
'Page name where Plugin ListExecute is setup'
)
->addArgument(
'action',
InputArgument::REQUIRED,
'Name of the action to be executed as defined on the target page'
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$page = $input->getArgument('page');
$action = $input->getArgument('action');
$tikilib = \TikiLib::lib('tiki');
if (! $pageInfo = $tikilib->get_page_info($page)) {
$output->writeln("Page $page not found.");
return false;
}
$_POST['list_action'] = $action;
$_POST['objects'] = array('ALL');
$tikilib->parse_data($pageInfo['data']);
$output->writeln("Action $action executed on page $page.");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment