mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -05:00
Refactor core/Command/Background
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
This commit is contained in:
parent
b0b4c7e042
commit
7dc304db02
5 changed files with 12 additions and 5 deletions
|
|
@ -26,7 +26,7 @@
|
|||
namespace OC\Core\Command\Background;
|
||||
|
||||
class Ajax extends Base {
|
||||
protected function getMode() {
|
||||
protected function getMode(): string {
|
||||
return 'ajax';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ abstract class Base extends Command {
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure() {
|
||||
protected function configure(): void {
|
||||
$mode = $this->getMode();
|
||||
$this
|
||||
->setName("background:$mode")
|
||||
|
|
@ -59,6 +59,7 @@ abstract class Base extends Command {
|
|||
*
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
* @return int
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||
$mode = $this->getMode();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
namespace OC\Core\Command\Background;
|
||||
|
||||
class Cron extends Base {
|
||||
protected function getMode() {
|
||||
protected function getMode(): string {
|
||||
return 'cron';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ class Job extends Command {
|
|||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||
$jobId = (int) $input->getArgument('job-id');
|
||||
|
||||
|
|
@ -102,7 +105,10 @@ class Job extends Command {
|
|||
return 0;
|
||||
}
|
||||
|
||||
protected function printJobInfo(int $jobId, IJob $job, OutputInterface$output): void {
|
||||
/**
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
protected function printJobInfo(int $jobId, IJob $job, OutputInterface $output): void {
|
||||
$row = $this->jobList->getDetailsById($jobId);
|
||||
|
||||
$lastRun = new \DateTime();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
namespace OC\Core\Command\Background;
|
||||
|
||||
class WebCron extends Base {
|
||||
protected function getMode() {
|
||||
protected function getMode(): string {
|
||||
return 'webcron';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue