expect parameter of type SeedDMS_SchedulerTask in execute()

This commit is contained in:
Uwe Steinmann 2021-07-05 10:08:51 +02:00
parent 7218e47558
commit cb601a82eb
3 changed files with 11 additions and 7 deletions

View File

@ -109,7 +109,7 @@ class SeedDMS_SchedulerTaskBase {
$this->fulltextservice = $fulltextservice;
} /* }}} */
public function execute($task) { /* {{{ */
public function execute(SeedDMS_SchedulerTask $task) { /* {{{ */
return true;
} /* }}} */

View File

@ -18,7 +18,7 @@ class SeedDMS_ExpiredDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
* @param $dms dms
* @return boolean true if task was executed succesfully, otherwise false
*/
public function execute($task) {
public function execute(SeedDMS_SchedulerTask $task) {
$dms = $this->dms;
$user = $this->user;
$settings = $this->settings;
@ -117,11 +117,14 @@ class SeedDMS_ExpiredDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
* iterating over all folders recursively.
*/
class SeedDMS_Task_Indexer_Process_Folder { /* {{{ */
protected $scheduler;
protected $forceupdate;
protected $fulltextservice;
public function __construct($fulltextservice, $forceupdate) { /* {{{ */
public function __construct($scheduler, $fulltextservice, $forceupdate) { /* {{{ */
$this->scheduler = $scheduler;
$this->fulltextservice = $fulltextservice;
$this->forceupdate = $forceupdate;
$this->numdocs = $this->fulltextservice->Indexer()->count();
@ -249,7 +252,7 @@ class SeedDMS_IndexingDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ *
* @param $dms dms
* @return boolean true if task was executed succesfully, otherwise false
*/
public function execute($task) {
public function execute(SeedDMS_SchedulerTask $task) {
$dms = $this->dms;
$logger = $this->logger;
$fulltextservice = $this->fulltextservice;
@ -273,7 +276,7 @@ class SeedDMS_IndexingDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ *
}
}
$folderprocess = new SeedDMS_Task_Indexer_Process_Folder($fulltextservice, $recreate);
$folderprocess = new SeedDMS_Task_Indexer_Process_Folder($this, $fulltextservice, $recreate);
call_user_func(array($folderprocess, 'process'), $folder, -1);
$tree = new SeedDMS_FolderTree($folder, array($folderprocess, 'process'));
} else {
@ -345,7 +348,7 @@ class SeedDMS_CheckSumTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
* @param $dms dms
* @return boolean true if task was executed succesfully, otherwise false
*/
public function execute($task) {
public function execute(SeedDMS_SchedulerTask $task) {
$dms = $this->dms;
$logger = $this->logger;
$taskparams = $task->getParameter();
@ -433,7 +436,7 @@ class SeedDMS_PreviewTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
* @param $dms dms
* @return boolean true if task was executed succesfully, otherwise false
*/
public function execute($task) {
public function execute(SeedDMS_SchedulerTask $task) {
$dms = $this->dms;
$logger = $this->logger;
$settings = $this->settings;

View File

@ -84,6 +84,7 @@ foreach($tasks as $task) {
if(method_exists($taskobj, 'execute')) {
if(!$task->getDisabled() && $task->isDue()) {
if($mode == 'run') {
echo get_class($task);
if($taskobj->execute($task)) {
add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." successful.");
$task->updateLastNextRun();