Cronjob outputs welcome message [SOLVED] |
(12-26-2016, 04:41 AM)Wouter60 Wrote: I've found a workaround, which involves modifying the is_cli() function inside the system/core/Common.php file: perhaps not so elegant, but you can write that in the cron controller as `my_is_cli()` and call it in the construct. That will, at least, not cause problems when updating the system dir. Glad there's progress. Quote:perhaps not so elegant, but you can write that in the cron controller as `my_is_cli()` and call it in the construct.Problem is that the cronjob won't load my cron controller unless CI knows it's a CLI request in an earlier stage. Besides that, the session library calls the is_cli() function. Is it possible to load my own is_cli() function before the one in system/core/common.php is loaded?
It's in system/core/Common.php around line 373 (in CI 3.1,2)
You should be able to overload the system file like: Create application/core/MY_Common.php then just write the functions you need. PHP Code: /** I don't think you need the if statement: PHP Code: if ( ! function_exists('is_cli')) I've never overwritten the Common.php file before, and it's a little different than Controller/Config/etc which are actual classes, so I'm not 100% this will work.
Finally found a working solution without changing the core/Common.php file.
I added my own is_cli() function to application/config/constants.php Maybe it's not the most elegant solution, but I found in core/Codeigniter.php that the constants.php file is loaded right before Common.php. |
Welcome Guest, Not a member yet? Register Sign In |