[4.0] poor man’s cron#25022
Conversation
|
Thanks very much for this PR |
|
The PHP notice on CLI mentioned in one of my comments above seems really to be an error in the IpHelper. It doesn't check if the array key 'REMOTE_ADDR' exists before checking it in line 488. So this seems not to be a mistake in this PR here. |
|
IMO, changes do not belong in |
|
@SharkyKZ Which ones you mean? The "1918" to "1970" date correction I've suggested above? If you mean that, let me know where else to change them. Or do you mean the PHP notice in CLI? This should already be solved in the utilities package with your PR joomla-framework/utilities#23, I have to check if it has been merged into the 2.0-dev branch there. If so, we maybe just have to update the utilities package in the cms. Update: The "1918" date correction I've suggested above changes something which will be added to the plugin helper class by this PR here. So if it is wrong to add something there then this PR does it wrong (what I don't believe right now). Update 2: I just saw the changes in joomla-framework/utilities#23 haven't been merged up yet to the 2.0-dev branch of the utilities package. |
|
I mean any code added to |
|
I'm also not sure how correct is the use of |
|
@SharkyKZ Well I can't say if it's right to add code there or not, but that was then done by this PR and not by my suggested changes. Regarding the "abuse" of the checked out time column: Yes, I agree, it looks a bit like a hack to me. But I could live with that. |
[4.0] Fixes for poor man’s cron
|
Corrected path to logs folder in description. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25022. |
|
@alikon So, now I've tested again, and it works for me as described (web, webcron and cli). What remains to be clarified is the architectural question raised by @SharkyKZ if the I'll wait for some info before I mark my test result with success. Maybe there will be some changes. Just ping me when all is ok or when I shall test again. Now that I know how it works I can do it more quickly. |
|
i'm open to hear all the feedback, and i'm really happy that we have some feedback now
yes it seems like an hack, but my goal was that, i didn't want to add another column,
i'm open to listen a better way to do it |
|
let's give this a nth attempt |
|
I have tested this:
Testing web
Testing webcron
Testing cli/cron
The output of the log file: |
|
I have tested this item ✅ successfully on 4d0589f This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25022. |
|
thanks for testing |
|
@alikon Meanwhile joomla-framework/utilities#23 is available in the 2.0-dev branch of the framework package, too, so yes, the package can be fetched to J4. 2 weeks ago that wasn't the case yet, there it was only in the master branch there. |
|
Merged in the utilities update to 4.0-dev. I haven't taken any time to look through this yet - to be honest there's nothing in here b/c breaking so I'm not going to prioritise this either over the other beta blocking issues - if it has to go to 4.1 - it is what it is. But I will try and do an initial review as well over the next few days and give some opinions. |
|
Export database job plugin: This job plugin aims to export the entire database (zip archive) to the defined joomla tmp directory / sub-directory at a defined frequency. |
|
I have tested this item ✅ successfully on 4d0589f This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25022. |
|
redone in #29592 |






porting #22310 to 4.x
Goal
a way to run scheduled "quick" tasks in approximately regular intervals
Summary of Changes
How it works
In a normal hosting situation that would be job for cron, but if your hosting doesn’t offer cron, then a common solution in these cases is “poor man’s cron:” on every page load (
onAfterRespond) the scheduler system plugin check if itself is expected to run and then trigger a new eventonExecuteScheduledTaskthen any job plugin wich listen to that event check if itself is expected to run and if so execute his task.Testing Instructions (web)
for test only
Frequency (in minutes) set = 0 mean run every (
onAfterRespond)install these 2 silly job plugin:
plg_job_one.zip
plg_job_two.zip
job one simply sleep for 1 seconds
job two simply sleep for 3 seconds
set options, publish the plugin and save plugin ONE
Frequency (in unit) set 1
Unit of time set minute
means that this plugin run 1xminute = every minute
if
onExecuteScheduledTaskhas been triggeredmaybe use different settings than ONE
Expected result
depending on your (plugins) settings
take a coffe/smoke/whatever 😄
randomly click a couple of frontend pages
check the log file at
yoursite/administrator/logs/joomla_web.phpyou'll see something like this
1st run
the scheduler plugin (wich runs always frequency=0) trigger the
onExecuteScheduledTaskeventso plugin ONE and plugin TWO are executed (cause no previous run)
2nd run
the scheduler plugin (wich runs always frequency=0) trigger the
onExecuteScheduledTaskeventbut this time both plugin have an expected scheduled time (for example ONE each 1min TWO each 5min)
the 2nd run was at 17:24:47+00:00
the 1st run was at 17:24:43+00:00
they have only 4 seconds of difference form the previous execution so both plugin are not expected to run
3rd run
it depends on how fast you click & settings
Testing Instructions (webcron)
on scheduler system plugin
set Webcron to yes/enable
set Key to mywebcronactivationkey
then use
yoursiteurl/index.php?webcronkey=mywebcronactivationkeyas the url for webcron services to be triggredTesting Instructions (cli/cron)
Go to the cli folder of your website and run

php joomla.php job:runcheck the log file at yoursite/administrator/logs/joomla_cli.php
Actual result
N/A
Additional comments
it can be used for tasks like:
Documentation Changes Required
yes