hourly.php 976 Bytes
Newer Older
Ayolo's avatar
Ayolo committed
1
<?php
Ayolo's avatar
Ayolo committed
2
$_SERVER['SCRIPT_FILENAME']="/var/www/ae/www/ae2/phpcron";
Ayolo's avatar
bleh  
Ayolo committed
3

Ayolo's avatar
Ayolo committed
4 5 6
/*
 * hourly
 */
Ayolo's avatar
Ayolo committed
7

Ayolo's avatar
Ayolo committed
8
$topdir=$_SERVER['SCRIPT_FILENAME']."/../";
Ayolo's avatar
Ayolo committed
9
require_once($topdir. "include/site.inc.php");
Ayolo's avatar
Ayolo committed
10

Ayolo's avatar
Ayolo committed
11
$site = new site ();
Feu's avatar
Feu committed
12 13 14

$site = new site ();

Ayolo's avatar
Ayolo committed
15
// Tâche 1 [galaxy] : màj, et cycles
Feu's avatar
Feu committed
16 17 18 19 20 21 22 23 24 25 26 27 28


require_once($topdir. "include/galaxy.inc.php");

$galaxy = new galaxy($site->db,$site->dbrw);

$galaxy->update();

for($i=0;$i<45;$i++) // Environs 1100 cycles/jours
  $galaxy->cycle();

$galaxy->mini_render($topdir."var/mini_galaxy.png");

Feu's avatar
Feu committed
29

Ayolo's avatar
Ayolo committed
30 31 32 33 34 35 36 37 38 39 40 41
// Tâche 2 [verous]
require_once($topdir . "comptoir/include/venteproduit.inc.php");
$req = new requete($site->db,"SELECT * FROM `cpt_verrou` WHERE TIMEDIFF(NOW(),date_res) >= 1");
$vp = new venteproduit($site->db,$site->dbrw);
$client = new utilisateur($site->db);
while ( $row = $req->get_row() )
{
  $client->load_by_id($row['id_utilisateur']);
  $vp->load_by_id ( $row['id_produit'], $row['id_comptoir'], true );
  $vp->debloquer ( $client, $row['quantite'] );
}

Ayolo's avatar
Ayolo committed
42
?>