Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kohana 3.3 compatibility #2

Open
wants to merge 1 commit into
base: 3.3/develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified README.md
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion classes/minion/example.php → classes/Task/Worker/Example.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @extends Minion_Daemon
*/
class Minion_Task_Worker_Example extends Minion_Daemon {
class Task_Worker_Example extends Minion_Daemon {

/**
* @var array Minion config options. Merged with Minion_Daemon options
Expand Down
16 changes: 8 additions & 8 deletions classes/kohana/minion/daemon.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ abstract class Kohana_Minion_Daemon extends Minion_Task {
* @access protected
*/
protected $_daemon_config = array(
"fork",
"pid",
"fork" => NULL,
"pid" => NULL
);

/**
Expand All @@ -71,7 +71,6 @@ abstract class Kohana_Minion_Daemon extends Minion_Task {
*/
protected $_log_writers = array();


/**
* Sets up the daemon task
*
Expand All @@ -81,10 +80,13 @@ abstract class Kohana_Minion_Daemon extends Minion_Task {
public function __construct()
{
// No time limit on minion daemon tasks
set_time_limit(0);
set_time_limit(0);

// Attach logger. By default, this is the Minion logger.
$this->_logger = (class_exists("Minion_Log")) ? Minion_Log::instance() : Kohana::$log;
$this->_options = Arr::merge($this->_daemon_config, $this->_config);

$this->_accepted_options = array_keys($this->_options);

// Attach the standard Kohana log file as an output.
$log_path = Kohana::$config->load('minion-daemon')->logpath;
Expand All @@ -93,9 +95,6 @@ public function __construct()
// Attach stdout log as an output. Write to it on add
$this->_logger->attach($this->_log_writers['stdout'] = new Log_StdOut, array(), 0, TRUE);

// Merge configs
$this->_config = Arr::merge($this->_daemon_config, $this->_config);

if ( ! function_exists('pcntl_signal_dispatch'))
{
// PHP < 5.3 uses ticks to handle signals instead of pcntl_signal_dispatch
Expand Down Expand Up @@ -210,7 +209,7 @@ protected function _setup_pid(array $config)
* @param boolean $exit Exit() on completion?
* @return void
*/
public function execute(array $config, $exit = TRUE)
protected function _execute(array $config, $exit = TRUE)
{
// Should we fork this daemon?
if (array_key_exists('fork', $config) AND $config['fork'] == TRUE)
Expand Down Expand Up @@ -268,6 +267,7 @@ public function execute(array $config, $exit = TRUE)
if ($this->_terminate OR $result === FALSE)
break;

Minion_CLI::write($iterations);
// Do we need to do any cleanup?
if ($iterations == $this->_cleanup_iterations)
{
Expand Down
3 changes: 1 addition & 2 deletions classes/minion/daemon.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<?php defined('SYSPATH') OR die('No direct script access.');

abstract class Minion_Daemon extends Kohana_Minion_Daemon {}
class Minion_Daemon extends Kohana_Minion_Daemon {}
Empty file modified config/minion-daemon.php
100644 → 100755
Empty file.
Loading