hourly.php 1011 Bytes
Newer Older
Ayolo's avatar
Ayolo committed
1
<?php
2 3 4
if(!isset($argc))
  exit();

Ayolo's avatar
Ayolo committed
5
$_SERVER['SCRIPT_FILENAME']="/var/www/ae/www/ae2/phpcron";
Ayolo's avatar
bleh  
Ayolo committed
6

Ayolo's avatar
Ayolo committed
7 8 9
/*
 * hourly
 */
Ayolo's avatar
Ayolo committed
10

Ayolo's avatar
Ayolo committed
11
$topdir=$_SERVER['SCRIPT_FILENAME']."/../";
Ayolo's avatar
Ayolo committed
12
require_once($topdir. "include/site.inc.php");
Ayolo's avatar
Ayolo committed
13

Ayolo's avatar
Ayolo committed
14
$site = new site ();
Feu's avatar
Feu committed
15 16 17

$site = new site ();

Ayolo's avatar
Ayolo committed
18
// Tâche 1 [galaxy] : màj, et cycles
Feu's avatar
Feu committed
19 20


21
/*require_once($topdir. "include/galaxy.inc.php");
Feu's avatar
Feu committed
22 23 24 25 26 27 28 29

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

$galaxy->update();

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

30
  $galaxy->mini_render($topdir."var/mini_galaxy.png");*/
Feu's avatar
Feu committed
31

Feu's avatar
Feu committed
32

Ayolo's avatar
Ayolo committed
33 34 35 36 37 38 39 40 41 42 43 44
// 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
45
?>