Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

CONTENIDOs pseudo-cron is still to be documented.

The pseuco-cron feature from CONTENIDO adapts the general logik from the default cron feature. The difference between the two implementations is that the cronjobs are controlled with operating system timer and the CONTENIDO pseudo cron 'timer' is a call of the frontend.

 

All cronjobs are located at the directory: 'contenido/cronjobs'. The main configuration for cronjobs is in the file :'data/cronlog/crontab.txt'. There you can define the execution time for every cronjob file. The last execution of every cronjob is stored in a file with the name of the cronjob containing a timestamp of the last execution. When the frontend is called it will be checked if the difference of the last execution time and the actual time is bigger than the defined execution time in the contab.txt and the cronjob will be executed.

Activation

Core Cronjobs

NameDescriptionExecution time
advance_workflow.phpThis cronjob activates the next workflow step if the time limit is over-
linkchecker.phpChecks all links#02 1 * * * // deactivated with #
move_articles.phpMove articles at specified time

*/1 * * * * (periodically every minute)

move_old_stats.phpThis cronjob is used to move old statistics into the stat_archive table0 0 1 * *  (every first day in the month at midnight)
optimize_database.phpThis cronjob optimizes all database tables0 0 * * *  (every full hour)
run_newsletter_job.phpCronjob for newsletter plugin-
send_reminder.phpCronjob to send the reminder items.

*/5 * * * * (periodically every 5 minutes)

setfrontenduserstate.php Activate/deactivate frontend users by time.*/5 * * * * (periodically every 5 minutes)

The time of the last execution of a job is stored in data/cronlog/

Adding new cronjob

All cronjobs are located at the directory: 'contenido/cronjobs'

...

CRONJOBPLUGIN

Cronjob template:

Code Block
languagephp
<?php
/**
 * Template cronjob file
 *
 * @package    Core
 * @subpackage Cronjob
 *
 * @author     claus.schunk@4fb.de
 * @copyright  four for business AG <www.4fb.de>
 * @license    http://www.contenido.org/license/LIZENZ.txt
 * @link       http://www.4fb.de
 * @link       http://www.contenido.org
 */

if (!defined('CON_FRAMEWORK')) {
    define('CON_FRAMEWORK', true);
}

// CONTENIDO path
$contenidoPath = str_replace('\\', '/', realpath(dirname(__FILE__) . '/../')) . '/';

// CONTENIDO startup process
include_once($contenidoPath . 'includes/startup.php');

require_once(cRegistry::getBackendPath() . $cfg['path']['includes'] . 'pseudo-cron.inc.php');

if (!isRunningFromWeb() || function_exists('runJob') || $area == 'cronjobs') {
	
	//implement your code here
}
?>

...