PHP Classes

Virtual Cron: Check whether it is time to run a periodical task

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 66%Total: 3,536 All time: 942 This week: 660Up
Version License PHP version Categories
virtualcron 0.1GNU Lesser Genera...4.0Time and Date
Description 

Author

This class can be used to check whether it is time to run a task that must run from time to time.

It creates a control file to keep track the last time the task was scheduled.

The class can check the control file last modification time to determined whether it passed a given period of time since the last time the task was run.

If the given interval time has passed since the last run, the class recreates the control file and returns true to inform the application that is time to run the task again.

Innovation Award
PHP Programming Innovation award nominee
March 2007
Number 4


Prize: One downloadable copy of PhpED Professional
Many Web applications need to execute periodical tasks, like sending newsletters, processing pending e-commerce orders, etc..

Some operating systems come with programs, like cron or at, to execute scheduled tasks. However, under some Web hosting environments these programs cannot be used.

This class provides an alternative solution that can be used in more restricted hosting environments.

It uses files to keep track of the last time when a periodical task was executed.

The site Web page scripts can use the class to check these files. The class can tell when it is time to execute a task again. When it is time, the same script can execute the scheduled task without depending on external programs.

Manuel Lemos
Picture of Giorgos
Name: Giorgos <contact>
Classes: 7 packages by
Country: Greece Greece
Age: 46
All time rank: 121 in Greece Greece
Week rank: 23 Down2 in Greece Greece Down
Innovation award
Innovation award
Nominee: 2x

  Files folder image Files (3)  
File Role Description
Accessible without login Plain text file virtualcron.php Class the virtual cron class source
Plain text file virtualcron.txt Data the control file
Plain text file example.php Example a little example

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:3,536
This week:0
All time:942
This week:660Up
User Ratings User Comments (3)
 All time
Utility:95%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:-
Examples:91%StarStarStarStarStar
Tests:-
Videos:-
Overall:66%StarStarStarStar
Rank:552
 
simple and good.
10 years ago (ahnhw)
70%StarStarStarStar
Great, simple and effective class.
14 years ago (Laurie Cowcher)
70%StarStarStarStar
Does what it should.
15 years ago (Jamie Telin)
70%StarStarStarStar