1
0
Fork 0
mirror of https://codeberg.org/demostf/api.git synced 2026-06-04 02:14:06 +02:00

split off infocontroller

This commit is contained in:
Robin Appelman 2017-03-21 00:04:32 +01:00
commit 66d177e23a
6 changed files with 55 additions and 36 deletions

View file

@ -1,8 +1,5 @@
<?php namespace Demostf\API\Providers;
use Demostf\API\Demo\Header;
use Demostf\API\Demo\IDemoStore;
use Demostf\API\Demo\StoredDemo;
use Doctrine\DBAL\Connection;
class DemoProvider extends BaseProvider {
@ -99,12 +96,6 @@ class DemoProvider extends BaseProvider {
return $this->formatList($demos);
}
public function listMaps() {
$sql = 'SELECT DISTINCT(map), COUNT(map) AS count from demos GROUP BY map ORDER BY count DESC';
$result = $this->query($sql);
return $result->fetchAll(\PDO::FETCH_COLUMN);
}
public function getChat($demoId) {
$chat = $this->db->chat()->where('demo_id', $demoId);
$result = [];
@ -161,20 +152,6 @@ class DemoProvider extends BaseProvider {
];
}
public function getStats() {
$demoCount = $this->db->demo()->count();
$playerCount = $this->db->user()->count();
$sql = 'SELECT count(user_id) FROM players GROUP BY user_id';
$result = $this->query($sql);
return [
'demos' => $demoCount,
'players' => $playerCount,
'uploaders' => $result->fetchColumn()
];
}
public function demoIdByHash($hash) {
$query = $this->getQueryBuilder();
$query->select('hash')