Commit 862af91d authored by Nigel McNie's avatar Nigel McNie

Install a cron job to send data weekly to mahara.org

parent 0b3cacce
......@@ -825,6 +825,18 @@ function xmldb_core_upgrade($oldversion=0) {
set_config('installation_key', get_random_key());
}
if ($oldversion < 2009021901) {
// Insert a cron job to send registration data to mahara.org
$cron = new StdClass;
$cron->callfunction = 'cron_send_registration_data';
$cron->minute = rand(0, 59);
$cron->hour = rand(0, 23);
$cron->day = '*';
$cron->month = '*';
$cron->dayofweek = rand(0, 6);
insert_record('cron', $cron);
}
return $status;
}
......
......@@ -1995,6 +1995,22 @@ function recalculate_quota() {
}
}
/**
* Cronjob to send an update of site statistics to mahara.org
*/
function cron_send_registration_data() {
require_once(get_config('libroot') . 'registration.php');
$result = registration_send_data();
if ($result->data != '1') {
log_info($result);
}
else {
set_config('registration_lastsent', time());
}
}
function random_string($length=15) {
$pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$poollen = strlen($pool);
......
......@@ -81,20 +81,6 @@ function register_submit(Pieform $form, $values) {
redirect('/admin/');
}
/**
* Cronjob to send an update of site statistics to mahara.org
*/
function cron_send_registration_data() {
$result = registration_send_data();
if ($result->data != '1') {
log_info($result);
}
else {
set_config('registration_lastsent', time());
}
}
/**
* Worker - performs sending of registration data to mahara.org
......
......@@ -736,6 +736,7 @@ function core_install_firstcoredata_defaults() {
'auth_remove_old_session_files' => array('30', '20', '*', '*', '*'),
'recalculate_quota' => array('15', '2', '*', '*', '*'),
'import_process_queue' => array('*/5', '*', '*', '*', '*'),
'cron_send_registration_data' => array(rand(0, 59), rand(0, 23), '*', '*', rand(0, 6)),
);
foreach ($cronjobs as $callfunction => $times) {
$cron = new StdClass;
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2009021900;
$config->version = 2009021901;
$config->release = '1.1.0beta5dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment