I've always setup my shells to call a Controller Function.
This way I can do all the testing on my shell by calling the
controller function from the browser.

The only thing you put in your shell function is a call to the
Controller function.

Setting things up this way makes it possible to add a controller
function to your cron schedule for background tasks etc.

Setting this up takes a little more work as the Controller will not
have been created yet.

As an example one of my shells is called notify and it sends emails
based on state changes inside a controller. This is scheduled to be
called by the cron system via the shell command once an hour.
Alternately I can call the controller function via a web browser
anytime to force the notification or to see if anythings qualifies for
the state change.

In the shell you need to create and bind your controller and models
the traditional way with php in the shells initialize function. You'll
note in the shell function send() all I do is call the controller
function ProfileController->notify() to do the work. This notify
function is the same function I can call from my browser.
There is a variable that is set in the cake app object I believe which
can indicate weather the call is from the shell. This might be useful
for you in your controller to determine which layout to use.

        function initialize() {
                //$this->Controller =& new Controller();
                //$this->Component =& new Component();
               $this->ProfileController =& new ProfilesController();
                $this->ProfileController->uses = array('Profile','User');
                $this->ProfileController->Profile =& new Profile();
                $this->ProfileController->Project =& new Project();
                $this->ProfileController->Email =& new EmailComponent();
                $this->ProfileController->Email->initialize($this-
>ProfileController);
                $this->_loadModels();
    }

        function send(){
                $this->ProfileController->notify();
        }

good luck.

On Dec 22, 8:52 am, Laran Evans <[email protected]> wrote:
> I've read oodles of documentation, I can't find anything anywhere that
> covers how to use xdebug to debug PHP CLI scripts, let alone with
> those written as Cake shells.
>
> This is a huge issue for me right now. Can anyone shed some light on
> this? Thanks.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to