Skip to content

Component/Cron: init cron jobs via Component's seek#8731

Open
nhaagen wants to merge 39 commits intoILIAS-eLearning:trunkfrom
nhaagen:11/CronJob/Seeker
Open

Component/Cron: init cron jobs via Component's seek#8731
nhaagen wants to merge 39 commits intoILIAS-eLearning:trunkfrom
nhaagen:11/CronJob/Seeker

Conversation

@nhaagen
Copy link
Contributor

@nhaagen nhaagen commented Dec 16, 2024

Move registration of cron-jobs to component-level with contribute / seek and remove xml-based processor.
Construction of CronJobs is still an issue (as stated in the roadmap already); I circumvented this with an additional flag in __construct, which was the easiest to stay in the scope of this PR.

@nhaagen nhaagen force-pushed the 11/CronJob/Seeker branch 2 times, most recently from 6192bd9 to 3bad331 Compare December 16, 2024 11:16
@nhaagen nhaagen marked this pull request as ready for review December 16, 2024 12:25
Copy link
Contributor

@klees klees left a comment

Choose a reason for hiding this comment

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

Hi @nhaagen,

thanks a lot for looking into this. Looks promising afaic.

Please answer the following questions:

Please consider the following suggestions. You do not need to follow those, but but please indicate shortly why you prefer to do otherwise:

  • named objective: Lets publish ilCronjobsRegisteredObjective as a named objective too. People could then be really sure that all cronjobs are registered indeed...

I guess we should do one iteration before handing this over to @mjansenDatabay. Also: Please remember to open an according PR for the test plugin repo.

Kind regards!

Copy link
Contributor

@thibsy thibsy left a comment

Choose a reason for hiding this comment

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

Hi @nhaagen,

I was curious about the integration mechanism here, so I briefly looked over the changes. I have some questions in addition to @klees' review - could you answer them as well?

  • why do contributors of cron job instances need to prepend components\ to the component class name? Is this important or just an aesthetic? Would it make sense to centralise this?
  • I was having an issue with ILIAS\Language\Language::loadLanguageModule() calls inside the constructor of classes during the migration of the UI framework initialisation (#7969). Did you not run into the same issue here?
  • why are you using a "mock" instance of ILIAS\Language\Language inside the new cron objectives? Isn't there a dedicated implementation for the setup available?

Thx for your time!

kind regards,
@thibsy

@nhaagen nhaagen force-pushed the 11/CronJob/Seeker branch 3 times, most recently from ff9253e to 6b57615 Compare January 3, 2025 11:02
@mjansenDatabay mjansenDatabay added improvement php Pull requests that update Php code labels Jan 21, 2025
@nhaagen
Copy link
Contributor Author

nhaagen commented Feb 5, 2025

Hi @thibsy and @klees ,
sorry for the late response; I think, I addressed all issues.

CronJob is now constructed with Language and LoggerFactory; further initiallization can be done within ::init().
Language is no longer a Mock in the objective, and I removed the metrics altogether.

helo_world is just a fix - the filename has changed.

Looking forward to the next round,
best regards

@klees klees changed the title Component/Cron: init cron jobs via SetupAgent and Component's seek Component/Cron: init cron jobs via Component's seek Feb 5, 2025
@klees klees assigned mjansenDatabay and unassigned klees Feb 5, 2025
@klees
Copy link
Contributor

klees commented Feb 5, 2025

Hi @mjansenDatabay,

this moves the cronjobs to the new integration mechanisms of the Component Revision. If there's anything we can do to help moving this forward (e.g. have a call to answer questions) feel free to ping me.

Kind regards!

@klees
Copy link
Contributor

klees commented Feb 5, 2025

I just realized that this needs rebasing due to introduction of namespaces in ILIAS\Cron.

@mjansenDatabay May I propose that you look into this and give feedback before rebasing and we only rebase shortly before merge?

@mjansenDatabay
Copy link
Contributor

HI @klees ,

first, thanks for the PR @nhaagen and @klees !

I will put this on my stack and review it soon. I can't guarantee that it will be done by Friday, but I should get to it next week at the latest.

Once I've reviewed the relevant things in “Cron” (+ a few spot checks in “my” consuming components) and “cli” it would probably make sense for the relevant authorities to look at their components too, right?

Best regards,
Michael

@klees
Copy link
Contributor

klees commented Feb 6, 2025

Hi @mjansenDatabay,

no need to hurry, this is a marathon, not a sprint =)

Changes in the various components are editorial from my POV, so I think we could use the "announce on JF and wait some time before merge" procedure.

Kind regards!

@mjansenDatabay
Copy link
Contributor

mjansenDatabay commented Feb 14, 2025

Unfortunately, I still need a little more time, because this week too much of my working time was taken up with analyzing problems with ILIAS 9 upgrades of customer installations.

@klees
Copy link
Contributor

klees commented Feb 14, 2025

Hi @mjansenDatabay,

no need to rush here.

Thanks for the feedback!

Copy link
Contributor

@mjansenDatabay mjansenDatabay left a comment

Choose a reason for hiding this comment

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

Hi all,

first, thanks @nhaagen and @klees for providing the PR.

I reviewed the changes in "my" components (Auth, Certificate, Cron, Forum, LDAP, Mail) and the cron.php, and they LGTM. I only have a few remarks regarding the "Cron" component.

Please answer the following questions:

  • Do we really need to change the internals of ilCronJobEntities? I agree that this is discussable, but if we want to change this, it should be put into another PR.

Please implement the following changes:

  • Remove all added @inheritdoc comments in the "Cron" component.
  • Make the jobs member variable in \ILIAS\Cron\CronRegistry "readonly".
  • Make the registry member variable in \ilCronJobSetupAgent "readonly".
  • Fix the undeclared property $this->cronjobs in \ilCronjobsRegisteredObjective::achieve.
  • Fix the undeclared property $this->cronjobs in \ilCronJobSetupAgent::getNamedObjectives.
  • For the sake of consistency, unregisterAllJobs in \ilCronJobRepositoryImpl` should be also moved to the interface.

One last thing: For me it is okay to use TRUNCATE in \ilCronJobRepositoryImpl::unregisterAllJobs, because it seems to be only executed in the setup context. TRUNCATE is a DDL statement and requires other permissions than a DELETE, although they are very similar. We have to be careful when introducing DDL statements to maintain the "Principle of Least Privilege".

Best regards,
Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants