Add availability to disable an importer

This commit is contained in:
Nicolas Lœuillet
2025-05-26 15:45:55 +02:00
parent cad5a24fb6
commit 7e7674a4a6
17 changed files with 332 additions and 3 deletions

View File

@ -21,6 +21,7 @@ abstract class AbstractImport implements ImportInterface
protected $skippedEntries = 0;
protected $importedEntries = 0;
protected $queuedEntries = 0;
protected $enabled = true;
public function __construct(
protected EntityManagerInterface $em,
@ -74,6 +75,25 @@ abstract class AbstractImport implements ImportInterface
return $this->markAsRead;
}
/**
* Get whether the import is enabled.
* If not, the importer won't be available in the UI.
*/
public function isEnabled(): bool
{
return $this->enabled;
}
/**
* Set whether the import is enabled.
*/
public function setEnabled(bool $enabled): static
{
$this->enabled = $enabled;
return $this;
}
/**
* Set whether articles should be fetched for updated content.
*

View File

@ -18,7 +18,11 @@ class ImportChain
*/
public function addImport(ImportInterface $import, $alias)
{
// if (true === $import->isEnabled()) {
$this->imports[$alias] = $import;
// }
return $this;
}
/**

View File

@ -63,4 +63,15 @@ interface ImportInterface extends LoggerAwareInterface
* @param bool $markAsRead
*/
public function setMarkAsRead($markAsRead): static;
/**
* Get whether the import is enabled.
* If not, the importer won't be available in the UI.
*/
public function isEnabled(): bool;
/**
* Set whether the import is enabled.
*/
public function setEnabled(bool $enabled): static;
}