Skip to content

Instantly share code, notes, and snippets.

@paulwsmith
Created September 24, 2015 02:58
Show Gist options
  • Save paulwsmith/5b30399d906a3420901a to your computer and use it in GitHub Desktop.
Save paulwsmith/5b30399d906a3420901a to your computer and use it in GitHub Desktop.
<?php
/**
* CakePHP 2.x -- add this code to a controller and then access the controller's route from the browser.
* This allows you to trigger shells through the browser, so that you can use xdebug if it cannot be accessed
* through the command line
*/
App::uses('ShellDispatcher', 'Console');
public function index() {
$argv = array(
'Queue.Queue',
'runworker',
'--group',
'some_group'
);
$dispatcher = new ShellDispatcher($argv, false); // false prevents bootstrap code from running
return ($dispatcher->dispatch() === false ? 1 : 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment