Open wqsaali opened 7 years ago
I haven't used CodeIgniter since late version 2.x, so I don't know how it works now. When I was using it, though, I had a CLI-only route set up that would set up the environment variables and include(FCPATH . '/vendor/bin/resque')
, thus ensuring I had access to the framework from within my jobs, since the framework had started the worker(s). (You can also use the APP_INCLUDE
environment variable to include()
any file you like to do this, but that doesn't seem to work as well for this.)
One thing to keep in mind is that each job is run in a forked process, so you'll need to reconnect to your DB manually when the job starts (or, more accurately, sometime between job start and the first DB interaction). The same goes for pretty much any other PHP resource-type value.
Hey from me and @rabnawazPikesSoft
How i can access database in perform() method of Job class in codeignitor? I have implemented it and it is working but i want to do some sort of updation in perform() method. Is there any way to do this?