Phalcon Framework 3.4.1

PDOException: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/private/lib/mysql.class.php (20)
#0PDO->__construct(mysql:host=drooblemainrds.chhafiyqhqaa.us-west-2.rds.amazonaws.com;dbname=droobleMain, droobleweb1, YfRUKKALtD6qjAm4, Array([1002] => SET NAMES utf8, [1005] => 1))
/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/private/lib/mysql.class.php (20)
<?php
 
class droobleMysql{
        public $debug = false; // debuging all
        public $queryCount = 0; // tatal query count
        public $queryTime = 0; // total query time
        public $queries=array(); //if debug=enable - collect all queryes strings
        public $query;
        private $save_in_cache=false;
        private $default_cache_ttl=60; //60 seconds;
        private $sql;
        private $params = array();
        //public $memcached;
        private $memcached_key;
        //private $memcached_config;
        public $result = false;
        protected $PDO;
 
        public function __construct($host, $user = 0, $pass = 0, $db = 0, $memcached=null) {
                $this->PDO = new PDO('mysql:host='.$host.';dbname='.$db, $user, $pass,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",PDO::MYSQL_ATTR_FOUND_ROWS => true));
           //     $this->memcached_config=$memcached_config;
           //     $this->memcached = $memcached; //new Memcached();
                //if(!empty($memcached_config)){
                  //  $this->memcached->setOption(Memcached::OPT_CLIENT_MODE, Memcached::DYNAMIC_CLIENT_MODE);
                   // $this->memcached->addServer($this->mem`d_config['endpoint'], $this->memcached_config['port']);
                //}
        }
 
 
        public function prepare($sql, $params = array(), $pdoOptions = array()) {
            $this->query = $this->PDO->prepare($sql, $pdoOptions);
            $this->params = $params;
            $this->queries[] = $sql;
            $this->result=$this->search_in_cache($sql,$params);
            return $this;
        }
 
        private function search_in_cache($sql,$params){
            $this->memcached_key=".pdo.".md5(serialize(array($sql,$params)));
            if(strpos(strtolower($sql), 'select')===0){
//                $from_cache=unserialize($this->memcached->get($this->memcached_key));
                $from_cache=unserialize( \DroobleMemcache()->read($this->memcached_key) );
                if($from_cache){
                    return $from_cache;
                }
            }
            return false;
        }
 
        public function execute() {
            if($this->result===false){
                foreach($this->params as $k=>$v){
                    $this->bind($k,$v);
                }
                $this->query->execute();
            }
            return $this;
        }
 
        public function cache($ttl=60){
            //\Helpers\Debug::log($this->memcached_key);
            \DroobleMemcache()->write($this->memcached_key, serialize($this->result), $ttl);
            return $this;
        }
 
        public function quote($string){
            return $this->PDO->quote($string);
        }
 
        public function s($a,$b=NULL){
            $this->query=false;
            if($this->debug){
                $this->queries[]=$a;
            }
            $this->query=$this->PDO->prepare($a);
            if($b){
                foreach($b as $k=>$v){
                    $this->bind($k,$v);
                }
            }
            return $this->query->execute();
        }
 
        public function bind($param, $value, $type = null){
            if (is_null($type)) {
                switch (true) {
                    case is_int($value):
                        $type = PDO::PARAM_INT;
                        break;
                    case is_bool($value):
                        $type = PDO::PARAM_BOOL;
                        break;
                    case is_null($value):
                        $type = PDO::PARAM_NULL;
                        break;
                    default:
                        $type = PDO::PARAM_STR;
                }
            }
            try{
                $this->query->bindValue($param, $value, $type);
            }catch(PDOExecption $e){
               // var_dump($e);
            }
        }
 
        public function q($a,$b=NULL) {
            $start = microtime ( 1 );
            $this->s($a,$b);
           /*
            $res = array();
            foreach ($this->query as $row) {
                $res[] = $row;
            }
           */
            $res = $this->query->fetchAll(PDO::FETCH_ASSOC);
 
            $end = microtime ( 1 );
            $this->debugData ( $start, $end, $a );
            return $res;
        }
 
        public function line($a,$b) {
                $start = microtime ( 1 );
                $this->s($a,$b);
                $line=false;
                foreach ($this->query as $row) {
                    $line = $row;
                    break;
                }
                $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
                return $line;
        }
 
        public function one($a, $b) {
            $start = microtime ( 1 );
            $r=$this->line($a,$b);
            $end = microtime ( 1 );
            $this->debugData ( $start, $end, $a );
            $i = 0;
            return array_shift(array_values($r));
        }
 
        private function debugData($start, $end, $a, $b = 'DB') {
                $this->queryCount ++;
                $t = number_format ( $end - $start, 8 );
                $this->queryTime = $this->queryTime + $t;
        }
 
        // select * from table
        public function selectAll($a) {
                $query = "SELECT * FROM `$a`";
                return $this->q ( $query );
        }
 
        // insert data $db->insert($table,$data);
        public function insert($a, $b) {
                $filter = new \Phalcon\Filter();
                $start = microtime ( 1 );
                $q = "INSERT INTO `".$a."` (";
                foreach ( $b as $k => $v ) {
                        $q .= "`".$k."`,";
                }
                $q = substr ( $q, 0, - 1 );
                $q .= ") values (";
                foreach ( $b as $k => $v ) {
            //$d=mysql_real_escape_string($d);
                        $d = $filter->sanitize($d,"striptags");
                        $q .= " :{$k},";
                }
                $q = substr ( $q, 0, - 1 );
        $q.= ');';
 
                // $this->PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                $prepare = $b;
                foreach($prepare as $k=>$v){
                    $prepare[$k] = $filter->sanitize($v,"striptags");
                }
                $ret = $this->s ( $q, $prepare );
                $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
                if ($ret === FALSE) {return false;}
 
                if ($this->affectedRows() > 0 ) {
                    return true;
                }else{
                    return false;
                }
        }
 
        // update row or rows, $db->update($tableName,$updateValues,$whereValues);
        public function update($a, $b, $c) {
                $start = microtime ( 1 );
 
                $filter = new \Phalcon\Filter();
 
                $q = "UPDATE `$a` SET ";
                foreach ( $b as $k => $v ) {
            //$k=mysql_real_escape_string($k);
 
                        $k = $filter->sanitize($k,"striptags");
 
                        $q .= "`$k`=:v_{$k},";
                }
                $q = substr ( $q, 0, - 1 );
                $q .= " WHERE 1";
                foreach ( $c as $k => $v ) {
            //$k=mysql_real_escape_string($k);
 
 
                        $k = $filter->sanitize($k,"striptags");
 
 
                        $q .= " AND `$k`=:w_{$k}";
                }
                $b = array_combine(
                    array_map(function($k){ return 'v_'.$k; }, array_keys($b))
                    , $b
                );
                $c = array_combine(
                    array_map(function($k){ return 'w_'.$k; }, array_keys($c))
                    , $c
                );
                $prepare=array_merge($b,$c);
                foreach($prepare as $k=>$v){
                    $prepare[$k] = $filter->sanitize($v,"striptags");
                }
                $ret = $this->s( $q ,$prepare);
                $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
 
                if ($ret === FALSE) {return false;}
 
                if ( ($ar = $this->affectedRows()) > 0 ) {
                    return $ar;
                }
                return TRUE;
        }
    public function delete($a,$b){
        if(count($b)){
                    $start = microtime ( 1 );
          $q = "DELETE FROM `{$a}` ";
          $q = substr ( $q, 0, - 1 );
          $q .= " WHERE 1";
          foreach ( $b as $k => $v ) {
              //$k=mysql_real_escape_string($k);
              $q .= " AND `{$k}`= :{$k}";
          }
          $ret = $this->s ( $q, $b);
                    $end = microtime ( 1 );
                    $this->debugData ( $start, $end, $a );
          if ($ret === FALSE) {return false;}
 
                    if ( ($ar = $this->affectedRows()) > 0 ) {
                        return $ar;
                    }
                    return TRUE;
        }else{
          return false;
        }
    }
        public function countTable($a) {
                $start = microtime ( 1 );
                $q = "SELECT COUNT(*) FROM `$a` LIMIT 1";
                $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
                return $this->one ( $q );
        }
        function countWhere($a, $b, $c) {
                $start = microtime ( 1 );
                $q = "SELECT COUNT(*) FROM `$a` ";
 
                if ( $b ) {
                    $q .= "WHERE $b";
                }
 
                $q .= " LIMIT 1";
            $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
                return $this->one ( $q, $c );
        }
 
        function countWhereGroup($a, $b, $c, $d) {
                $start = microtime ( 1 );
                $q = "SELECT COUNT(*) FROM `$a` ";
 
                if ( $b ) {
                    $q .= "WHERE $b";
                }
 
                if ( $c ) {
                    $q .= "GROUP BY '{$c}'";
                }
 
                $q .= " LIMIT 1";
            $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
                return $this->one ($q, $d);
        }
    //get affected rows
    public function affectedRows(){
      if(method_exists($this->query, "rowCount")){
                try{
                    return $this->query->rowCount();
                }catch(PDOExecption $e){
                    return 0;
                }
            }else{
                return 0;
            }
    }
 
        // get last inserted ID
        public function lastID() {
            try{
                return $this->PDO->lastInsertId();
            }catch(PDOExecption $e){
                return 0;
            }
        }
 
        public function removeIntIndexes( $data ) {
            $n = array();
 
            foreach ( $data as $k => $v ) {
                if (!is_int($k)) {
                    $n[$k] = $v;
                }
            }
 
            return $n;
        }
 
        public function enableExceptions() {
            $this->PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            return $this;
        }
 
        public function errorInfo() {
            return $this->PDO->errorInfo();
        }
 
        public function fetchAllAssoc() {
 
            $this->result = $this->result!==false ? $this->result : $this->query->fetchAll(\PDO::FETCH_ASSOC);
            return $this;
            //return $this->query->fetchAll(\PDO::FETCH_ASSOC);
        }
 
        public function fetchRowAssoc() {
            $this->result = $this->result!==false ? $this->result : $this->query->fetch(\PDO::FETCH_ASSOC);
            return $this;
            //return $this->query->fetch(\PDO::FETCH_ASSOC);
        }
 
        public function fetchAllNum() {
            $this->result = $this->result!==false ? $this->result : $this->query->fetchAll(\PDO::FETCH_NUM);
            return $this;
            //return $this->query->fetchAll(\PDO::FETCH_NUM);
        }
 
        public function fetchRowNum() {
            $this->result = $this->result!==false ? $this->result : $this->query->fetch(\PDO::FETCH_NUM);
            return $this;
        }
 
        public function fetchAllObj() {
            $this->result = $this->result!==false ? $this->result : $this->query->fetchAll(\PDO::FETCH_OBJ);
            return $this;
        }
 
        public function fetchRowObj() {
            $this->result = $this->result!==false ? $this->result : $this->query->fetch(\PDO::FETCH_OBJ);
            return $this;
        }
 
        public function fetchAllColumn($column) {
            $this->result = $this->result!==false ? $this->result : $this->query->fetchAll(\PDO::FETCH_COLUMN, $column);
            return $this;
        }
 
        public function fetchRowColumn($column) {
            $this->result = $this->result!==false ? $this->result : $this->query->fetch(\PDO::FETCH_BOUND, $column);
            return $this;
        }
 
        public function fetchAllClass($class) {
            $this->result = $this->result!==false ? $this->result : $this->query->fetchAll(\PDO::FETCH_CLASS, $class);
            return $this;
        }
 
        public function fetchRowClass($class) {
            $this->result = $this->result!==false ? $this->result : $this->query->fetch(\PDO::FETCH_BOUND, $class);
            return $this;
        }
}
 
$db = new droobleMysql(
                \Config::db()->MYSQL->DB_HOST,
                \Config::db()->MYSQL->DB_USER,
                \Config::db()->MYSQL->DB_PASS,
                \Config::db()->MYSQL->DB_NAME
              //  $cache
            );
 
?>
#1droobleMysql->__construct(drooblemainrds.chhafiyqhqaa.us-west-2.rds.amazonaws.com, droobleweb1, YfRUKKALtD6qjAm4, droobleMain)
/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/private/lib/mysql.class.php (403)
<?php
 
class droobleMysql{
        public $debug = false; // debuging all
        public $queryCount = 0; // tatal query count
        public $queryTime = 0; // total query time
        public $queries=array(); //if debug=enable - collect all queryes strings
        public $query;
        private $save_in_cache=false;
        private $default_cache_ttl=60; //60 seconds;
        private $sql;
        private $params = array();
        //public $memcached;
        private $memcached_key;
        //private $memcached_config;
        public $result = false;
        protected $PDO;
 
        public function __construct($host, $user = 0, $pass = 0, $db = 0, $memcached=null) {
                $this->PDO = new PDO('mysql:host='.$host.';dbname='.$db, $user, $pass,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",PDO::MYSQL_ATTR_FOUND_ROWS => true));
           //     $this->memcached_config=$memcached_config;
           //     $this->memcached = $memcached; //new Memcached();
                //if(!empty($memcached_config)){
                  //  $this->memcached->setOption(Memcached::OPT_CLIENT_MODE, Memcached::DYNAMIC_CLIENT_MODE);
                   // $this->memcached->addServer($this->mem`d_config['endpoint'], $this->memcached_config['port']);
                //}
        }
 
 
        public function prepare($sql, $params = array(), $pdoOptions = array()) {
            $this->query = $this->PDO->prepare($sql, $pdoOptions);
            $this->params = $params;
            $this->queries[] = $sql;
            $this->result=$this->search_in_cache($sql,$params);
            return $this;
        }
 
        private function search_in_cache($sql,$params){
            $this->memcached_key=".pdo.".md5(serialize(array($sql,$params)));
            if(strpos(strtolower($sql), 'select')===0){
//                $from_cache=unserialize($this->memcached->get($this->memcached_key));
                $from_cache=unserialize( \DroobleMemcache()->read($this->memcached_key) );
                if($from_cache){
                    return $from_cache;
                }
            }
            return false;
        }
 
        public function execute() {
            if($this->result===false){
                foreach($this->params as $k=>$v){
                    $this->bind($k,$v);
                }
                $this->query->execute();
            }
            return $this;
        }
 
        public function cache($ttl=60){
            //\Helpers\Debug::log($this->memcached_key);
            \DroobleMemcache()->write($this->memcached_key, serialize($this->result), $ttl);
            return $this;
        }
 
        public function quote($string){
            return $this->PDO->quote($string);
        }
 
        public function s($a,$b=NULL){
            $this->query=false;
            if($this->debug){
                $this->queries[]=$a;
            }
            $this->query=$this->PDO->prepare($a);
            if($b){
                foreach($b as $k=>$v){
                    $this->bind($k,$v);
                }
            }
            return $this->query->execute();
        }
 
        public function bind($param, $value, $type = null){
            if (is_null($type)) {
                switch (true) {
                    case is_int($value):
                        $type = PDO::PARAM_INT;
                        break;
                    case is_bool($value):
                        $type = PDO::PARAM_BOOL;
                        break;
                    case is_null($value):
                        $type = PDO::PARAM_NULL;
                        break;
                    default:
                        $type = PDO::PARAM_STR;
                }
            }
            try{
                $this->query->bindValue($param, $value, $type);
            }catch(PDOExecption $e){
               // var_dump($e);
            }
        }
 
        public function q($a,$b=NULL) {
            $start = microtime ( 1 );
            $this->s($a,$b);
           /*
            $res = array();
            foreach ($this->query as $row) {
                $res[] = $row;
            }
           */
            $res = $this->query->fetchAll(PDO::FETCH_ASSOC);
 
            $end = microtime ( 1 );
            $this->debugData ( $start, $end, $a );
            return $res;
        }
 
        public function line($a,$b) {
                $start = microtime ( 1 );
                $this->s($a,$b);
                $line=false;
                foreach ($this->query as $row) {
                    $line = $row;
                    break;
                }
                $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
                return $line;
        }
 
        public function one($a, $b) {
            $start = microtime ( 1 );
            $r=$this->line($a,$b);
            $end = microtime ( 1 );
            $this->debugData ( $start, $end, $a );
            $i = 0;
            return array_shift(array_values($r));
        }
 
        private function debugData($start, $end, $a, $b = 'DB') {
                $this->queryCount ++;
                $t = number_format ( $end - $start, 8 );
                $this->queryTime = $this->queryTime + $t;
        }
 
        // select * from table
        public function selectAll($a) {
                $query = "SELECT * FROM `$a`";
                return $this->q ( $query );
        }
 
        // insert data $db->insert($table,$data);
        public function insert($a, $b) {
                $filter = new \Phalcon\Filter();
                $start = microtime ( 1 );
                $q = "INSERT INTO `".$a."` (";
                foreach ( $b as $k => $v ) {
                        $q .= "`".$k."`,";
                }
                $q = substr ( $q, 0, - 1 );
                $q .= ") values (";
                foreach ( $b as $k => $v ) {
            //$d=mysql_real_escape_string($d);
                        $d = $filter->sanitize($d,"striptags");
                        $q .= " :{$k},";
                }
                $q = substr ( $q, 0, - 1 );
        $q.= ');';
 
                // $this->PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                $prepare = $b;
                foreach($prepare as $k=>$v){
                    $prepare[$k] = $filter->sanitize($v,"striptags");
                }
                $ret = $this->s ( $q, $prepare );
                $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
                if ($ret === FALSE) {return false;}
 
                if ($this->affectedRows() > 0 ) {
                    return true;
                }else{
                    return false;
                }
        }
 
        // update row or rows, $db->update($tableName,$updateValues,$whereValues);
        public function update($a, $b, $c) {
                $start = microtime ( 1 );
 
                $filter = new \Phalcon\Filter();
 
                $q = "UPDATE `$a` SET ";
                foreach ( $b as $k => $v ) {
            //$k=mysql_real_escape_string($k);
 
                        $k = $filter->sanitize($k,"striptags");
 
                        $q .= "`$k`=:v_{$k},";
                }
                $q = substr ( $q, 0, - 1 );
                $q .= " WHERE 1";
                foreach ( $c as $k => $v ) {
            //$k=mysql_real_escape_string($k);
 
 
                        $k = $filter->sanitize($k,"striptags");
 
 
                        $q .= " AND `$k`=:w_{$k}";
                }
                $b = array_combine(
                    array_map(function($k){ return 'v_'.$k; }, array_keys($b))
                    , $b
                );
                $c = array_combine(
                    array_map(function($k){ return 'w_'.$k; }, array_keys($c))
                    , $c
                );
                $prepare=array_merge($b,$c);
                foreach($prepare as $k=>$v){
                    $prepare[$k] = $filter->sanitize($v,"striptags");
                }
                $ret = $this->s( $q ,$prepare);
                $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
 
                if ($ret === FALSE) {return false;}
 
                if ( ($ar = $this->affectedRows()) > 0 ) {
                    return $ar;
                }
                return TRUE;
        }
    public function delete($a,$b){
        if(count($b)){
                    $start = microtime ( 1 );
          $q = "DELETE FROM `{$a}` ";
          $q = substr ( $q, 0, - 1 );
          $q .= " WHERE 1";
          foreach ( $b as $k => $v ) {
              //$k=mysql_real_escape_string($k);
              $q .= " AND `{$k}`= :{$k}";
          }
          $ret = $this->s ( $q, $b);
                    $end = microtime ( 1 );
                    $this->debugData ( $start, $end, $a );
          if ($ret === FALSE) {return false;}
 
                    if ( ($ar = $this->affectedRows()) > 0 ) {
                        return $ar;
                    }
                    return TRUE;
        }else{
          return false;
        }
    }
        public function countTable($a) {
                $start = microtime ( 1 );
                $q = "SELECT COUNT(*) FROM `$a` LIMIT 1";
                $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
                return $this->one ( $q );
        }
        function countWhere($a, $b, $c) {
                $start = microtime ( 1 );
                $q = "SELECT COUNT(*) FROM `$a` ";
 
                if ( $b ) {
                    $q .= "WHERE $b";
                }
 
                $q .= " LIMIT 1";
            $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
                return $this->one ( $q, $c );
        }
 
        function countWhereGroup($a, $b, $c, $d) {
                $start = microtime ( 1 );
                $q = "SELECT COUNT(*) FROM `$a` ";
 
                if ( $b ) {
                    $q .= "WHERE $b";
                }
 
                if ( $c ) {
                    $q .= "GROUP BY '{$c}'";
                }
 
                $q .= " LIMIT 1";
            $end = microtime ( 1 );
                $this->debugData ( $start, $end, $a );
                return $this->one ($q, $d);
        }
    //get affected rows
    public function affectedRows(){
      if(method_exists($this->query, "rowCount")){
                try{
                    return $this->query->rowCount();
                }catch(PDOExecption $e){
                    return 0;
                }
            }else{
                return 0;
            }
    }
 
        // get last inserted ID
        public function lastID() {
            try{
                return $this->PDO->lastInsertId();
            }catch(PDOExecption $e){
                return 0;
            }
        }
 
        public function removeIntIndexes( $data ) {
            $n = array();
 
            foreach ( $data as $k => $v ) {
                if (!is_int($k)) {
                    $n[$k] = $v;
                }
            }
 
            return $n;
        }
 
        public function enableExceptions() {
            $this->PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            return $this;
        }
 
        public function errorInfo() {
            return $this->PDO->errorInfo();
        }
 
        public function fetchAllAssoc() {
 
            $this->result = $this->result!==false ? $this->result : $this->query->fetchAll(\PDO::FETCH_ASSOC);
            return $this;
            //return $this->query->fetchAll(\PDO::FETCH_ASSOC);
        }
 
        public function fetchRowAssoc() {
            $this->result = $this->result!==false ? $this->result : $this->query->fetch(\PDO::FETCH_ASSOC);
            return $this;
            //return $this->query->fetch(\PDO::FETCH_ASSOC);
        }
 
        public function fetchAllNum() {
            $this->result = $this->result!==false ? $this->result : $this->query->fetchAll(\PDO::FETCH_NUM);
            return $this;
            //return $this->query->fetchAll(\PDO::FETCH_NUM);
        }
 
        public function fetchRowNum() {
            $this->result = $this->result!==false ? $this->result : $this->query->fetch(\PDO::FETCH_NUM);
            return $this;
        }
 
        public function fetchAllObj() {
            $this->result = $this->result!==false ? $this->result : $this->query->fetchAll(\PDO::FETCH_OBJ);
            return $this;
        }
 
        public function fetchRowObj() {
            $this->result = $this->result!==false ? $this->result : $this->query->fetch(\PDO::FETCH_OBJ);
            return $this;
        }
 
        public function fetchAllColumn($column) {
            $this->result = $this->result!==false ? $this->result : $this->query->fetchAll(\PDO::FETCH_COLUMN, $column);
            return $this;
        }
 
        public function fetchRowColumn($column) {
            $this->result = $this->result!==false ? $this->result : $this->query->fetch(\PDO::FETCH_BOUND, $column);
            return $this;
        }
 
        public function fetchAllClass($class) {
            $this->result = $this->result!==false ? $this->result : $this->query->fetchAll(\PDO::FETCH_CLASS, $class);
            return $this;
        }
 
        public function fetchRowClass($class) {
            $this->result = $this->result!==false ? $this->result : $this->query->fetch(\PDO::FETCH_BOUND, $class);
            return $this;
        }
}
 
$db = new droobleMysql(
                \Config::db()->MYSQL->DB_HOST,
                \Config::db()->MYSQL->DB_USER,
                \Config::db()->MYSQL->DB_PASS,
                \Config::db()->MYSQL->DB_NAME
              //  $cache
            );
 
?>
#2include(/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/private/lib/mysql.class.php)
/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/public/index.php (129)
<?php
 
error_reporting(E_ERROR | E_PARSE);
 
if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT'])
  or (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)
  or (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; Touch; rv:11.0') !== false)) {
  //is IE 11 or below
  header('Location: /no-support-browser.html');
  exit;
}
 
try {
  define('CURRENT_MODULE',"web");
 
  chdir(dirname(__DIR__));
 
  $_SERVER["REMOTE_ADDR"]=isset($_SERVER['HTTP_CF_CONNECTING_IP']) ? $_SERVER['HTTP_CF_CONNECTING_IP'] : $_SERVER["REMOTE_ADDR"]; //cloudflare IP address parsing;
 
 
  if ($_GET['rb']) {
    setcookie("rb", $_GET['rb'], time() + 2 * 3600, '/');
    $_COOKIE["rb"] = $_GET['rb'];
  }
    if (isset($_GET['rb']) && !$_GET['rb']) {
        setcookie("rb", $_GET['rb'], time() - 2 * 3600, '/');
    }
 
  if(file_exists(__DIR__ . '/../../../config/defines.php')){ include(__DIR__ . '/../../../config/defines.php'); }
 
  date_default_timezone_set('Etc/UTC');
 
  mb_internal_encoding("UTF-8");
 
  if(file_exists("private/config/common.php")) $_CONFIG = include("private/config/common.php");
 
  if(file_exists("/etc/drooble/configs/".CURRENT_MODULE."/config.php")) $_CONFIG = array_replace_recursive($_CONFIG, include("/etc/drooble/configs/".CURRENT_MODULE."/config.php"));
 
  require __DIR__ . '/../../../config/wrapper.php';
 
  $config = include __DIR__ . '/../../../config/config.php';
 
  $loader = require __DIR__ . '/../../../resources/lib/autoload.php';
 
  include __DIR__ . "/../../../config/services.php";
 
 
  $di['router'] = function () {
        return include __DIR__ . "/../private/config/router.php";
    };
 
//  include __DIR__ . "/../../../config/segment.php";
  
 
    $segment_options = [];
    if ($_GET['test_segment']) {
        $test_segment = ($_GET['test_segment'] == "true" || $_GET['test_segment'] == 1) ? 1 : 0;
        // need to overwrite segment ip rules when testing
        setcookie("test_segment", $test_segment, time() + 2 * 3600, '/');
        $segment_options['forward_anyway'] =  $test_segment ? true : false;
    }
    if (isset($_COOKIE['test_segment'])) {
        $segment_options['forward_anyway'] = $_COOKIE['test_segment'] == 1 ? true : false;
    }
    \Drooble\FW\DroobleSegment::init(\Config::segment_analytics()->PROJECT_KEYS->WRITE_KEY, $segment_options);
 
    $app = new \Drooble\FW\DroobleApp($di); //10ms
 
    $app->view->setViewsDir( __DIR__ . "/../private/views/" );
 
    $handle = $app->handle();
 
  $content = $handle->getContent();
 
    \Drooble\FW\DroobleSegment::flush();
 
  exit( $content );
 
} catch (\Phalcon\Exception $e) {
  echo $e->getMessage();
  exit;
} catch (\PDOException $e){
  echo $e->getMessage();
  exit;
} catch (\Drooble\Exceptions\InvalidParameters $e){
  exit(json_encode(array(false,["error"=>"InvalidParameters","hint"=>$e->getMessage()])));
} catch (\Drooble\Exceptions\NotFound $e){
  exit(json_encode(array(false,["error"=>"NotFound","hint"=>$e->getMessage()])));
} catch (\Drooble\Exceptions\AccessDenied $e){
  exit(json_encode(array(false,["error"=>"AccessDenied","hint"=>$e->getMessage()])));
} catch (\Drooble\Exceptions\GeneralError $e){
  exit(json_encode(array(false,["error"=>"GeneralError","hint"=>$e->getMessage()])));
} catch (\Exception $e){
 
  if($e->getMessage()=='nosess'){
    exit(json_encode(array(false,"nosess")));
  }
 
  if($e->getMessage()=='wrong_method'){
    exit(json_encode([false,"api error"]));
  }
 
  if($e->getMessage()=='action_not_alowed' || $e->getCode()==103){
    exit(json_encode([false,"not alowd"]));
  }
 
  if($e->getMessage()!='action_not_found' and $e->getCode()!=101 and $e->getCode() != 100){
    echo $e->getMessage();
  }
/* 
  if( $e->getMessage()=='not_implemented' AND ( $e->getCode() == 100 OR $e->getCode() == 101 ) ){
    //GO TO CONTENT BUILDER
  }else{
    exit(json_encode([false,"general error"]));
  } */
 
}
// END Phalcon
 
foreach(array( "a", "b", "c", "d", "e" ) as $get)
    ${"_" . $get} = isset($_GET[$get]) ? $_GET[$get] : "";
 
if (\Helpers\Basic::getAppMode() == DEVELOPMENT_MODE)
{
  (new \Phalcon\Debug)->listen();
}
 
//include(LIB . "cache.class.php"); // deprecated
include(LIB . "mysql.class.php");
include(LIB . "client.class.php");
 
if ($_POST['ajax'] == 'api1' || ($app->getRoutingType() == "ajaxAPI")){
  $c->api('api1'); //GO TO API AND EXIT
}
 
 
 
//handle action
if($_a=='a'){
  include(LIB."action_handler.php");
}
 
if($_a=='fbHandler'){
  include(LIB."facebook_handler.php");
}
 
 
$router = $di->getRouter();
if ($router->getClientPlatformType() == 'MB') {
//    $loadSmartBanner = false; TODO set to true if you want it back
}
 
 
 
 
//PREPARE HTML
 
include(BACKEND_GENERATED_CONTENT . "/layout.php");
 
 
\Drooble\FW\DroobleSegment::flush();
KeyValue
asearch
b
c
d
e
influencesArray ( [0] => Calvin Harris )
page2
KeyValue
USERwww-data
HOME/var/www
HTTP_CONNECTIONkeep-alive
HTTP_X_FORWARDED_PROTOhttps
HTTP_X_FORWARDED_PORT443
HTTP_X_FORWARDED_FOR54.224.117.125, 172.70.34.20
HTTP_USER_AGENTCCBot/2.0 (https://commoncrawl.org/faq/)
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_CF_RAY6d4fb49c2f785ae6-IAD
HTTP_CF_IPCOUNTRYUS
HTTP_CF_CONNECTING_IP54.224.117.125
HTTP_CDN_LOOPcloudflare
HTTP_ACCEPT_LANGUAGEen-US,en;q=0.5
HTTP_ACCEPT_ENCODINGgzip
HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_HOSTrc.drooble.com
REDIRECT_STATUS200
SERVER_NAMErc.drooble.com
SERVER_PORT443
SERVER_ADDR172.31.25.120
REMOTE_PORT59292
REMOTE_ADDR54.224.117.125
SERVER_SOFTWAREnginx/1.14.0
GATEWAY_INTERFACECGI/1.1
HTTPSon
REQUEST_SCHEMEhttps
SERVER_PROTOCOLHTTP/1.1
DOCUMENT_ROOT/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/public
DOCUMENT_URI/index.php
REQUEST_URI/search/?influences%5B%5D=Calvin+Harris&page=2
SCRIPT_NAME/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHODGET
QUERY_STRINGa=search&b=&c=&d=&e=&influences%5B%5D=Calvin+Harris&page=2
SCRIPT_FILENAME/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/public/index.php
PATH_INFO
FCGI_ROLERESPONDER
PHP_SELF/index.php
REQUEST_TIME_FLOAT1643430419.932
REQUEST_TIME1643430419
#Path
0/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/public/index.php
1/var/www/rc/drooble/trunk/projects/drooble_v1/config/defines.php
2/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/private/config/common.php
3/var/www/rc/drooble/trunk/projects/drooble_v1/config/wrapper.php
4/var/www/rc/drooble/trunk/projects/drooble_v1/config/config.php
5/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/autoload.php
6/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/composer/autoload_real.php
7/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/composer/ClassLoader.php
8/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/composer/autoload_static.php
9/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/ralouphie/getallheaders/src/getallheaders.php
10/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/guzzlehttp/promises/src/functions_include.php
11/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/guzzlehttp/promises/src/functions.php
12/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/guzzlehttp/psr7/src/functions_include.php
13/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/guzzlehttp/psr7/src/functions.php
14/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/guzzlehttp/guzzle/src/functions_include.php
15/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/guzzlehttp/guzzle/src/functions.php
16/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/react/promise/src/functions_include.php
17/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/react/promise/src/functions.php
18/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/mtdowling/jmespath.php/src/JmesPath.php
19/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/aws/aws-sdk-php/src/functions.php
20/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/facebook/php-sdk-v4/src/Facebook/polyfills.php
21/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/mixpanel/mixpanel-php/lib/Mixpanel.php
22/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/mixpanel/mixpanel-php/lib/Base/MixpanelBase.php
23/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/mixpanel/mixpanel-php/lib/Producers/MixpanelPeople.php
24/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/mixpanel/mixpanel-php/lib/Producers/MixpanelBaseProducer.php
25/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/mixpanel/mixpanel-php/lib/ConsumerStrategies/FileConsumer.php
26/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/mixpanel/mixpanel-php/lib/ConsumerStrategies/AbstractConsumer.php
27/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/mixpanel/mixpanel-php/lib/ConsumerStrategies/CurlConsumer.php
28/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/mixpanel/mixpanel-php/lib/ConsumerStrategies/SocketConsumer.php
29/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/mixpanel/mixpanel-php/lib/Producers/MixpanelEvents.php
30/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/mongodb/mongodb/src/functions.php
31/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/segmentio/analytics-php/lib/Segment.php
32/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/segmentio/analytics-php/lib/Segment/Client.php
33/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/segmentio/analytics-php/lib/Segment/Consumer.php
34/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/segmentio/analytics-php/lib/Segment/QueueConsumer.php
35/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/segmentio/analytics-php/lib/Segment/Consumer/File.php
36/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/segmentio/analytics-php/lib/Segment/Consumer/ForkCurl.php
37/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/segmentio/analytics-php/lib/Segment/Consumer/LibCurl.php
38/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/segmentio/analytics-php/lib/Segment/Consumer/Socket.php
39/var/www/rc/drooble/trunk/projects/drooble_v1/resources/lib/segmentio/analytics-php/lib/Segment/Version.php
40/var/www/rc/drooble/trunk/projects/drooble_v1/config/services.php
41/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/private/plugins/APIPrefetcher.php
42/var/www/rc/drooble/trunk/projects/drooble_v1/resources/library/Drooble/FW/DroobleSegment.php
43/var/www/rc/drooble/trunk/projects/drooble_v1/resources/helpers/DroobleApc.php
44/var/www/rc/drooble/trunk/projects/drooble_v1/resources/library/Drooble/FW/DroobleApp.php
45/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/private/config/router.php
46/var/www/rc/drooble/trunk/projects/drooble_v1/resources/library/Drooble/FW/DroobleRouter.php
47/var/www/rc/drooble/trunk/projects/drooble_v1/resources/helpers/Basic.php
48/var/www/rc/drooble/trunk/projects/drooble_v1/resources/library/Drooble/FW/DroobleHelper.php
49/var/www/rc/drooble/trunk/projects/drooble_v1/resources/library/Drooble/FW/DroobleSessionManager.php
50/var/www/rc/drooble/trunk/projects/drooble_v1/resources/library/Drooble/FW/DroobleRedisSessionAdapter.php
51/var/www/rc/drooble/trunk/projects/drooble_v1/resources/library/Drooble/FW/DroobleRedisDriver.php
52/var/www/rc/drooble/trunk/projects/drooble_v1/resources/helpers/UserSessions.php
53/var/www/rc/drooble/trunk/projects/drooble_v1/services/web/private/lib/mysql.class.php
Memory
Usage2097152