Example #1
0
 /**
  * Caches the intermediate DataTables used in the getIndividualReportsSummary and
  * getIndividualMetricsSummary reports in the option table.
  */
 public function cacheDataByArchiveNameReports()
 {
     $api = API::getInstance();
     $api->getIndividualReportsSummary(true);
     $api->getIndividualMetricsSummary(true);
     $now = Date::now()->getLocalized("%longYear%, %shortMonth% %day%");
     Option::set(DBStats::TIME_OF_LAST_TASK_RUN_OPTION, $now);
 }
Example #2
0
 /**
  * Caches the intermediate DataTables used in the getIndividualReportsSummary and
  * getIndividualMetricsSummary reports in the option table.
  */
 public function cacheDataByArchiveNameReports()
 {
     $api = API::getInstance();
     $api->getIndividualReportsSummary(true);
     $api->getIndividualMetricsSummary(true);
     $now = Date::now()->getLocalized(Date::DATE_FORMAT_SHORT);
     Option::set(DBStats::TIME_OF_LAST_TASK_RUN_OPTION, $now);
 }
 /**
  * Returns the index for this plugin. Shows every other report defined by this plugin,
  * except the '...ByYear' reports. These can be loaded as related reports.
  *
  * Also, the 'getIndividual...Summary' reports are loaded by AJAX, as they can take
  * a significant amount of time to load on setups w/ lots of websites.
  */
 public function index()
 {
     Piwik::checkUserIsSuperUser();
     $view = new View('@DBStats/index');
     $this->setBasicVariablesView($view);
     $view->databaseUsageSummary = $this->getDatabaseUsageSummary(true);
     $view->trackerDataSummary = $this->getTrackerDataSummary(true);
     $view->metricDataSummary = $this->getMetricDataSummary(true);
     $view->reportDataSummary = $this->getReportDataSummary(true);
     $view->adminDataSummary = $this->getAdminDataSummary(true);
     list($siteCount, $userCount, $totalSpaceUsed) = API::getInstance()->getGeneralInformation();
     $view->siteCount = MetricsFormatter::getPrettyNumber($siteCount);
     $view->userCount = MetricsFormatter::getPrettyNumber($userCount);
     $view->totalSpaceUsed = MetricsFormatter::getPrettySizeFromBytes($totalSpaceUsed);
     return $view->render();
 }