G
G
Gluck Virtualen2020-05-08 15:55:23
CodeIgniter
Gluck Virtualen, 2020-05-08 15:55:23

How to access a method in a controller from the CLI?

We have an old legacy project on codeigniter 3.
We have a new task, where cron should be used for the first time in the life of the project.

The cron itself is fine, but it’s impossible to reach the desired method of the desired controller.
Googling among the garbage brought this: https://codeigniter3.ru/guide/general/cli
But in their example, the configuration option with index.php is used, and in this project, index.php is not used. Accordingly, the method specified in the documentation does not work.

The conclusion is:

Fatal error: Class 'имя-класса' not found in /var/www/'путь-к-контроллеру'.php on line 4

line 4 actually requires "class-name":

class cron extends имя-класса {

And where do I get it class-name? Autoload doesn't happen from CLI...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Shamanov, 2020-05-08
@SilenceOfWinter

Autoload doesn't happen from CLI...

:)
codeigniter.com/userguide3/general/cli.html

I
Igor Buksha, 2020-05-08
@ripdamage

To remove index.php from the call.
What prevents before

class cron extends class-name {

add ? The simplest thing you can do on this framework
include '/path/to/file/with/class.php'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question