Exemplo n.º 1
0
 *
 * Contact address: GUnet Asynchronous eLearning Group,
 *                  Network Operations Center, University of Athens,
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */

require_once '../../include/baseTheme.php';
require_once 'include/lib/cronutil.class.php';
require_once 'include/log.php';
session_write_close();


CronUtil::lock();
ignore_user_abort(true);
CronUtil::imgOut();
CronUtil::flush();
monthlycronjob();
CronUtil::unlock();

/**
 * @brief run jobs once a month
 */
function monthlycronjob() {    
    $monthlyname = 'admin_monthly';
    $lastmonth = mktime(date("H"), date("i"), date("s"), date("n") - 1, date("j"), date("Y"));

    $lastrunmonthly = ($res = Database::get()->querySingle("SELECT UNIX_TIMESTAMP(last_run) as last_run FROM cron_params WHERE name = ?s", $monthlyname)) ? $res->last_run : 0;
    $nevermonthly = ($lastrunmonthly > 0) ? false : true;

    if ($lastmonth > $lastrunmonthly) {