Ajoute un système de cron pour calculer le classement tous les jours, voir plus souvent

This commit is contained in:
Nigel Sheldon 2021-01-01 14:25:11 +01:00 committed by Gitea
commit 20af83d2ae
5 changed files with 33 additions and 1 deletions

View file

@ -50,7 +50,9 @@ if ($cached['check'] == md5_file(ONYX.'config/root.xml').md5_file(ONYX.'modules/
//$xml->validate();
if ($root = $xml->documentElement->getAttribute('root')) {
if ($root == substr(FILE, 0, strlen($root))) {
// Autorise les fichiers dans les dossiers htdocs/ et cron/
$cron = str_replace("htdocs", "cron", $root);
if ($root == substr(FILE, 0, strlen($root)) || $cron == substr(FILE, 0, strlen($cron))) {
define('ROOT', $root);
$search = substr(FILE, strlen($root));

View file

@ -193,4 +193,14 @@ class BDD
return mysqli_affected_rows($this->session);
}
public function update_classement()
{
if (!$this->session) {
return false;
}
global $table_user;
$query = "SET @p=0; UPDATE $table_user SET place_points = (@p:=@p+1) ORDER BY points DESC;";
mysqli_multi_query($this->session, $query);
}
}