Project

General

Profile

1 38716 eri.katsar
<?php
2
require_once('./js/log4php/Logger.php');
3
include_once('./refreshNums.php');
4
include_once('./refreshCharts.php');
5
class RefreshCache
6
{
7
             public function __construct($action){
8
	     $this->log = Logger::getLogger(__CLASS__);
9
             $this->log->info("Calling scripts to refresh Cache....");
10
	     $this->log->info("Script Mode:".$action);
11
12
if ($action=='refreshNums')
13
{$this->refreshNums();}
14
else if ($action=='refreshCharts')
15
{$this->refreshCharts();}
16
else if ($action=='refreshAll')
17
{ $this->refreshAll(); }
18
else if ($action=='help')
19
{
20
$this->log->info("Availiable options: refreshNums-> Refreshes Stats Numbers Only; refreshCharts -> Refresh Chart Queries ; refreshAll-> Refresh every entry in the cache.");
21
}
22
else
23
{
24
$this->log->info("Wrong argument given. Availiable are: refreshNums, refreshCharts , refreshAll.");}
25
26
}
27
28
29
public function refreshNums(){
30
$this->log->info("Refreshing Numbers...");
31
$csn = new ComputeStatsNumbers();
32
$csn->computeStats();
33
$this->log->info("Done!");
34
}
35
36
public function refreshCharts()
37
{
38
$this->log->info("Refreshing Charts...");
39
$csn = new RefreshCharts();$csn->refresh();
40
$this->log->info("Done!");
41
}
42
43
public function refreshAll()
44
{
45
 $this->refreshNums();
46
 $this->refreshCharts();}
47
48
}
49
50
if ($_GET) {
51
$argument1 = $_GET['action'];
52
} else {
53
$argument1 = $argv[1];
54
}
55
$rc = new RefreshCache($argument1);
56
57
?>