I am trying to run the code from the CLI, as indicated in the CI documentation, but for some reason, perhaps due to the use of the HMVC extension, it will not go into the specified controller.
I did not find any additional documentation on running the CLI on the HMVC extension site.
Does anyone know how to handle this?
The code is here:
class Cron extends MX_Controller { public function generatepdfs($start_date = null, $end_date = null) { echo 'Not reached'; exit; $this->load->module('facturation/documentscontroller'); $this->documentoscontroller->generatepdfs($start_date, $end_date); } }
Regardless of whether I run this from the root of the document:
php index.php cron generatepdfs
or that:
/usr/bin/php -f /home/user/public_html/index.php cron generatepdfs
It will not display "Not reached."
This happens if I run it from a browser.
Here are some of the errors displayed on the console:
Unable to find the specified class: Session.php
I have an overridden MY_Session session library in the / libraries / session / MY _Session.php application that works fine in the browser. If I translate this file into one directory up, this error will not be displayed again in the console, but it will not work in the browser. By the way, this is autoload.
I don't like the workaround for this at all: copy the same file in both places.
The following error:
PHP Fatal error: class 'CI_Preferencias' not found in / home / mysite / public _html / system / core / Common.php on line 196
I have a custom library called Preferencias, which also loads automatically in application / libraries / Preferencias.php
Again, this works fine in the browser. However, from the CLI, it seems to be looking for the CI_Preferencias library, which does not exist. If I rename it to CI_Preferencias and automatically load "CI_Preferencias", CI will look for a class named CI_CI_Preferencias from the CLI.
I'm not sure if I missed something, or there is a real error in CI, or the HMVC module is messing with it.
Can anyone help me? This drives me crazy, since I have to use the CLI actions planned on cronjobs and I feel completely lost.