Example #1
0
 /**
  * Récupération du cache
  * @param $filename Nom du cache
  * @return bool|mixed Le cache
  */
 public function get($filename)
 {
     if ($this->activated) {
         if ($this->cached($filename)) {
             Logs::write('Cache', 'Info', 'Récupération du cache ' . $filename . '.json');
             return json_decode(file_get_contents($this->path . $filename . '.json'), true);
         }
         return false;
     }
     return false;
 }
Example #2
0
 public function getModos()
 {
     Logs::write('Pex', 'Info', 'Récupération de la liste des modérateurs');
     if ($this->cache->cached($this->modosCache)) {
         return $this->cache->get($this->modosCache);
     } else {
         $request = "SELECT p.value AS `name`, pi.parent AS `role`\n                        FROM {$this->permissions_inheritance} AS pi\n                        LEFT JOIN {$this->permissions} AS p\n                        ON (pi.child = p.name  AND p.permission LIKE 'name')\n                        WHERE (pi.parent LIKE 'mod' OR pi.parent LIKE 'jrmod') AND p.value IS NOT NULL\n                        ";
         echo $request;
         $modos = $this->query($request);
         $this->cache->set($this->modosCache, $modos);
         return $modos;
     }
 }
Example #3
0
 public function __construct($host, $port)
 {
     if (!filter_var($host, FILTER_VALIDATE_IP)) {
         $host = $this->DNSLookup($host);
     }
     $this->host = $host;
     $this->port = $port;
     $this->cache = new Cache('queries', Config::$app['query_refresh_rate']);
     try {
         $this->Connect($this->host, $this->port);
         Logs::write('Queries', 'Info', "Query OK! Récupérations des infos...");
         $this->getServerInfos();
         $this->getPlayersList();
     } catch (MinecraftQueryException $e) {
         Logs::write('Queries', 'Error', $e->getMessage());
         return;
     }
 }
Example #4
0
 public function flag_v()
 {
     Config::$app['verbose'] = true;
     Logs::write('app', 'Info', "Execution en mode verbeux\n");
 }