diff --git a/Classes/Command/FetchWebsiteCommand.php b/Classes/Command/FetchWebsiteCommand.php new file mode 100644 index 0000000..8fa79e3 --- /dev/null +++ b/Classes/Command/FetchWebsiteCommand.php @@ -0,0 +1,44 @@ +setDescription('Fetches a website (including all subpages), so the TYPO3 cache gets filled.') + ->addArgument( + 'baseUrl', + InputArgument::REQUIRED, + 'The base url.' + );; + } + + /** + * @param InputInterface $input + * @param OutputInterface $output + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $fetchDirectory = Environment::getPublicPath() . '/typo3temp/t3fetch'; + + // Remove fetch directory + exec('rm -rf ' . $fetchDirectory); + + // Create fetch directory + exec('mkdir ' . $fetchDirectory); + + // Fetch website recursively + exec('wget -q -r ' . $input->getArgument('baseUrl') . ' -P ' . $fetchDirectory); + } +} diff --git a/Classes/Command/FetchWebsiteCommandController.php b/Classes/Command/FetchWebsiteCommandController.php deleted file mode 100644 index edf42f5..0000000 --- a/Classes/Command/FetchWebsiteCommandController.php +++ /dev/null @@ -1,37 +0,0 @@ -exec('rm -r -f ' . $fetchDirectory); - - // Create fetch directory - $this->exec('mkdir ' . $fetchDirectory); - - // Fetch website recursively - $this->exec('wget -q -r ' . $baseUrl . ' -P ' . $fetchDirectory); - } - - /** - * @param string $command - */ - private function exec($command) - { - exec($command, $output); - $this->output(implode("\n", $output)); - - // Removes % at the end of the output - $this->outputLine("\r"); - } -} diff --git a/Configuration/Commands.php b/Configuration/Commands.php new file mode 100644 index 0000000..59cc3e9 --- /dev/null +++ b/Configuration/Commands.php @@ -0,0 +1,8 @@ + [ + 'class' => \VV\T3fetch\Command\FetchWebsiteCommand::class, + 'schedulable' => true, + ], +]; diff --git a/README.md b/README.md index a7fa6d4..b953381 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Fetches a website (including all subpages), so the TYPO3 cache gets filled. ## How to use 1. Install TYPO3 extension via [composer](https://packagist.org/packages/visuellverstehen/t3fetch), [TER](https://extensions.typo3.org/extension/t3fetch/) or download and install manually. -2. Call command `fetchWebsite:fetchAll` via CLI or add scheduler task. +2. Call command `fetchWebsite:fetchAll` via CLI or add scheduler task (_Execute console commands_ and then select `fetchWebsite:fetchAll`). ## Requirements - Wget needs to be installed. diff --git a/composer.json b/composer.json index 97687b5..6632a13 100644 --- a/composer.json +++ b/composer.json @@ -17,8 +17,8 @@ } ], "require": { - "typo3/cms-core": ">=7.6 <=9.5", - "php": "^7.0.0" + "typo3/cms-core": ">=8.7 <=9.5", + "php": "^7.1.0" }, "autoload": { "psr-4": { diff --git a/ext_emconf.php b/ext_emconf.php index e2ceb04..a726a8b 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -7,12 +7,12 @@ 'author' => 'visuellverstehen', 'author_email' => 'kontakt@visuellverstehen.de', 'author_company' => 'visuellverstehen', - 'state' => 'beta', + 'state' => 'stable', 'clearCacheOnLoad' => false, - 'version' => '0.2.0', + 'version' => '1.0.0', 'constraints' => [ 'depends' => [ - 'typo3' => '7.6.0-9.5.99', + 'typo3' => '8.7.0-9.5.99', ] ] ]; diff --git a/ext_localconf.php b/ext_localconf.php deleted file mode 100644 index 0931580..0000000 --- a/ext_localconf.php +++ /dev/null @@ -1,9 +0,0 @@ -