Ejemplo n.º 1
0
 /**
  * @since 2.5
  */
 public function outputStatistics()
 {
     $this->outputFormatter->setPageTitle($this->getMessage('smw-smwadmin-operational-statistics-title'));
     $this->outputFormatter->addParentLink();
     $semanticStatistics = ApplicationFactory::getInstance()->getStore()->getStatistics();
     $this->outputFormatter->addHTML(Html::rawElement('p', array(), $this->getMessage(array('smw-smwadmin-operational-statistics'), Message::PARSE)));
     $this->outputFormatter->addHTML(Html::element('h2', array(), $this->getMessage('semanticstatistics')));
     $this->outputFormatter->addHTML('<pre>' . $this->outputFormatter->encodeAsJson(array('propertyValues' => $semanticStatistics['PROPUSES'], 'errorCount' => $semanticStatistics['ERRORUSES'], 'propertyTotal' => $semanticStatistics['USEDPROPS'], 'ownPage' => $semanticStatistics['OWNPAGE'], 'declaredType' => $semanticStatistics['DECLPROPS'], 'oudatedEntities' => $semanticStatistics['DELETECOUNT'], 'subobjects' => $semanticStatistics['SUBOBJECTS'], 'queries' => $semanticStatistics['QUERY'], 'concepts' => $semanticStatistics['CONCEPTS'])) . '</pre>');
     $this->outputFormatter->addHTML(Html::element('h2', array(), $this->getMessage('smw-smwadmin-statistics-querycache-title')));
     $cachedQueryResultPrefetcher = ApplicationFactory::getInstance()->singleton('CachedQueryResultPrefetcher');
     if (!$cachedQueryResultPrefetcher->isEnabled()) {
         return $this->outputFormatter->addHTML(Html::rawElement('p', array(), $this->getMessage(array('smw-smwadmin-statistics-querycache-disabled'), Message::PARSE)));
     }
     $this->outputFormatter->addHTML(Html::rawElement('p', array(), $this->getMessage(array('smw-smwadmin-statistics-querycache-explain'), Message::PARSE)));
     $this->outputFormatter->addHTML('<pre>' . $this->outputFormatter->encodeAsJson($cachedQueryResultPrefetcher->getStats()) . '</pre>');
 }
 private function getIdInfoAsJson($webRequest, $id)
 {
     if ($id < 1 || $webRequest->getText('action') !== 'idlookup') {
         return '';
     }
     $row = $this->connection->selectRow(\SMWSql3SmwIds::TABLE_NAME, array('smw_title', 'smw_namespace', 'smw_iw', 'smw_subobject', 'smw_sortkey'), 'smw_id=' . $id, __METHOD__);
     return '<pre>' . $this->outputFormatter->encodeAsJson(array($id, $row)) . '</pre>';
 }
 public function testEncodeAsJson()
 {
     $instance = new OutputFormatter($this->outputPage);
     $this->assertInternalType('string', $instance->encodeAsJson(array()));
 }