View Single Post
  #9 (permalink)  
Old 05-30-2009, 04:53 AM
vikramjb vikramjb is offline
Junior Babbler
 
Join Date: May 2009
Location: Chennai, India
Posts: 15
vikramjb has a few positive reputation points
Smile

Glad to be of help Johnny

So what you are basically saying is, if the number is 33 and "IF" at any given point in time the mt_rand returns a number less than or equal to 33 then the scheduled tasks will be executed, correct ?

If that is the case, do we have a high probability that at any given point in time say we have some scheduled posts but then the random number constraint is not satisfied. For instance if the number is 33 and what will be the chances that this number does not match the one that is generated by mt_rand ?, wouldn't it reduce the chances of a post being published even though the publish date has gone by ?.

For a CMS, if we say a post is going to be published on 12th May 2009 06:00 AM then it means it has to be published at exactly the sametime, right ?. Can the above implementation guarantee the publish date will be exactly what it is scheduled for ?

There is one other way we can do this which is Using back-end. Before you takeout your baseball bat to smash me, hear me out and let me know the flaws if any.

We can have a stored procedure running on a specific time interval which can be dictated by the admin of the CMS. Now this SP will pick inputs from a table where we will store the publishing job details. Now I am sure you will have flags to differentiate Published posts and Draft Posts. Now this SP can update the concerned table's publish flag which will in turn "ensure" that the very next time a user does a refresh of a page or goes to a new page in the CMS the new post would bee published at the date scheduled.

I am not sure if this increases your dependency on the db site but then it does increase the chances of a post being published at exactly the time it was scheduled for. Let me know what you think
__________________
Programming Fundas
Reply With Quote