In the Kohana index.php file, there's a clause I have two questions about:

if (PHP_SAPI == 'cli') // Try and load minion
{
class_exists('Minion_Task') OR die('Please enable the Minion module for CLI support.');
set_exception_handler(array('Minion_Exception', 'handler'));

Minion_Task::factory(Minion_CLI::options())->execute();
}
else
{
/**
 * Execute the main request. A source of the URI can be passed, eg:  $_SERVER['PATH_INFO'].
 * If no source is specified, the URI will be automatically detected.
 */
echo Request::factory(TRUE, array(), FALSE)
    ->execute()
    ->send_headers(TRUE)
    ->body();
}

1) what is a minion? 2) what does the following mean?

->foo()
->bar()
->...etx

is that just method chaining?

有帮助吗?

解决方案

1) In the first part of that code, Kohana is checking to see if your script is running from command line (CLI). If so, it tries to execute a task using Minion.

Minion is a framework for running tasks via the CLI.

See: https://github.com/kohana/minion

And: http://kohanaframework.org/3.3/guide/minion/

2) And yes that is method chaining that you are seeing in the second part of the code. It could just as easily be rewritten as:

$request = Request::factory(TRUE, array(), FALSE);
$response = $request->execute();
$response->send_headers(TRUE);
echo $response->body();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top