Re: Re: [fw-general] Best to use CLI in my ZF 1.9 Application
I'll take a look and see if I can put together anything generic enough to be useful. I'd hope that generally, CLI scripts would use models rather than calling anything in the controller, and generally, the ACL stuff would all be in the controller. But that's just the way I do it, I guess having the auth stuff in the model is a valid way to approach it. M swilhelm wrote: > > The issue I have had in the past is when a CLI is trying to leverage an > admin module that uses the standard Auth / ACL logic. It expects a login > process to populate some username and password information that get passed > to the Auth code. > > It would be nice to see the "best practice" for having an admin module > provide behavior to both a Web-based UI as well as the CLI scripts. > > - Steve W. > > > lightflowmark wrote: >> >> OK, I can certainly look at that. >> >> Generally, you'd set the file permissions on the script so it can only be >> run by the specified user(s) - so, for instance: >> shell# chown admin_user:admin_group myScript.php >> shell# chmod 744 myScript.php >> shell # ls -al >> -rwxr--r-- 1 admin_user admin_group 3212 Apr 17 1999 myScript.php >> >> (can only be executed by the admin_user user) >> >> Is this not possible in your setup for some reason? I'm not very >> familiar with shared hosting setups, so is there something that would >> prevent you doing this? >> >> Thanks for the input, >> Mark >> >> >> >> >> swilhelm wrote: >>> >>> should optionally require admin credentials passed as arguments or >>> should confirm CLI is being run by particular system users (e.g. root). >>> >> >> > > -- View this message in context: http://www.nabble.com/Best-to-use-CLI-in-my-ZF-1.9-Application-tp25045676p25241061.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: Re: [fw-general] Best to use CLI in my ZF 1.9 Application
The issue I have had in the past is when a CLI is trying to leverage an admin module that uses the standard Auth / ACL logic. It expects a login process to populate some username and password information that get passed to the Auth code. It would be nice to see the "best practice" for having an admin module provide behavior to both a Web-based UI as well as the CLI scripts. - Steve W. lightflowmark wrote: > > OK, I can certainly look at that. > > Generally, you'd set the file permissions on the script so it can only be > run by the specified user(s) - so, for instance: > shell# chown admin_user:admin_group myScript.php > shell# chmod 744 myScript.php > shell # ls -al > -rwxr--r-- 1 admin_user admin_group 3212 Apr 17 1999 myScript.php > > (can only be executed by the admin_user user) > > Is this not possible in your setup for some reason? I'm not very familiar > with shared hosting setups, so is there something that would prevent you > doing this? > > Thanks for the input, > Mark > > > > > swilhelm wrote: >> >> should optionally require admin credentials passed as arguments or should >> confirm CLI is being run by particular system users (e.g. root). >> > > -- View this message in context: http://www.nabble.com/Best-to-use-CLI-in-my-ZF-1.9-Application-tp25045676p25240779.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: Re: [fw-general] Best to use CLI in my ZF 1.9 Application
OK, I can certainly look at that. Generally, you'd set the file permissions on the script so it can only be run by the specified user(s) - so, for instance: shell# chown admin_user:admin_group myScript.php shell# chmod 744 myScript.php shell # ls -al -rwxr--r-- 1 admin_user admin_group 3212 Apr 17 1999 myScript.php (can only be executed by the admin_user user) Is this not possible in your setup for some reason? I'm not very familiar with shared hosting setups, so is there something that would prevent you doing this? Thanks for the input, Mark swilhelm wrote: > > should optionally require admin credentials passed as arguments or should > confirm CLI is being run by particular system users (e.g. root). > -- View this message in context: http://www.nabble.com/Best-to-use-CLI-in-my-ZF-1.9-Application-tp25045676p25236295.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: Re: [fw-general] Best to use CLI in my ZF 1.9 Application
should optionally require admin credentials passed as arguments or should confirm CLI is being run by particular system users (e.g. root). lightflowmark wrote: > > I'm actually working on a proposal to do exactly this at the moment. > > What features would people like to see on this? > > Currently, the proposed Zend_Schedule component will: > 1) be run via CLI scripts from the cron > > 2)uses Zend_Application to load the bootstrap of an existing > application to load config, include paths, etc. > > 3)load user-written classes which define tasks - e.g. mailTasks, > databaseTasks, etc. > > 4)run functions from those classes based on a prefix - e.g. you might > have a script running every day which runs all functions prefixed 'daily', > which would run mailTasks::daily_Emails(), > databaseTasks::daily_DoArchiving(), etc. and another script running every > hour which would run all functions prefixes 'hourly' > > It's actually very simple to implement as outlined, and I'd be interested > to see what other features people would want from this. > > Yours, > Mark > > > > > Raphael Stolt-2 wrote: >> >> Hi Stefan, >> >> >> >> >> You might also take a look at Zend_Tool_Project_Providers which allow you >> to >> create custom providers which handle the scenarios you described in the >> first mail. Plus by hooking them into the Zend Tool environment you can >> call >> them as desired via CLI. >> >> Hope that helps a bit. >> >> Cheers, >> >> Raphael Stolt >> >> 2009/8/20 Stefan Sturm >> >>> Hello, >>> >>> I found this tutorial to setup a cli enviroment: >>> >>> http://webfractor.wordpress.com/2008/08/14/using-zend-framework-from-the-command-line/ >>> >>> But I would like to use Zend_Application to handle this... >>> >>> Perhaps somebody can help me on this. >>> >>> Thanks and greetings, >>> Stefan Sturm >>> >> >> > > -- View this message in context: http://www.nabble.com/Best-to-use-CLI-in-my-ZF-1.9-Application-tp25045676p25230433.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: Re: [fw-general] Best to use CLI in my ZF 1.9 Application
Hello, > > I'm actually working on a proposal to do exactly this at the moment. > > What features would people like to see on this? > > Currently, the proposed Zend_Schedule component will: > 1) be run via CLI scripts from the cron > > 2) uses Zend_Application to load the bootstrap of an existing application > to load config, include paths, etc. > > 3) load user-written classes which define tasks - e.g. mailTasks, > databaseTasks, etc. > > 4) run functions from those classes based on a prefix - e.g. you might > have a script running every day which runs all functions prefixed 'daily', > which would run mailTasks::daily_Emails(), > databaseTasks::daily_DoArchiving(), etc. and another script running every > hour which would run all functions prefixes 'hourly' > > It's actually very simple to implement as outlined, and I'd be interested to > see what other features people would want from this. > this sounds great. Where can I read more about it? Greetings, Stefan Sturm
Re: Re: [fw-general] Best to use CLI in my ZF 1.9 Application
I'm actually working on a proposal to do exactly this at the moment. What features would people like to see on this? Currently, the proposed Zend_Schedule component will: 1) be run via CLI scripts from the cron 2)uses Zend_Application to load the bootstrap of an existing application to load config, include paths, etc. 3)load user-written classes which define tasks - e.g. mailTasks, databaseTasks, etc. 4)run functions from those classes based on a prefix - e.g. you might have a script running every day which runs all functions prefixed 'daily', which would run mailTasks::daily_Emails(), databaseTasks::daily_DoArchiving(), etc. and another script running every hour which would run all functions prefixes 'hourly' It's actually very simple to implement as outlined, and I'd be interested to see what other features people would want from this. Yours, Mark Raphael Stolt-2 wrote: > > Hi Stefan, > > > > > You might also take a look at Zend_Tool_Project_Providers which allow you > to > create custom providers which handle the scenarios you described in the > first mail. Plus by hooking them into the Zend Tool environment you can > call > them as desired via CLI. > > Hope that helps a bit. > > Cheers, > > Raphael Stolt > > 2009/8/20 Stefan Sturm > >> Hello, >> >> I found this tutorial to setup a cli enviroment: >> >> http://webfractor.wordpress.com/2008/08/14/using-zend-framework-from-the-command-line/ >> >> But I would like to use Zend_Application to handle this... >> >> Perhaps somebody can help me on this. >> >> Thanks and greetings, >> Stefan Sturm >> > > -- View this message in context: http://www.nabble.com/Best-to-use-CLI-in-my-ZF-1.9-Application-tp25045676p25112901.html Sent from the Zend Framework mailing list archive at Nabble.com.