Hi,
I have the following lines (amongst others) in my config file for making a cronjob:
module: marktwacht
callback: marktwacht_check_opdracht
callback arguments: array('84','84')
pass job argument: TRUE
and the following function:
function marktwacht_check_opdracht($job, $args) {
...
}
When i run the cronjob I get the following error:
Too few arguments to function marktwacht_check_opdracht(), 1 passed and exactly 2 expected.
as you can see ive specified to pass the job argument and an extra argument (array). But for some reason it is not passed.
What am i doing wrong?
Kind regards,
Mark
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | ultimate_cron-callback-arguments-2909191-20.patch | 13.75 KB | johnle |
| #19 | ultimate_cron-callback-arguments-2909191-19.patch | 22.8 KB | johnle |
| #13 | ultimate_cron-callback-arguments-2909191-13.patch | 13.21 KB | e.bogatyrev |
Issue fork ultimate_cron-2909191
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
Mark aka Dark commentedComment #3
umed91 commented@mark were you able to get this working?
Comment #4
murz@Mark can you describe where did you set
callback arguments? I can't see such parameter inconfig/schema/ultimate_cron.schema.ymlfile.Comment #5
e.bogatyrevHi everyone,
Please review the patch.
I suggest to use callback arguments as a string with line ending separation in the Cron Job configuration form since we don't actually know the final amount of them. It depends on the particular implementation of each callback. Then this string will be parsed, split to arguments and passed to callback.
Comment #8
e.bogatyrevComment #9
e.bogatyrevComment #10
nikolabintev commentedI just set it up on a project and it works well. I believe that this is e must-have feature.
Comment #11
nikolabintev commentedComment #12
berdirThis has a few conflicts. I have some concerns about the argument structure, XSS filtering doesn't seem relevant here as it's not displayed.
The schema talks about comma separated values, but according to tests and code, it's really line breaks.
What about storing arguments as a sequence, then only the form needs to process them into an array and runtime can just pass it through directly as an array?
Comment #13
e.bogatyrevHi @berdir,
Thanks for findings, they make sense.
Please take a look and review updated patch or MR
Comment #14
berdir> What about storing arguments as a sequence, then only the form needs to process them into an array and runtime can just pass it through directly as an array?
This hasn't been addressed yet.
To be honest, I'm not sure this should even be exposed in the UI. We don't allow to set/change the callback, also for security reasons, so this should just display the arguments as well.
Comment #16
lisotton commentedI changed to use a sequence instead of a string and changed the form to show the arguments as read-only, like it is done for the callback.
I agree that there is no point to allow change the parameters, if the callback is not allowed to be changed from the UI.
Comment #17
ronaldmulero commentedMR !40 diff works for me using ultimate_cron 8.x-2.0-beta1
Thanks @lisotton!
Comment #18
lisotton commentedChanging to RTBC as per @ronaldmulero comment.
Comment #19
johnle commentedPosting the latest patch from the latest MR posted using ultimate_cron 8.x-2.0-beta1.
Comment #20
johnle commentedSorry, that patch was incorrect, here is the correct one created directly from the diff in that MR.
Comment #21
liam morland