PageRenderTime 40ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/sys/plugins/classes/stat.class.php

https://bitbucket.org/Sanek_OS9/dcms-24
PHP | 41 lines | 31 code | 4 blank | 6 comment | 1 complexity | 1acac4adbf0ce4e8e9920a8cb767d6fd MD5 | raw file
  1. <?php
  2. /**
  3. * Class stat
  4. */
  5. abstract class stat
  6. {
  7. /**
  8. * Отправка статистики на сервер dcms.su
  9. */
  10. public static function send()
  11. {
  12. $data = array(
  13. 'host' => $_SERVER['HTTP_HOST'],
  14. 'version_dcms' => dcms::getInstance()->version,
  15. 'version_php' => PHP_VERSION,
  16. 'version_mysql' => db::me()->getAttribute(PDO::ATTR_SERVER_VERSION),
  17. 'translate_length' => filesize(H . '/sys/languages/for_translate.lng'),
  18. 'users_count' => db::me()->query('SELECT COUNT(*) FROM `users`')->fetchColumn()
  19. );
  20. $res = db::me()->query("SELECT * FROM `log_of_visits_for_days` ORDER BY `time_day` DESC LIMIT 1");
  21. if ($stat = $res->fetch()) {
  22. $data['hosts_full'] = $stat['hosts_full'];
  23. $data['hosts_mobile'] = $stat['hosts_mobile'];
  24. $data['hosts_light'] = $stat['hosts_light'];
  25. }
  26. $client = new http_client('http://dcms.su/sys/api.php');
  27. $requests = array(
  28. array(
  29. 'module' => 'api_stat',
  30. 'method' => 'write',
  31. 'data' => $data
  32. )
  33. );
  34. $client->set_post('requests', json_encode($requests));
  35. $client->getHeaders();
  36. }
  37. }