Skip to content

Commit

Permalink
Merge branch '3.1/develop' into 3.2/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
acoulton committed Sep 1, 2011
2 parents 1de85d0 + 3a61b50 commit 4f5a003
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions classes/andrewc/controller/slowtask.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function action_progress()
}

// Render the result back to the client
$this->request->headers['Content-type'] = 'application/json';
$this->request->response = $status->as_json();
$this->response->headers('Content-type', 'application/json');
$this->response->body($status->as_json());
}

public function action_abort()
Expand All @@ -37,8 +37,8 @@ public function action_abort()
SlowTask::abort($id);
$status = SlowTask::query_status($id);

$this->request->headers['Content-type'] = 'application/json';
$this->request->response = $status->as_json();
$this->response->headers('Content-type','application/json');
$this->response->body($status->as_json());
}

public function action_complete_file()
Expand All @@ -48,7 +48,7 @@ public function action_complete_file()

if ($status->complete instanceof SlowTask_Complete_SendFile)
{
$status->complete->send_file($this->request);
$status->complete->send_file($this->response);
}
}
}
16 changes: 8 additions & 8 deletions classes/andrewc/slowtask.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public static function is_parent_thread()
* [!!] Also note that, to prevent deadlocking on native sessions, you also cannot write to the session
* following this call.
*
* @param Request $request The request that will be completed and receive the progress bar
* @param Response $response The response that will be completed and receive the progress bar
* @param string $status_text The initial status message for the task
* @param array $instance_config Any specific config to be merged with slowtask.instance
* @return SlowTask
*/
public static function begin(Request $request, $status_text, $instance_config = array())
public static function begin(Response $response, $status_text, $instance_config = array())
{
$config = Kohana::$config->load('slowtask.instance');
SlowTask::$_parent_thread = true;
Expand All @@ -64,13 +64,13 @@ public static function begin(Request $request, $status_text, $instance_config =
$task = new SlowTask($status_text, array_merge($config,$instance_config));

// Render the progress view as the body of the passed in request
$request->response = $task->status()->as_html();
$request->headers['Content-Length'] = strlen($request->response);
$request->headers['Connection'] = 'close';
$request->send_headers();
$response->body($task->status()->as_html());
$response->headers('Content-Length',$response->content_length());
$response->headers('Connection','close');
$response->send_headers();

//@todo: Is there a better way to avoid running this code in PHPUnit?
if ( ! ($request instanceof SlowTask_Test_Request_Mock))
if ( ! ($response instanceof SlowTask_Test_Response_Mock))
{
// Get ready for the long haul
set_time_limit(0);
Expand All @@ -82,7 +82,7 @@ public static function begin(Request $request, $status_text, $instance_config =
apache_setenv('no-gzip',1);
}

echo $request->response;
echo $response->body();

while (ob_get_level())
{
Expand Down
4 changes: 2 additions & 2 deletions classes/andrewc/slowtask/complete/sendfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public function unlink_on_complete($unlink = null)
return $this;
}

public function send_file(Request $request)
public function send_file(Response $response)
{
$request->send_file($this->_file, false, array(
$response->send_file($this->_file, false, array(
'delete'=>$this->_unlink_on_complete
));
}
Expand Down

0 comments on commit 4f5a003

Please sign in to comment.