PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View File

@ -0,0 +1,51 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\CorePluginsAdmin\Commands;
use Piwik\Plugin\ConsoleCommand;
use Piwik\Plugin\Manager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* plugin:activate console command.
*/
class ActivatePlugin extends ConsoleCommand
{
protected function configure()
{
$this->setName('plugin:activate');
$this->setDescription('Activate a plugin.');
$this->addArgument('plugin', InputArgument::IS_ARRAY, 'The plugin name you want to activate. Multiple plugin names can be specified separated by a space.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$pluginManager = Manager::getInstance();
$plugins = $input->getArgument('plugin');
foreach ($plugins as $plugin) {
if ($pluginManager->isPluginActivated($plugin)) {
$output->writeln(sprintf('<comment>The plugin %s is already activated.</comment>', $plugin));
continue;
}
if ($dependencies = $pluginManager->loadPlugin($plugin)->getMissingDependenciesAsString()) {
$output->writeln("<error>$dependencies</error>");
continue;
}
$pluginManager->activatePlugin($plugin);
$output->writeln("Activated plugin <info>$plugin</info>");
}
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\CorePluginsAdmin\Commands;
use Piwik\Plugin\ConsoleCommand;
use Piwik\Plugin\Manager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* plugin:deactivate console command.
*/
class DeactivatePlugin extends ConsoleCommand
{
protected function configure()
{
$this->setName('plugin:deactivate');
$this->setDescription('Deactivate a plugin.');
$this->addArgument('plugin', InputArgument::IS_ARRAY, 'The plugin name you want to activate. Multiple plugin names can be specified separated by a space.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$pluginManager = Manager::getInstance();
$plugins = $input->getArgument('plugin');
foreach ($plugins as $plugin) {
if (!$pluginManager->isPluginActivated($plugin)) {
$output->writeln(sprintf('<comment>The plugin %s is already deactivated.</comment>', $plugin));
continue;
}
$pluginManager->deactivatePlugin($plugin);
$output->writeln("Deactivated plugin <info>$plugin</info>");
}
}
}

View File

@ -0,0 +1,64 @@
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\CorePluginsAdmin\Commands;
use Piwik\Plugin\ConsoleCommand;
use Piwik\Plugin\Manager;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* plugin:list console command.
*/
class ListPlugins extends ConsoleCommand
{
protected function configure()
{
$this->setName('plugin:list');
$this->setDescription('List installed plugins.');
$this->addOption('filter-plugin', null, InputOption::VALUE_OPTIONAL, 'If given, prints only plugins that contain this term.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$pluginManager = Manager::getInstance();
$plugins = $pluginManager->getInstalledPluginsName();
$pluginFilter = $input->getOption('filter-plugin');
if (!empty($pluginFilter)) {
$plugins = array_filter($plugins, function ($pluginName) use ($pluginFilter) {
return strpos($pluginName, $pluginFilter) !== false;
});
}
$plugins = array_map(function ($plugin) use ($pluginManager) {
return array(
'<info>' . $plugin . '</info>',
$pluginManager->isPluginBundledWithCore($plugin) ? 'Core' : 'Optional',
$pluginManager->isPluginActivated($plugin) ? 'Activated' : '<comment>Not activated</comment>',
);
}, $plugins);
// Sort Core plugins first
usort($plugins, function ($a, $b) {
return strcmp($a[1], $b[1]);
});
$table = new Table($output);
$table
->setHeaders(array('Plugin', 'Core or optional?', 'Status'))
->setRows($plugins)
;
$table->render();
}
}