diff --git a/php/classes/AmdaStats.php b/php/classes/AmdaStats.php index 2e753f0..9232048 100644 --- a/php/classes/AmdaStats.php +++ b/php/classes/AmdaStats.php @@ -16,13 +16,13 @@ class AmdaStats { private $task = array('request'=>'plot','condition'=>'mining', 'download'=>'print','statistic'=>'statistics', 'getparameter'=>'ws_print', 'getdataset' => 'ws_print', 'getorbites' => 'ws_print', 'getplot' => 'ws_plot'); - public function __construct($user) { + public function __construct($user, $year = NULL) { if (!is_dir(DATAPATH.'Statistics')) { if (!mkdir(DATAPATH.'Statistics', 0775)) $this->success = false; //return -1; if (!chgrp(DATAPATH.'Statistics', APACHE_USER)) $this->success = false; // return -1; } - $this->statsFilePath = $this->getStatsFilePath($user); + $this->statsFilePath = $this->getStatsFilePath($user, $year); } public function addTask($user, $task, $vars) { @@ -45,8 +45,11 @@ class AmdaStats { return $this->concurrentAccessGuestFile(array($this,'_mergeStats'), array('inXml' => $inXml)); } - private function getStatsFilePath($user) { - $thisYear = date("Y"); + private function getStatsFilePath($user, $year) { + if (!isset($year)) + $thisYear = date("Y"); + else + $thisYear = $year; if (empty($user)){ return DATAPATH."Statistics/Stats$thisYear.xml"; } -- libgit2 0.21.2