Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Scheduler tasks for indexing, reindexing and harvesting of documents #1119

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

frank-ulrich-weber
Copy link
Collaborator

Pres_01-2023_Solr-Verbesserungen:
A task for optimizing the index will be added when this is merged.

@frank-ulrich-weber frank-ulrich-weber changed the title Scheduler tasks for indexing, reindexing and harvesting of documents Pres_01-2023_Solr-Verbesserungen: Scheduler tasks for indexing, reindexing and harvesting of documents Jan 9, 2024
@sebastian-meyer sebastian-meyer changed the title Pres_01-2023_Solr-Verbesserungen: Scheduler tasks for indexing, reindexing and harvesting of documents [FEATURE] Scheduler tasks for indexing, reindexing and harvesting of documents Jan 26, 2024
@sebastian-meyer sebastian-meyer added ⚙ feature A new feature or enhancement. ⭐ development fund 2023 A candidate for the Kitodo e.V. development fund. labels Jan 26, 2024
@sebastian-meyer
Copy link
Member

sebastian-meyer commented May 24, 2024

@frank-ulrich-weber: Could you please fix the PHPStan and Codacy issues?
Also, I think you need to add typo3/cms-scheduler to composer.json in order for this to work (this should also help with PHPStan).

@frank-ulrich-weber
Copy link
Collaborator Author

frank-ulrich-weber commented Jun 14, 2024

At the moment I don't know how to resolve the remaining issues. The PHPStan and the first two Codays issues are correct but specified by the method signature of the scheduler interface. Additionaly I have no idea how to prevent the Cyclomatic Complexity of validateAdditionalFields() in a sensible way. Any hints? Thanks.

@@ -160,7 +160,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

if ($document === null) {
$io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .');
exit(1);
return 1;
Copy link
Member

@sebastian-meyer sebastian-meyer Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return 1;
return BaseCommand::FAILURE;

Comment on lines +14 to +22
use Kitodo\Dlf\Common\Helper;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface;
use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController;
use TYPO3\CMS\Scheduler\Task\AbstractTask;
use TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use Kitodo\Dlf\Common\Helper;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface;
use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController;
use TYPO3\CMS\Scheduler\Task\AbstractTask;
use TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;
use Kitodo\Dlf\Common\Helper;
use TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface;
use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController;

Please import namespaces in alphabetical order for better readibility.

return $fieldsValid;
}

public function saveAdditionalFields(array $submittedData, AbstractTask $task)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function saveAdditionalFields(array $submittedData, AbstractTask $task)
public function saveAdditionalFields(array $submittedData, BaseTask $task)

PHPStan correctly mentions all the calls to undefined methods in this method. That's because you declare $task as being of type AbstractTask, but then call methods which are only defined in BaseTask. I think declaring $task as being of type BaseTask should fix this. (On the other hand this may break the interface compatibility...)

@sebastian-meyer sebastian-meyer mentioned this pull request Jul 5, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ development fund 2023 A candidate for the Kitodo e.V. development fund. ⚙ feature A new feature or enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants