<?php
declare(strict_types=1);
/*
* This file is part of memberfiles bundle.
*
* (c) vonRotenberg
*
* @license commercial
*/
namespace vonRotenberg\MemberfilesBundle\Command;
use Contao\CoreBundle\Framework\ContaoFramework;
use Contao\System;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Console command to manually trigger file import for secure downloads
*/
class SecureDownloadsImportCommand extends Command
{
private ContaoFramework $framework;
public function __construct(ContaoFramework $framework)
{
$this->framework = $framework;
parent::__construct();
}
protected function configure(): void
{
$this
->setName('secureDownloads:import')
->setDescription('Check source folder and import files if applicable.')
;
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->framework->initialize();
$secdl_service = System::getContainer()->get("vonrotenberg.cron.secure_downloads_service");
$secdl_service->importFiles('cli');
return 0;
}
}