ExportImportTool/Commands/ExportSite.php

35 lines
802 B
PHP
Raw Normal View History

2023-08-05 16:02:22 +00:00
<?php
namespace Piwik\Plugins\ExportImportTool\Commands;
use Piwik\Plugin\ConsoleCommand;
use Piwik\Plugins\ExportImportTool\API as ExportImportApi;
class ExportSite extends ConsoleCommand
{
protected function configure()
{
$this->setName('exportimporttool:export-site');
$this->setDescription('Exports a site from Matomo.');
$this->addRequiredArgument('idSite', 'The ID of the site you want to export.');
}
protected function doExecute(): int
{
$input = $this->getInput();
$idSite = $input->getArgument('idSite');
// Call your Export API method here
$api = new ExportImportApi;
$result = $api->exportSite($idSite);
$output = $this->getOutput();
$output->writeln($result);
return self::SUCCESS;
}
}