Skip to content

Instantly share code, notes, and snippets.

@kikegarcia
Created August 20, 2015 12:24
Show Gist options
  • Save kikegarcia/45e3fc57ea8523c0f619 to your computer and use it in GitHub Desktop.
Save kikegarcia/45e3fc57ea8523c0f619 to your computer and use it in GitHub Desktop.
Consulta DB y con el valor recogido comprobamos que no hay un proceso corriendo con dicha PID en el servidor
function checkForcedDistributionInCourse() {
global $DB;
$db_cron_pid = $DB->get_record('config_plugins', array(
'plugin' => 'local_distr',
'name' => 'cron_active')
);
if ($db_cron_pid->value && file_exists( "/proc/$db_cron_pid->value" )){
return -1; // En curso
} else {
return $db_cron_pid;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment