views:

225

answers:

2

Okay, so we have this site that we took over from a previous firm...PHP, Zend Framework, MySQL etc.

It's an interesting site in that they utilize a CMS that's external (they manage some data like forums, user subscription, etc.)

So there's a library that communicates via web service calls from PHP to the CMS, and then from JavaScript it calls the code which returns JSON data (which is then manipulated into HTML/CSS).

We need a scheduled task that runs daily. Its job is to get users from this CMS, iterate through them and check xxx amount of fields. Based upon the number of fields populated, if 80% or greater is populated, they're eligible to be a featured user.

And, in our database, I have 2 fields (isFeatured and featuredIndex). isFeatured being a flag, featuredIndex since a featured user will either be #1, #2, or #3.

Either way, our dev environment is Windows + PHP5 + Apache (with PHP running as an Apache module, and not CGI).

I'm thinking the easiest approach is to write a PHP page that will be in the web root, which will only have permissions so it can be run as a scheduled task. What do you guys think?

My challenge is I need to test this locally (suggestions?). The staging and production environments are LAMP setups, fwiw. So, I guess my questions are the following:

  1. Is this a good way of handling this issue? I.e. a scheduled task which utilizes the existing framework (which relies on this 3rd party CMS with web service communications and Zend Framework)
  2. How do I write this script so it can run both on Windows and Linux (PHP)?
  3. And how do I schedule this script to run on a daily basis on Windows and Linux (since it's web based).

Thanks all, -Steve

A: 

If you used Popular Frameworks there is a big chance that you could find a solution. Its ok that you give us such Informations but without any code example we cannot even if we would.

streetparade
The Zend Framework isn't a popular MVC framework?
LookitsPuck
A: 

All,

What it looks like I should do is create the script and have accessible via the web, then have a cron job call wget. Apparently wget is available via Windows, and I can use it in addition to the scheduled tasks on Windows to have it run on Windows, and for Linux have crontab + wget.

-Steve

LookitsPuck