コード例 #1
0
 protected function getContentNames($websiteId = null, $date = null)
 {
     if (!is_null($websiteId)) {
         return \Piwik\API\Request::processRequest('Contents.getContentNames', array('idSite' => $websiteId, 'period' => 'year', 'date' => $date));
     }
     return Db::fetchAssoc("select `idaction`, `name` from `{$this->tablePrefix}log_action` where `type` = ?", array(\Piwik\Tracker\Action::TYPE_CONTENT_NAME));
 }
コード例 #2
0
 /**
  * Gets general database info that is not specific to any table.
  *
  * @throws Exception
  * @return array See http://dev.mysql.com/doc/refman/5.1/en/show-status.html .
  */
 public function getDBStatus()
 {
     if (function_exists('mysql_connect')) {
         $configDb = Config::getInstance()->database;
         $link = mysql_connect($configDb['host'], $configDb['username'], $configDb['password']);
         $status = mysql_stat($link);
         mysql_close($link);
         $status = explode("  ", $status);
     } else {
         $fullStatus = Db::fetchAssoc('SHOW STATUS');
         if (empty($fullStatus)) {
             throw new Exception('Error, SHOW STATUS failed');
         }
         $status = array('Uptime' => $fullStatus['Uptime']['Value'], 'Threads' => $fullStatus['Threads_running']['Value'], 'Questions' => $fullStatus['Questions']['Value'], 'Slow queries' => $fullStatus['Slow_queries']['Value'], 'Flush tables' => $fullStatus['Flush_commands']['Value'], 'Open tables' => $fullStatus['Open_tables']['Value'], 'Opens' => 'unavailable', 'Queries per second avg' => 'unavailable');
     }
     return $status;
 }