private function purge() { $this->logger->debug(__METHOD__); if ($this->configuration_manager->isDailyPurgeActivated()) { $this->disk_usage_purger->purge(strtotime(date('Y-m-d 00:00:00'))); } }
public function itDailyPurgeAllStatisticsTablesOnJun22() { $expected_dates_on_2015_06_22 = array('2011-01-01', '2011-02-01', '2011-03-01', '2011-04-01', '2011-05-01', '2011-06-01', '2011-07-01', '2011-08-01', '2011-09-01', '2011-10-01', '2011-11-01', '2011-12-01', '2012-01-01', '2012-02-01', '2012-03-01', '2012-04-01', '2012-05-01', '2012-06-01', '2012-07-01', '2012-09-10', '2012-11-01', '2012-12-01', '2013-01-01', '2013-02-01', '2013-03-01', '2013-04-01', '2013-06-12', '2013-06-24', '2013-07-01', '2013-07-08', '2013-07-15', '2013-07-22', '2013-07-29', '2013-08-05', '2013-08-12', '2013-11-08', '2013-11-11', '2013-11-18', '2013-11-25', '2013-12-02', '2013-12-09', '2013-12-16', '2013-12-23', '2013-12-30', '2014-01-06', '2014-01-13', '2014-01-20', '2014-01-27', '2014-02-03', '2014-02-10', '2014-02-17', '2014-02-24', '2014-03-03', '2014-03-10', '2014-03-17', '2014-07-22', '2014-07-28', '2014-08-04', '2014-08-11', '2014-08-18', '2014-08-25', '2014-09-01', '2014-09-08', '2014-09-15', '2014-09-22', '2014-09-29', '2014-10-06', '2014-10-13', '2014-10-20', '2014-10-27', '2014-11-03', '2014-11-10', '2014-11-17', '2014-11-24', '2014-12-01', '2014-12-08', '2014-12-15', '2014-12-22', '2014-12-29', '2015-01-05', '2015-01-12', '2015-01-19', '2015-01-26', '2015-02-02', '2015-02-09', '2015-02-16', '2015-03-15', '2015-03-16', '2015-03-22', '2015-03-23', '2015-03-24', '2015-03-25', '2015-03-26', '2015-03-27', '2015-03-28', '2015-03-29', '2015-03-30', '2015-03-31', '2015-04-01', '2015-04-02', '2015-04-03', '2015-04-04', '2015-04-05', '2015-04-06', '2015-04-07', '2015-04-08', '2015-04-09', '2015-04-10', '2015-04-11', '2015-04-12', '2015-04-13', '2015-04-14', '2015-04-15', '2015-04-16', '2015-04-17', '2015-04-18', '2015-04-19', '2015-04-20', '2015-04-21', '2015-04-22', '2015-04-23', '2015-04-24', '2015-04-25', '2015-04-26', '2015-04-27', '2015-04-28', '2015-04-29', '2015-04-30', '2015-05-01', '2015-05-02', '2015-05-03', '2015-05-04', '2015-05-05', '2015-05-06', '2015-05-07', '2015-05-08', '2015-05-09', '2015-05-10', '2015-05-11', '2015-05-12', '2015-05-13', '2015-05-14', '2015-05-15', '2015-05-16', '2015-05-17', '2015-05-18', '2015-05-19', '2015-05-20', '2015-05-21', '2015-05-22', '2015-05-23', '2015-05-24'); $this->disk_data_purger->purge(strtotime('2015-06-22 00:00:00')); $this->assertEqual($this->fetchDistinctDate('plugin_statistics_diskusage_site'), $expected_dates_on_2015_06_22); $this->assertEqual($this->fetchDistinctDate('plugin_statistics_diskusage_group'), $expected_dates_on_2015_06_22); $this->assertEqual($this->fetchDistinctDate('plugin_statistics_diskusage_user'), $expected_dates_on_2015_06_22); }
* Enalean SAS. All other trademarks or names are properties of their respective * owners. * * This file is a part of Tuleap. * * Tuleap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Tuleap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Tuleap. If not, see <http://www.gnu.org/licenses/>. */ require_once 'pre.php'; require_once dirname(__FILE__) . '/../include/Statistics_ConfigurationManager.class.php'; require_once dirname(__FILE__) . '/../include/Statistics_ConfigurationDao.class.php'; require_once dirname(__FILE__) . '/../include/Statistics_DiskUsagePurger.class.php'; require_once dirname(__FILE__) . '/../include/Statistics_DiskUsageDao.class.php'; $disk_data_purger = new Statistics_DiskUsagePurger(new Statistics_DiskUsageDao(CodendiDataAccess::instance())); try { $disk_data_purger->purge(strtotime(date('Y-m-d 00:00:00'))); $configuration_manager = new Statistics_ConfigurationManager(new Statistics_ConfigurationDao()); $configuration_manager->activateDailyPurge(); } catch (Statistics_PHPVersionException $e) { echo $e->getMessage() . PHP_EOL; }