本文整理汇总了PHP中Release::getCount方法的典型用法代码示例。如果您正苦于以下问题:PHP Release::getCount方法的具体用法?PHP Release::getCount怎么用?PHP Release::getCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Release
的用法示例。
在下文中一共展示了Release::getCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGlobalStats
/**
* Retourne les statistiques globales
* @return array
*/
public static function getGlobalStats()
{
$oMysqli = Database::getInstance();
$aStats = array();
// Récupération du nombre de releases
$iNbReleases = Release::getCount();
$aStats[] = array("text" => $iNbReleases, "icon" => "fa-film", "subtext" => "releases", "color" => "green");
// Récupération du nombre de torrents
$iNbTorrents = Torrent::getCount();
$aStats[] = array("text" => $iNbTorrents, "icon" => "fa-magnet", "subtext" => "torrents", "color" => "blue");
// Récupération du nombre d'utilisateur
$oResult = $oMysqli->query("SELECT COUNT(*) AS nbusers FROM tks_users");
$iNbUsers = $oResult->fetch_assoc()['nbusers'];
$aStats[] = array("text" => $iNbUsers, "icon" => "fa-users", "subtext" => "utilisateurs", "color" => "brown");
// Récupération du nombre de trackers
$oResult = $oMysqli->query("SELECT COUNT(*) AS nbtrackers FROM tks_trackers");
$iNbTrackers = $oResult->fetch_assoc()['nbtrackers'];
$aStats[] = array("text" => $iNbTrackers, "icon" => "fa-link", "subtext" => "trackers", "color" => "red");
return $aStats;
}
示例2: procede
public function procede()
{
if (!$this->oRequest->existParam('key')) {
throw new Error('Vous devez renseigner la clé.', 3003);
}
if ($this->oRequest->getParam('key', 'string') != Config::get('ingestkey')) {
throw new Error('La clé est invalide.', 3003);
}
//Ajoute du titre
$this->oView->addData('titre', 'Analyse des flux RSS');
//On récupère les éléments pour les statistiques
$iNbReleases = Release::getCount();
$iNbTorrents = Torrent::getCount();
$iStartTime = time();
//Traitement des Trackers
$aTrackers = Tracker::getTrackers();
//Ajout des flux
$aRssList = Rss::getFlux();
foreach ($aRssList as $oRss) {
$aTrackers[$oRss->getTrackerId()]->addFlux($oRss);
}
//Parsage des flux
$aResults = array();
foreach ($aTrackers as $oTracker) {
$aResults = array_merge($aResults, $oTracker->parseRss());
}
//Traitement des résultats
$oTable = new TableGenerator();
$oTable->setId(md5('Ingest'));
$oTable->addColumn('Tags');
$oTable->addColumn('Tracker');
$oTable->addColumn('Release');
foreach ($aResults as $oResult) {
if (is_string($oResult)) {
Logger::log('ingest', $oResult);
$this->oView->addAlert($oResult, 'danger');
} else {
$oResult->store();
$sTags = '';
foreach ($oResult->getTags() as $oTag) {
$oTagView = new View('label');
$oTagView->addData('type', 'info');
$oTagView->addData('text', $oTag->getName());
$oTagView->create();
$sTags .= $oTagView->getCode() . ' ';
}
$oTable->addLine(array($sTags, $aTrackers[$oResult->getTracker()]->getName(), $oResult->getReleaseName()));
}
}
//Statistiques
$iNewReleases = Release::getCount() - $iNbReleases;
$iNewTorrents = Torrent::getCount() - $iNbTorrents;
Stats::storeIngestStats($iNewReleases, $iNewTorrents, date("Y-m-j G:i:s", $iStartTime));
//Enregistrement de la dernière date de vérification
Rss::updateLastCheck(date("Y-m-j G:i:s", $iStartTime));
Logger::log('ingest', $iNewReleases . ' nouvelles releases et ' . $iNewTorrents . ' nouveaux torrents.');
$oTable->setBottom($iNewReleases . ' nouvelles releases et ' . $iNewTorrents . ' nouveaux torrents.');
$oTable->create();
$this->oView->addData('content', $oTable->getCode());
$this->oView->Create();
}