Re: Connecting to the database directly and cron jobs

2006-06-24 Thread Langdon Stevenson

Thanks for all of the feedback.  This should solve my problems.

Regards,
Langdon



RosSoft wrote:
> Also check
> http://groups.google.es/group/cake-php/browse_thread/thread/ff3ad3c9e1e40aab/522fa7b6d6c2c20c?q=cron&rnum=2#522fa7b6d6c2c20c

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Connecting to the database directly and cron jobs

2006-06-24 Thread RosSoft

Also check
http://groups.google.es/group/cake-php/browse_thread/thread/ff3ad3c9e1e40aab/522fa7b6d6c2c20c?q=cron&rnum=2#522fa7b6d6c2c20c


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Connecting to the database directly and cron jobs

2006-06-24 Thread RosSoft

Other approach is something like:
http://rossoft.wordpress.com/2006/03/27/poor-mans-cron-component/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Connecting to the database directly and cron jobs

2006-06-24 Thread Matt

It seems that Rails too, and perhaps MVC frameworks in general, have
similiar issues with cron jobs:

http://www.rubyinside.com/rails-cron-a-way-to-run-background-tasks-with-your-rails-app-53.htm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Connecting to the database directly and cron jobs

2006-06-24 Thread Langdon Stevenson

I too will soon be requiring this sort of functionality.  I would also 
value a definitive answer to the question.

Regards,
Langdon

Matt wrote:
> I've recently started porting a site to CakePHP and have a couple of
> questions regarding cron jobs.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Connecting to the database directly and cron jobs

2006-06-23 Thread RosSoft

Do a cron job calling wget
http://yourdomain/mail_system/index/SECRET_KEY

it will execute the mailsystemcontroller, index action and only will do
something if the SECRET_KET is ok


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Connecting to the database directly and cron jobs

2006-06-23 Thread BlenderStyle

What version of PHP are you using? Can you post mail_system.php?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Connecting to the database directly and cron jobs

2006-06-23 Thread Matt

Well I've converted the class into a component and got it talking to
the database fine using a model but it doesn't look like it's going to
be so easy getting cron to work.

I tried executing the class from the command line, which is what cron
would do, and got the error:

PHP Fatal error:  Class mailsystemcomponent:  Cannot inherit from
undefined class object in
...\app\controllers\components\mail_system.php on line 13

So the problem is when calling components from cron it doesn't know
where the CakePHP classes required by the component are.

Hopefully it's just a case of changing the include paths in the PHP
script.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Connecting to the database directly and cron jobs

2006-06-23 Thread BlenderStyle

That's an interesting problem and I'm bound to run into on my own soon.
Check simple things like the permissions of the script you're trying to
execute with php. Do chmod 777 script.php to test that. I would also
try creating your class as a controller in CakePHP with a model and a
view. The view wouldn't have to be html, of course, and this would
allow you to execute it using Cake's database connection.

Let us know what you find out or what you do to get it working.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Connecting to the database directly and cron jobs

2006-06-23 Thread Matt

I've recently started porting a site to CakePHP and have a couple of
questions regarding cron jobs.

The site had a class for managing emails that would connect to the
database and add messages to a queue table. A cron job calling a PHP
script would use this class to dispatch messages at regular intervals.
Pretty much what the Pear module Mail_Queue does:
http://pear.php.net/package/Mail_Queue

Now wasn't clear how using cron jobs works when using the CakePHP
framework, it was brought up in an existing thread (running cake code
via cron) but there was no definitive answer

I started developing the class as a component that would connect to the
database directly, however I noticed that conflicts with CakePHP and
breaks its database connection.

So in short am I able to get cron scripts to call CakePHP controller
and component functions? Or I am going to have to duplicate some of the
code in the class in a new class that doesn't use the framework?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---