Pergunta

I am currently executing a programmed task calling directly to a Controller action by URL. (using the windows 2003 server programming task manager)

I've seen some people use the CakePHP console or shell for this kind of operations.

Which is the advantage of using it if any?

My action is currently calling multiple controllers and making use of a vendor library.

Thanks.

Foi útil?

Solução

Here are a few reasons that come to mind:

  • A shell isn't publicly accessible, where a url (generally) is
  • A shell doesn't hit your webserver
  • The shell dispatch process has less overhead
  • Shell output is easier to log error vs. output

I could go into separation of concerns, but that's usually opinion-driven. I think the first two points are reason enough.

Outras dicas

Some disadvantages of a web script I can think of are:

  • the execution time is limited by the webserver
  • the memory it can consume is limited by the webserver
  • the script URL has to be protected in order to get executed only when YOU want
  • obviously the webserver has to be up and running when you want to call your script
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top