Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Classes/Controller/CrontabModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CrontabModuleController extends ActionController
*/
private $moduleTemplateFactory;

public function __construct(TaskRepository $taskRepository, Crontab $crontab, ModuleTemplateFactory $moduleTemplateFactory, ProcessManager $processManager = null)
public function __construct(TaskRepository $taskRepository, Crontab $crontab, ModuleTemplateFactory $moduleTemplateFactory, ?ProcessManager $processManager = null)
{
$this->taskRepository = $taskRepository;
$this->crontab = $crontab;
Expand All @@ -42,18 +42,18 @@ public function __construct(TaskRepository $taskRepository, Crontab $crontab, Mo

public function listAction(): ResponseInterface
{
$this->view->assignMultiple([
$moduleTemplate = $this->moduleTemplateFactory->create($this->request);

$moduleTemplate->assignMultiple([
'groupedTasks' => $this->taskRepository->getGroupedTasks(),
'crontab' => $this->crontab,
'processManager' => $this->processManager,
'shortcutLabel' => 'crontab',
'now' => new \DateTimeImmutable(),
]);

$moduleTemplate = $this->moduleTemplateFactory->create($this->request);
// Adding title, menus, buttons, etc. using $moduleTemplate ...
$moduleTemplate->setContent($this->view->render());
return $this->htmlResponse($moduleTemplate->renderContent());
return $moduleTemplate->renderResponse('CrontabModule/List');
}

public function toggleScheduleAction(string $identifier): ResponseInterface
Expand Down
4 changes: 2 additions & 2 deletions Classes/Crontab.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Crontab
*/
private $connection;

public function __construct(TaskRepository $taskRepository = null)
public function __construct(?TaskRepository $taskRepository = null)
{
$this->taskRepository = $taskRepository ?? GeneralUtility::makeInstance(TaskRepository::class);
$this->connection = $connection ?? GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable(self::scheduledTable);
Expand Down Expand Up @@ -136,7 +136,7 @@ public function dueTasks(): \Generator
'next_execution' => 'ASC',
]
);
while ($scheduleInformation = $statement->fetch()) {
while ($scheduleInformation = $statement->fetchAssociative()) {
if ($scheduleInformation['next_execution'] > time()) {
break;
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Process/ProcessManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ProcessManager implements LoggerAwareInterface
*/
private $listeners;

public function __construct(int $forks, Connection $databaseConnection = null)
public function __construct(int $forks, ?Connection $databaseConnection = null)
{
$this->forks = $forks;
$this->processes = new \SplObjectStorage();
Expand Down
2 changes: 1 addition & 1 deletion Classes/Process/TaskProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function createFromTaskDefinition(TaskDefinition $task): self
return new self($task, $commandLine, ['TYPO3_CONSOLE_SUB_PROCESS' => true]);
}

public function start(callable $callback = null, array $env = []): void
public function start(?callable $callback = null, array $env = []): void
{
parent::start($callback, $env);
$this->processId = $this->getPid();
Expand Down
2 changes: 1 addition & 1 deletion Classes/Repository/TaskRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TaskRepository
*/
private $taskConfiguration;

public function __construct(array $taskConfiguration = null)
public function __construct(?array $taskConfiguration = null)
{
$this->taskConfiguration = $taskConfiguration ?? $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crontab'] ?? [];
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Task/CommandExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static function create(array $options): TaskExecutor
return new self($options);
}

public function run(Application $application, InputInterface $input = null, OutputInterface $output = null): bool
public function run(Application $application, ?InputInterface $input = null, ?OutputInterface $output = null): bool
{
$command = $this->options['command'];
$arguments = $this->options['arguments'] ?? [];
Expand Down
2 changes: 1 addition & 1 deletion Classes/Task/SchedulerTaskExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function create(array $options): TaskExecutor
return new self($options);
}

public function run(Application $application, InputInterface $input = null, OutputInterface $output = null): bool
public function run(Application $application, ?InputInterface $input = null, ?OutputInterface $output = null): bool
{
return $this->schedulerTask->execute();
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Task/ScriptExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static function create(array $options): TaskExecutor
return new self($options);
}

public function run(Application $application, InputInterface $input = null, OutputInterface $output = null): bool
public function run(Application $application, ?InputInterface $input = null, ?OutputInterface $output = null): bool
{
$command = str_replace('@php ', '', $this->options['script']);
$arguments = $this->options['arguments'] ?? [];
Expand Down
2 changes: 1 addition & 1 deletion Classes/Task/TaskExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface TaskExecutor
{
public static function create(array $options): self;

public function run(Application $application, InputInterface $input = null, OutputInterface $output = null): bool;
public function run(Application $application, ?InputInterface $input = null, ?OutputInterface $output = null): bool;

public function getTitle(): ?string;

Expand Down
14 changes: 4 additions & 10 deletions Classes/ViewHelpers/ExpressionViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,16 @@

class ExpressionViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;

protected $escapeOutput = false;

public function initializeArguments()
public function initializeArguments(): void
{
$this->registerArgument('expr', 'string', 'Expression to evaluate', true);
}

public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
) {
public function render()
{
$expressionLanguage = new ExpressionLanguage();

return $expressionLanguage->evaluate($arguments['expr'], $renderingContext->getVariableProvider()->getAll());
return $expressionLanguage->evaluate($this->arguments['expr'], $this->renderingContext->getVariableProvider()->getAll());
}
}
14 changes: 7 additions & 7 deletions Configuration/Backend/Modules.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php

return [
'web_module' => [
'module-crontab' => [
'parent' => 'system',
'position' => ['after' => 'backend_user_management'],
'access' => 'admin',
'workspaces' => '*',
'path' => '/module/system/crontab',
'position' => [
'after' => 'backend_user_management',
],
'iconIdentifier' => 'module-crontab',
'access' => 'admin',
'labels' => 'LLL:EXT:crontab/Resources/Private/Language/locallang_mod.xlf',
'extensionName' => 'crontab',
'extensionName' => 'Crontab',
'controllerActions' => [
\Helhum\TYPO3\Crontab\Controller\CrontabModuleController::class => [
'Helhum\TYPO3\Crontab\Controller\CrontabModuleController' => [
'list',
'toggleSchedule',
'terminate',
Expand Down
8 changes: 8 additions & 0 deletions Configuration/JavaScriptModules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'dependencies' => ['backend'],
'imports' => [
'@helhum/crontab/' => 'EXT:crontab/Resources/Public/JavaScript/',
],
];
11 changes: 5 additions & 6 deletions Resources/Private/Layouts/Default.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
data-namespace-typo3-fluid="true">

<f:be.pageRenderer
includeRequireJsModules="{
0:'TYPO3/CMS/Crontab/Scheduler',
1:'TYPO3/CMS/Backend/DateTimePicker',
2:'TYPO3/CMS/Backend/Tooltip',
3:'TYPO3/CMS/Backend/Modal',
4:'TYPO3/CMS/Backend/MultiRecordSelection'
includeJavaScriptModules="{
0:'@helhum/crontab/scheduler.js',
1:'@typo3/backend/date-time-picker.js',
3:'@typo3/backend/modal.js',
4:'@typo3/backend/multi-record-selection.js'
}"
/>

Expand Down
190 changes: 0 additions & 190 deletions Resources/Public/JavaScript/Scheduler.js

This file was deleted.

Loading