-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from pagemachine/typo3v9-deprecations
Fix TYPO3v9 deprecations
- Loading branch information
Showing
19 changed files
with
363 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace PAGEmachine\Searchable\Command\Index; | ||
|
||
use PAGEmachine\Searchable\Service\IndexingService; | ||
use Symfony\Component\Console\Command\Command; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Extbase\Object\ObjectManager; | ||
|
||
abstract class AbstractIndexCommand extends Command | ||
{ | ||
/** | ||
* @var IndexingService | ||
*/ | ||
protected $indexingService; | ||
|
||
public function __construct(...$arguments) | ||
{ | ||
parent::__construct(...$arguments); | ||
|
||
$objectManager = GeneralUtility::makeInstance(ObjectManager::class); | ||
$this->indexingService = $objectManager->get(IndexingService::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace PAGEmachine\Searchable\Command\Index; | ||
|
||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
final class ResetCommand extends AbstractIndexCommand | ||
{ | ||
/** | ||
* Configures the current command. | ||
*/ | ||
protected function configure() | ||
{ | ||
$this | ||
->setDescription('Reset search index') | ||
->addArgument('language', InputArgument::OPTIONAL, 'Language of index to reset'); | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$this->indexingService->resetIndex( | ||
$input->hasArgument('language') ? (int)$input->getArgument('language') : null | ||
); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace PAGEmachine\Searchable\Command\Index; | ||
|
||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
final class SetupCommand extends AbstractIndexCommand | ||
{ | ||
/** | ||
* Configures the current command. | ||
*/ | ||
protected function configure() | ||
{ | ||
$this | ||
->setDescription('Set up everything for search') | ||
->setHelp('Sets up indices and pipelines and verifies the indexer configuration, needs to be run after installation. Can be run multiple times to ensure correct setup.'); | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$this->indexingService->setup(); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace PAGEmachine\Searchable\Command\Index; | ||
|
||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
final class UpdateFullCommand extends AbstractIndexCommand | ||
{ | ||
/** | ||
* Configures the current command. | ||
*/ | ||
protected function configure() | ||
{ | ||
$this | ||
->setDescription('Process search indexers') | ||
->addArgument('type', InputArgument::OPTIONAL, 'Type to run indexers for'); | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$this->indexingService->indexFull($input->getArgument('type')); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace PAGEmachine\Searchable\Command\Index; | ||
|
||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
final class UpdatePartialCommand extends AbstractIndexCommand | ||
{ | ||
/** | ||
* Configures the current command. | ||
*/ | ||
protected function configure() | ||
{ | ||
$this | ||
->setDescription('Process search indexer updates') | ||
->addArgument('type', InputArgument::OPTIONAL, 'Type to run indexers for'); | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$this->indexingService->indexPartial($input->getArgument('type')); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace PAGEmachine\Searchable\Command\Legacy; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
/** | ||
* @deprecated will be removed with Searchable v4 | ||
*/ | ||
abstract class AbstractLegacyCommand extends Command | ||
{ | ||
/** | ||
* The replacement for this deprecated legacy command | ||
* | ||
* @var string | ||
*/ | ||
protected $replacementCommand; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDescription() | ||
{ | ||
return sprintf( | ||
'%s <comment>(deprecated)</>', | ||
$this->getApplication()->find($this->replacementCommand)->getDescription() | ||
); | ||
} | ||
|
||
/** | ||
* @return \Symfony\Component\Console\Input\InputDefinition | ||
*/ | ||
public function getDefinition() | ||
{ | ||
return $this->getApplication()->find($this->replacementCommand)->getDefinition(); | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$deprecationMessage = sprintf( | ||
'The CLI command "%s" is deprecated and will be removed with Searchable v4, use "%s" instead', | ||
$this->getName(), | ||
$this->replacementCommand | ||
); | ||
|
||
if (!method_exists(GeneralUtility::class, 'deprecationLog')) { // TYPO3v10 | ||
trigger_error($deprecationMessage, E_USER_DEPRECATED); | ||
} else { | ||
// @extensionScannerIgnoreLine | ||
GeneralUtility::deprecationLog($deprecationMessage); | ||
} | ||
|
||
return $this->getApplication()->find($this->replacementCommand)->run($input, $output); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace PAGEmachine\Searchable\Command\Legacy; | ||
|
||
final class LegacyResetCommand extends AbstractLegacyCommand | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $replacementCommand = 'index:reset'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace PAGEmachine\Searchable\Command\Legacy; | ||
|
||
final class LegacySetupCommand extends AbstractLegacyCommand | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $replacementCommand = 'index:setup'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace PAGEmachine\Searchable\Command\Legacy; | ||
|
||
final class LegacyUpdateFullCommand extends AbstractLegacyCommand | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $replacementCommand = 'index:update:full'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace PAGEmachine\Searchable\Command\Legacy; | ||
|
||
final class LegacyUpdatePartialCommand extends AbstractLegacyCommand | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $replacementCommand = 'index:update:partial'; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.