Phalcon Framework 3.4.5

PDOException: SQLSTATE[HY000] [2006] MySQL server has gone away

/var/www/html/apps/config/services.php (69)
#0PDO->__construct(mysql:host=10.10.128.46;port=3406;dbname=dancenight_info_CdvgXN4;charset=utf8, dancerlatino_uAxEtw, Xe4S8RLAvCK2ygnI1D0xoYPH, Array([3] => 2))
#1Phalcon\Db\Adapter\Pdo->connect(Array([host] => 10.10.128.46, [port] => 3406, [username] => dancerlatino_uAxEtw, [password] => Xe4S8RLAvCK2ygnI1D0xoYPH, [dbname] => dancenight_info_CdvgXN4, [charset] => utf8))
#2Phalcon\Db\Adapter\Pdo->__construct(Array([host] => 10.10.128.46, [port] => 3406, [username] => dancerlatino_uAxEtw, [password] => Xe4S8RLAvCK2ygnI1D0xoYPH, [dbname] => dancenight_info_CdvgXN4, [charset] => utf8))
/var/www/html/apps/config/services.php (69)
<?php
 
/**
 * Services are globally registered in this file
 */
 
use Phalcon\Mvc\Url as UrlResolver,
    Phalcon\DI\FactoryDefault,
    Phalcon\Mvc\Dispatcher,
    Phalcon\Session\Adapter\Files as SessionAdapter,
    Phalcon\Events\Manager as EventsManager,
    Apps\Plugin\SecurityPlugin,
    Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter,
    Phalcon\Crypt,
    Phalcon\Http\Response\Cookies,
    Phalcon\Cache\Frontend\Data as FrontData,
    Phalcon\Cache\Backend\File as BackFile,
    Phalcon\Cache\Backend\Memcache as BackMemCached;
 
/**
 * The FactoryDefault Dependency Injector automatically registers the right services to provide a full stack framework
 */
$di = new FactoryDefault();
 
/**
 * Read configuration
 */
$config = include APP_DIR. "/config/config.php";
$di->set('config', $config);
 
/**
 * Registering a router
 */
$di->set('router', function () {
    return require __DIR__ . '/routes.php';
});
 
$di->set('crypt', function()  use ($config) {
    $crypt = new Phalcon\Crypt();
    $crypt->setMode(MCRYPT_MODE_CFB);
    $crypt->setKey($config->cryptkey);
    return $crypt;
}, true);
 
 
$di->set('cookies', function() {
    $cookies = new Phalcon\Http\Response\Cookies();
//    $cookies->useEncryption(true);
    $cookies->useEncryption(false);
    return $cookies;
});
 
/**
 * The URL component is used to generate all kinds of URLs in the application
 */
//$di['url'] = function () {
//    $url = new UrlResolver();
//    $url->setBaseUri('');
//    return $url;
//};
 
$di['db'] = function () use ($config) {
    return new DbAdapter([
        "host" => $config->database->host,
        "port" => $config->database->port,
        "username" => $config->database->username,
        "password" => $config->database->password,
        "dbname" => $config->database->dbname,
        "charset" => $config->database->charset
    ]);
};
 
$di['dbbeta'] = function () use ($config) {
    return new DbAdapter(array(
        "host" => $config->database->host,
        "port" => $config->database->port,
        "username" => $config->database->username,
        "password" => $config->database->password,
        "dbname" => $config->database->dbbeta,
        "charset" => $config->database->charset
    ));
};
 
$di['dbcrypto'] = function () use ($config) {
    return new DbAdapter(array(
        "host" => $config->database->host,
        "port" => $config->database->port,
        "username" => $config->database->username,
        "password" => $config->database->password,
        "dbname" => $config->database->dbcrypto,
        "charset" => $config->database->charset
    ));
};
 
$di->set('cache', function() use ($config) {
 
    $frontCache = new FrontData(
        [
            "lifetime" => $config->cache->timeout,
        ]
    );
 
// Создаем компонент, который будет кэшировать данные в Memcache
// Настройки подключения к Memcache
//    $cache = new BackMemCached(
//        $frontCache,
//        [
//            "servers" => [
//                [
//                    "host"   => "127.0.0.1",
//                    "port"   => "11211",
//                    "weight" => "1",
//                ]
//            ]
//        ]
//    );
 
    $cache = new BackFile(
        $frontCache,
        [
            "cacheDir" => $config->cache->dir,
        ]
    );
 
    return $cache;
});
 
/**
 * Starts the session the first time some component requests the session service
 */
$di['session'] = function () {
    $session = new SessionAdapter();
    $session->start();
 
    return $session;
};
 
/***************************************************************************************************************
 * ACL контроль доступа
 * ***************************************************************************************************************/
//$di->set("acl", function() {
//    $acl = new \Phalcon\Acl\Adapter\Memory();
//    require APP_DIR.'/config/acl.php';
//    return $acl;
//});
 
/**
 * Register Mailer Service
 */
$di->set("mailer", function() use ($config) {
    return new \Phalcon\Ext\Mailer\Manager(
        array(
            'driver' => $config->mail->driver,
            'host'   => $config->mail->host,
            'port'   => $config->mail->port,
//            'encryption' => $config->mail->encryption,
            'username' => $config->mail->username,
            'password' => $config->mail->password,
            'from' => array(
                'email' => $config->mail->from->email,
                'name'  => $config->mail->from->name,
            ),
        )
    );
});
 
$di->set("storage", function() use ($config) {
    return new \Aws\S3\S3Client(
        array(
            'version' => 'latest',
            'endpoint' => 'https://storage.yandexcloud.net',
            'region' => 'ru-central1',
            'credentials' => [
                'key' => $config->storage->key_id,
                'secret' => $config->storage->key_value,
            ]
        )
    );
});
 
$di->set('flash', function() {
    $flash = new \Phalcon\Flash\Direct([
        'error'   => 'uk-alert uk-alert-danger uk-margin-small-top uk-margin-small-bottom',
        'success' => 'uk-alert uk-alert-success uk-margin-small-top uk-margin-small-bottom',
        'notice'  => 'uk-alert uk-margin-small-top uk-margin-small-bottom',
    ]);
    return $flash;
});
 
#3Closure->{closure}()
#4Phalcon\Di\Service->resolve(null, Object(Phalcon\Di\FactoryDefault))
#5Phalcon\Di->get(db, null)
#6Phalcon\Di->getShared(db)
#7Phalcon\Mvc\Model\Manager->_getConnection(Object(Apps\Models\GeoCityInfo: 14), null)
#8Phalcon\Mvc\Model\Manager->getReadConnection(Object(Apps\Models\GeoCityInfo: 14))
#9Phalcon\Mvc\Model->getReadConnection()
#10Phalcon\Mvc\Model\MetaData\Strategy\Introspection->getMetaData(Object(Apps\Models\GeoCityInfo: 14), Object(Phalcon\Di\FactoryDefault))
#11Phalcon\Mvc\Model\MetaData->_initialize(Object(Apps\Models\GeoCityInfo: 14), apps\models\geocityinfo-geo_city_info, geo_city_info, )
#12Phalcon\Mvc\Model\MetaData->readMetaData(Object(Apps\Models\GeoCityInfo: 14))
#13Phalcon\Mvc\Model\MetaData->hasAttribute(Object(Apps\Models\GeoCityInfo: 14), code)
#14Phalcon\Mvc\Model\Query->_getQualified(Array([type] => 355, [name] => code))
#15Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 355, [name] => code))
#16Phalcon\Mvc\Model\Query->_getSelectColumn(Array([type] => 354, [column] => Array([type] => 355, [name] => code)))
#17Phalcon\Mvc\Model\Query->_prepareSelect()
#18Phalcon\Mvc\Model\Query->parse()
#19Phalcon\Mvc\Model\Query->execute()
#20Phalcon\Mvc\Model::find(Array([columns] => code))
/var/www/html/apps/models/GeoCityInfo.php (352)
<?php
namespace Apps\Models;
 
use Apps\Models\SocialPostGroup;
 
class GeoCityInfo extends \Phalcon\Mvc\Model
{
//    /**
//     *
//     * @var integer
//     */
//    public $id;
//
//    /**
//     *
//     * @var string
//     */
//    public $code;
//
//    /**
//     *
//     * @var string
//     */
//    public $rec_status;
//
//    /**
//     *
//     * @var integer
//     */
//    public $regularize;
//
//    /**
//     *
//     * @var string
//     */
//    public $name;
 
    public function initialize()
    {
        $this->setSource('geo_city_info');
//        $this->setConnectionService('dbbeta');
    }
 
    /**
     * Independent Column Mapping.
     */
//    public function columnMap()
//    {
//        return array(
//            'id'         => 'id',
//            'code'       => 'code',
//            'key_ip'     => 'key_ip',
//            'key_social'     => 'key_social',
//            'key_social'     => 'key_social',
//            'external_key'     => 'external_key',
//            'enable'     => 'enable',
//            'regularize' => 'regularize',
//            'name'       => 'name'
//        );
//    }
 
    public function getCityList() {
        $citylist = $this::find(
            array(
//                "conditions" => 'enable = ?0',
//                "bind" => array('yes'),
                "order" => "regularize ASC, name ASC",
            )
        );
        return $citylist;
    }
 
    public function getCityListOld($active=true) {
        if ($active==true) {
            $citylist = $this::find(
                array(
                    "conditions" => 'enable = ?0',
                    "bind" => array('yes'),
                    "order" => "regularize ASC, name ASC",
                )
            );
        } else {
            $citylist = $this::find(
                array(
                    "order" => "name ASC",
                )
            );
        }
        return $citylist;
    }
 
    public function getCityInfoId($id) {
        $result = $this::findFirst(
            array(
                "conditions" => 'id = ?0',
                "bind" => array($id),
            )
        );
        return $result;
    }
 
    public function getCityPostList() {
        $citypack = [];
        $cityset = $this::find(
            array(
                "column" => 'id, name, enable',
//                "conditions" => 'rec_status = :status: AND key_city = :city: AND code != ""',
//                "bind"       => array('status' => "Y", 'city' => $this->view->city->id),
                "order" => "enable ASC, regularize ASC, name ASC",
            )
        );
 
        $posts = SocialPostGroup::find(
            [
                'columns' => 'count(*) as recs, key_city',
                'conditions' => 'post_status = "active"',
                'group' => 'key_city'
            ]
        );
 
        $tposts = [];
        foreach ($posts as $item) {
            $tposts[$item->key_city] = $item->recs;
        }
 
        foreach($cityset as $item) {
            $lcity = new \StdClass();
            $lcity->id = $item->id;
            $lcity->name = $item->name;
            $lcity->enable = $item->enable;
            if (isset($tposts[$item->id])) {
                $lcity->posts = (int)$tposts[$item->id];
                unset($tposts[$item->id]);
            } else {
                $lcity->posts = 0;
            }
            array_push($citypack,$lcity);
        }
        $cntOther = 0;
        $cntGlobal = 0;
        foreach ($tposts as $key => $item) {
            if ($key == 0) {
                $cntGlobal = $item;
            } else {
                $cntOther = $cntOther + $item;
            }
        }
        $lcity = new \StdClass();
        $lcity->id = 0;
        $lcity->name = 'Глобальные';
        $lcity->posts = $cntGlobal;
        $lcity->enable = "yes";
        array_push($citypack,$lcity);
        $lcity = new \StdClass();
        $lcity->id = -1;
        $lcity->name = 'Прочие';
        $lcity->posts = $cntOther;
        $lcity->enable = "yes";
        array_push($citypack,$lcity);
//        exit;
        return $citypack;
    }
 
    public function getCityLinkList() {
        $citypack = [];
 
        $cityset = $this::find(
            array(
                "column" => 'id, name, enable',
                "order" => "enable ASC, regularize ASC, name ASC",
            )
        );
 
        $posts = SocialPostGroup::find(
            [
                'columns' => 'count(*) as recs, key_city',
                'conditions' => 'post_status = "active"',
                'group' => 'key_city'
            ]
        );
 
        $links = InfLinkInfo::find(
            [
                'columns' => 'count(*) as recs, key_city',
                'conditions' => 'status = "new"',
                'group' => 'key_city'
            ]
        );
 
        $tposts = [];
        foreach ($posts as $item) {
            $tposts[$item->key_city] = $item->recs;
        }
        $tlinks = [];
        foreach ($links as $item) {
            $tlinks[$item->key_city] = $item->recs;
        }
 
        $lcity = new \StdClass();
        $lcity->id = '0';
        $lcity->name = 'Глобальные';
//        $lcity->posts = $tposts[0];
        $lcity->posts = 0;
        $lcity->enable = "yes";
//        array_push($citypack,$lcity);
 
        foreach($cityset as $item) {
            $lcity = new \StdClass();
            $lcity->id = $item->id;
            $lcity->name = $item->name;
            $lcity->enable = $item->enable;
            if (isset($tposts[$item->id])) {
                $lcity->posts = (int)$tposts[$item->id];
                unset($tposts[$item->id]);
            } else {
                $lcity->posts = 0;
            }
            if (isset($tlinks[$item->id])) {
                $lcity->links = (int)$tlinks[$item->id];
                unset($tlinks[$item->id]);
            } else {
                $lcity->links = 0;
            }
            array_push($citypack,$lcity);
        }
        $cntOther = 0;
        $cntGlobal = 0;
        foreach ($tposts as $key => $item) {
            if ($key == 0) {
                $cntGlobal = $item;
            } else {
                $cntOther = $cntOther + $item;
            }
        }
        $lcity = new \StdClass();
        $lcity->id = '-1';
        $lcity->name = 'Прочие';
        $lcity->links = $cntOther;
        $lcity->posts = 0;
        $lcity->enable = "yes";
        array_push($citypack,$lcity);
        return $citypack;
    }
 
    public function getCityLinkListOld() {
        $citypack = [];
 
        $cityset = $this::find(
            array(
                "column" => 'id, name, enable',
                "order" => "enable ASC, regularize ASC, name ASC",
            )
        );
 
        $posts = SocialPostGroup::find(
            [
                'columns' => 'count(*) as recs, key_city',
                'conditions' => 'post_status = "active"',
                'group' => 'key_city'
            ]
        );
 
        $links = InfLinkInfo::find(
            [
                'columns' => 'count(*) as recs, key_city',
                'conditions' => 'status = "new"',
                'group' => 'key_city'
            ]
        );
 
        $tposts = [];
        foreach ($posts as $item) {
            $tposts[$item->key_city] = $item->recs;
        }
        $tlinks = [];
        foreach ($links as $item) {
            $tlinks[$item->key_city] = $item->recs;
        }
 
        $lcity = new \StdClass();
        $lcity->id = '0';
        $lcity->name = 'Глобальные';
        $lcity->posts = $tposts[0];
        $lcity->enable = "yes";
        array_push($citypack,$lcity);
 
        foreach($cityset as $item) {
            $lcity = new \StdClass();
            $lcity->id = $item->id;
            $lcity->name = $item->name;
            $lcity->enable = $item->enable;
            if (isset($tposts[$item->id])) {
                $lcity->posts = (int)$tposts[$item->id];
                unset($tposts[$item->id]);
            } else {
                $lcity->posts = 0;
            }
            if (isset($tlinks[$item->id])) {
                $lcity->links = (int)$tlinks[$item->id];
                unset($tlinks[$item->id]);
            } else {
                $lcity->links = 0;
            }
            array_push($citypack,$lcity);
        }
        $cntOther = 0;
        $cntGlobal = 0;
        foreach ($tposts as $key => $item) {
            if ($key == 0) {
                $cntGlobal = $item;
            } else {
                $cntOther = $cntOther + $item;
            }
        }
        $lcity = new \StdClass();
        $lcity->id = '-1';
        $lcity->name = 'Прочие';
        $lcity->links = $cntOther;
        $lcity->posts = 0;
        $lcity->enable = "yes";
        array_push($citypack,$lcity);
        return $citypack;
    }
 
    public function getList($set) {
        if (is_array($set)) {
            if (count($set) > 0) {
                $citylist = $this::find(
                    array(
                        "conditions" => 'id IN ('.implode(',',$set).')',
                    )
                );
            }
        } else {
        }
        $citylistset = [];
        foreach ($citylist as $item) {
            $citylistset[(int)$item->id] = $item;
        }
        return $citylistset;
    }
 
    public function getCityCode($active=true) {
        $set = [];
        if ($active==true) {
            $citylist = $this::find([
                "columns" => 'code',
                "conditions" => 'enable = ?0',
                "bind" => ['yes'],
            ]);
        } else {
            $citylist = $this::find(["columns" => 'code']);
        }
        foreach ($citylist as $cityinfo) {
            array_push($set,$cityinfo->code);
        }
        return $set;
    }
 
    public function getListRest() {
        $citylist = $this::find([
            "conditions" => '',
            "bind" => []
        ]);
        $citylistset = [];
        foreach ($citylist as $item) {
            $citylistset[(int)$item->id] = [
                'id' => $item->id,
                'name' => $item->name,
                'key_country' => $item->key_country,
                'code' => $item->code,
                'enable' => $item->enable,
            ];
        }
        return $citylistset;
    }
 
    public function reJson() {
        $cities = $this->find();
        foreach ($cities as $city) {
            $curCity = $this->findFirst([
                'conditions' => 'id = ?0',
                'bind' => [$city->id]
            ]);
            $api_set = json_decode($curCity->api_set, true);
            $curCity->ipapi_ip = $api_set['info']['ip'];
            $curCity->ipapi_city = $api_set['ipapi']['city'];
            $curCity->ipapi_region = $api_set['ipapi']['region'];
            $curCity->ipapi_country = $api_set['ipapi']['country'];
            $curCity->update();
        }
    }
 
}
#21Apps\Models\GeoCityInfo->getCityCode(false)
/var/www/html/apps/config/routes.php (13)
<?php
 
use Phalcon\Mvc\Router;
use Apps\Models\GeoCityInfo;
use Phalcon\Mvc\Router\Group as RouterGroup;
 
/*
 * Define custom routes. File gets included in the router service definition.
 */
$router = new Phalcon\Mvc\Router(false);
 
$city = new GeoCityInfo();
$citylist = $city->getCityCode(false);
//var_dump($citylist);
 
$router->setDefaultModule('main');
$router->setDefaultController('index');
$router->setDefaultAction('index');
$router->removeExtraSlashes(true);
 
$modules = ['control','api','user'];
$controllers = [];
$static = ['piecemeal'];
 
$router->notFound([
    'module'     => "main",
    "controller" => "error",
    "action"     => "error404",
]);
 
#   Маршруты ЧПУ
$router->add("/",[
    "controller" => "index",
    "action"     => "index",
]);
 
# Статьи
$router->add("/read/{articleid:[0-9]+}_{articlelink:[_a-z0-9]+}",[
    "controller" => "article",
    "action"     => "info",
]);
 
 
$router->add("/seal",[
    "controller" => "seal",
    "action"     => "map",
]);
 
$router->add("/seal/login",[
    "controller" => "seal",
    "action"     => "index",
]);
 
$router->add("/vdemo",[
    "controller" => "seal",
    "action"     => "demo",
]);
 
#Карта
$router->add("/person/map/{userid:[0-9]+}",[
    "controller" => "person",
    "action"     => "map",
]);
 
$router->add("/{citycode:(".implode('|',$citylist).")}",[
    "controller" => "index",
    "action"     => "info",
]);
 
# Вечеринки
$router->add("/{citycode:(".implode('|',$citylist).")}/party",[
    "controller" => "event",
    "action"     => "partylist",
]);
 
$router->add("/{citycode:(".implode('|',$citylist).")}/party/history",[
    "controller" => "event",
    "action"     => "partyhistory",
]);
 
# События
$router->add("/{citycode:(".implode('|',$citylist).")}/event",[
    "controller" => "event",
    "action"     => "eventlist",
]);
 
$router->add("/{citycode:(".implode('|',$citylist).")}/event/history",[
    "controller" => "event",
    "action"     => "eventhistory",
]);
 
# Тренинги
$router->add("/{citycode:(".implode('|',$citylist).")}/training",[
    "controller" => "event",
    "action"     => "traininglist",
]);
 
$router->add("/{citycode:(".implode('|',$citylist).")}/training/history",[
    "controller" => "event",
    "action"     => "traininghistory",
]);
 
 
# Фотоотчеты
$router->add("/{citycode:(".implode('|',$citylist).")}/report",[
    "controller" => "event",
    "action"     => "reportlist",
]);
 
$router->add("/{citycode:(".implode('|',$citylist).")}/(party|outdoor|concert|other|festival|weekend|master|intensive|contest)/{partyid:[0-9]+}_{partylink:[_a-z0-9]+}",[
    "controller" => "event",
    "action"     => "eventinfo",
]);
 
# Студии
$router->add("/{citycode:(".implode('|',$citylist).")}/studio",[
    "controller" => "studio",
    "action"     => "index",
]);
 
$router->add("/{citycode:(".implode('|',$citylist).")}/studio/{studioid:[0-9]+}_{studiolink:[_a-z0-9]+}",[
    "controller" => "studio",
    "action"     => "info",
]);
 
$router->add("/{citycode:(".implode('|',$citylist).")}/studio/{studioid:[0-9]+}_{studiolink:[_a-z0-9]+}/{action:[a-z]+}",[
    "controller" => "studio",
    "action"     => "info",
]);
 
$router->add("/crypto",[
    "controller" => "crypto",
    "action"     => "index",
]);
 
#   Маршруты для доступа
$router->add("/login",[
    'module'     => "main",
    "controller" => "access",
    "action"     => "index",
]);
 
$router->add("/vklogin",[
    'module'     => "main",
    "controller" => "access",
    "action"     => "vklogin",
]);
 
$router->add("/logout",[
    'module'     => "main",
    "controller" => "access",
    "action"     => "logout",
]);
 
$router->add("/signup",[
    'module'     => "main",
    "controller" => "access",
    "action"     => "signup",
]);
 
$router->add("/registered",[
    'module'     => "main",
    "controller" => "access",
    "action"     => "registered",
]);
 
$router->add("/confirm/{code:[_a-zA-Z0-9-]+}",[
    'module'     => "main",
    "controller" => "access",
    "action"     => "confirm",
]);
 
$router->add("/confirm",[
    'module'     => "main",
    "controller" => "access",
    "action"     => "confirm",
]);
 
$router->add("/recovery",[
    'module'     => "main",
    "controller" => "access",
    "action"     => "recovery",
]);
 
$router->add("/reset/{code:[_a-zA-Z0-9-]+}",[
    'module'     => "main",
    "controller" => "access",
    "action"     => "reset",
]);
 
$router->add("/reset",[
    'module'     => "main",
    "controller" => "access",
    "action"     => "reset",
]);
 
$router->add("/social",[
    'module'     => "main",
    "controller" => "access",
    "action"     => "social",
]);
 
#   Маршруты для модулей
$router->add('/('.implode('|',$modules).')', [
    'module'     => 1
]);
 
$router->add('/('.implode('|',$modules).')/:controller', [
    'module'     => 1,
    'controller' => 2,
]);
 
$router->add('/('.implode('|',$modules).')/:controller/:action/:params', [
    'module'     => 1,
    'controller' => 2,
    'action'     => 3,
    'params'     => 4
]);
 
if (count($controllers) > 0) {
    $router->add('/('.implode('|',$controllers).')', [
        'module'     => 'main',
        'controller' => 1,
    ]);
 
    $router->add('/('.implode('|',$controllers).')/:action', [
        'module'     => 'main',
        'controller' => 1,
        'action' => 2,
    ]);
}
 
if (count($static) > 0) {
    $router->add('/('.implode('|',$static).')', [
        'module'     => 'main',
        'controller' => 'static',
        'action' => 1,
    ]);
}
 
$router->add('/radio', [
    'module'     => 'main',
    'controller' => 'radio',
    'action' => 'index',
]);
 
$router->addGet("/rest/dictionary",[
    'module'     => 'rest',
    "controller" => "dictionary",
    "action"     => "getList",
]);
 
$router->addGet("/rest/society/studio",[
    'module'     => 'rest',
    "controller" => "studio",
    "action"     => "getList",
]);
 
$router->addGet("/rest/society/studiomain",[
    'module'     => 'rest',
    "controller" => "studio",
    "action"     => "getStudioMain",
]);
 
$router->addGet("/rest/society/{id:[0-9]+}",[
    'module'     => 'rest',
    "controller" => "studio",
    "action"     => "getItem",
]);
 
$router->addGet("/rest/event/party",[
    'module'     => 'rest',
    "controller" => "event",
    "action"     => "getPartyList",
]);
 
$router->addGet("/rest/event/partymain",[
    'module'     => 'rest',
    "controller" => "event",
    "action"     => "getPartyListMain",
]);
 
$router->addGet("/rest/event/globalmain",[
    'module'     => 'rest',
    "controller" => "event",
    "action"     => "getGlobalListMain",
]);
 
$router->addGet("/rest/event/global",[
    'module'     => 'rest',
    "controller" => "event",
    "action"     => "getGlobalList",
]);
 
$router->addGet("/rest/event/{id:[0-9]+}",[
    'module'     => 'rest',
    "controller" => "event",
    "action"     => "getItem",
]);
 
$router->addGet("/rest/service/city",[
    'module'     => 'rest',
    "controller" => "service",
    "action"     => "getCity",
]);
 
//$testRoutes = [
//    '/piter',
//    'piter/studio/101_madrid',
//];
//foreach ($testRoutes as $testRoute) {
//    //Handle the route
//    $router->handle($testRoute);
//    echo 'Testing ', $testRoute, '<br>';
//    //Check if some route was matched
//    if ($router->wasMatched()) {
//        echo 'Module: ', $router->getModuleName(), '<br>';
//        echo 'Controller: ', $router->getControllerName(), '<br>';
//        echo 'Action: ', $router->getActionName(), '<br>';
//    } else {
//        echo 'The route wasn\'t matched by any route<br>';
//    }
//    echo '<br>';
//}
//exit;
 
return $router;
#22require(/var/www/html/apps/config/routes.php)
/var/www/html/apps/config/services.php (35)
<?php
 
/**
 * Services are globally registered in this file
 */
 
use Phalcon\Mvc\Url as UrlResolver,
    Phalcon\DI\FactoryDefault,
    Phalcon\Mvc\Dispatcher,
    Phalcon\Session\Adapter\Files as SessionAdapter,
    Phalcon\Events\Manager as EventsManager,
    Apps\Plugin\SecurityPlugin,
    Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter,
    Phalcon\Crypt,
    Phalcon\Http\Response\Cookies,
    Phalcon\Cache\Frontend\Data as FrontData,
    Phalcon\Cache\Backend\File as BackFile,
    Phalcon\Cache\Backend\Memcache as BackMemCached;
 
/**
 * The FactoryDefault Dependency Injector automatically registers the right services to provide a full stack framework
 */
$di = new FactoryDefault();
 
/**
 * Read configuration
 */
$config = include APP_DIR. "/config/config.php";
$di->set('config', $config);
 
/**
 * Registering a router
 */
$di->set('router', function () {
    return require __DIR__ . '/routes.php';
});
 
$di->set('crypt', function()  use ($config) {
    $crypt = new Phalcon\Crypt();
    $crypt->setMode(MCRYPT_MODE_CFB);
    $crypt->setKey($config->cryptkey);
    return $crypt;
}, true);
 
 
$di->set('cookies', function() {
    $cookies = new Phalcon\Http\Response\Cookies();
//    $cookies->useEncryption(true);
    $cookies->useEncryption(false);
    return $cookies;
});
 
/**
 * The URL component is used to generate all kinds of URLs in the application
 */
//$di['url'] = function () {
//    $url = new UrlResolver();
//    $url->setBaseUri('');
//    return $url;
//};
 
$di['db'] = function () use ($config) {
    return new DbAdapter([
        "host" => $config->database->host,
        "port" => $config->database->port,
        "username" => $config->database->username,
        "password" => $config->database->password,
        "dbname" => $config->database->dbname,
        "charset" => $config->database->charset
    ]);
};
 
$di['dbbeta'] = function () use ($config) {
    return new DbAdapter(array(
        "host" => $config->database->host,
        "port" => $config->database->port,
        "username" => $config->database->username,
        "password" => $config->database->password,
        "dbname" => $config->database->dbbeta,
        "charset" => $config->database->charset
    ));
};
 
$di['dbcrypto'] = function () use ($config) {
    return new DbAdapter(array(
        "host" => $config->database->host,
        "port" => $config->database->port,
        "username" => $config->database->username,
        "password" => $config->database->password,
        "dbname" => $config->database->dbcrypto,
        "charset" => $config->database->charset
    ));
};
 
$di->set('cache', function() use ($config) {
 
    $frontCache = new FrontData(
        [
            "lifetime" => $config->cache->timeout,
        ]
    );
 
// Создаем компонент, который будет кэшировать данные в Memcache
// Настройки подключения к Memcache
//    $cache = new BackMemCached(
//        $frontCache,
//        [
//            "servers" => [
//                [
//                    "host"   => "127.0.0.1",
//                    "port"   => "11211",
//                    "weight" => "1",
//                ]
//            ]
//        ]
//    );
 
    $cache = new BackFile(
        $frontCache,
        [
            "cacheDir" => $config->cache->dir,
        ]
    );
 
    return $cache;
});
 
/**
 * Starts the session the first time some component requests the session service
 */
$di['session'] = function () {
    $session = new SessionAdapter();
    $session->start();
 
    return $session;
};
 
/***************************************************************************************************************
 * ACL контроль доступа
 * ***************************************************************************************************************/
//$di->set("acl", function() {
//    $acl = new \Phalcon\Acl\Adapter\Memory();
//    require APP_DIR.'/config/acl.php';
//    return $acl;
//});
 
/**
 * Register Mailer Service
 */
$di->set("mailer", function() use ($config) {
    return new \Phalcon\Ext\Mailer\Manager(
        array(
            'driver' => $config->mail->driver,
            'host'   => $config->mail->host,
            'port'   => $config->mail->port,
//            'encryption' => $config->mail->encryption,
            'username' => $config->mail->username,
            'password' => $config->mail->password,
            'from' => array(
                'email' => $config->mail->from->email,
                'name'  => $config->mail->from->name,
            ),
        )
    );
});
 
$di->set("storage", function() use ($config) {
    return new \Aws\S3\S3Client(
        array(
            'version' => 'latest',
            'endpoint' => 'https://storage.yandexcloud.net',
            'region' => 'ru-central1',
            'credentials' => [
                'key' => $config->storage->key_id,
                'secret' => $config->storage->key_value,
            ]
        )
    );
});
 
$di->set('flash', function() {
    $flash = new \Phalcon\Flash\Direct([
        'error'   => 'uk-alert uk-alert-danger uk-margin-small-top uk-margin-small-bottom',
        'success' => 'uk-alert uk-alert-success uk-margin-small-top uk-margin-small-bottom',
        'notice'  => 'uk-alert uk-margin-small-top uk-margin-small-bottom',
    ]);
    return $flash;
});
 
#23Closure->{closure}()
#24Phalcon\Di\Service->resolve(null, Object(Phalcon\Di\FactoryDefault))
#25Phalcon\Di->get(router, null)
#26Phalcon\Di->getShared(router)
#27Phalcon\Mvc\Application->handle(/nizhniy/studio)
/var/www/html/indance.info/index.php (58)
<?php
 
use Phalcon\Mvc\Application;
 
//try {
    date_default_timezone_set('Europe/Moscow');
    define('BASE_DIR', dirname(__DIR__));
    define('APP_DIR', BASE_DIR . '/apps');
 
    \Phalcon\Mvc\Model::setup(array(
        'notNullValidations' => false
    ));
 
    /**
     * Read the configuration
     */
    $config = include APP_DIR . '/config/config.php';
 
    if ($config->mode == 'public') {
        ini_set("display_errors", 0);
        error_reporting(0);
    } else {
        error_reporting(E_ALL);
        ini_set("display_errors", 1);
        $debug = new \Phalcon\Debug();
        $debug->listen();
    }
 
    /**
     * Read auto-loader
     */
    include APP_DIR . '/config/loader.php';
 
    /**
     * Include services
     */
    require APP_DIR.'/config/services.php';
 
    /**
     * Include services
     */
//    require APP_DIR.'/config/security.php';
 
    /**
     * Handle the request
     */
    $application = new Application($di);
 
    /**
     * Include modules
     */
    require APP_DIR. '/config/modules.php';
 
//    print $_SERVER["REQUEST_URI"];
//    var_dump(parse_url ($_SERVER["REQUEST_URI"], PHP_URL_PATH));
//    exit;
 
    echo $application->handle(parse_url ($_SERVER["REQUEST_URI"], PHP_URL_PATH))->getContent();
 
//} catch (Exception $e) {
//    echo $e->getMessage();
//}
KeyValue
KeyValue
SUPERVISOR_GROUP_NAMEphp-fpm
WEB_DOCUMENT_INDEXindex.php
SUPERVISOR_SERVER_URLunix:///.supervisor.sock
HOSTNAMEfece1df6a622
PHP_VERSION7.3.33
PHP_SENDMAIL_PATH/usr/sbin/sendmail -t -i
PHP_INI_DIR/usr/local/etc/php
GPG_KEYSCBAF69F173A0FEA4B537F470D66C9593118BCCB6 F38252826ACD957EF380D39F2F7956BC5DA04B5D
DB_BASEdancenight_info_CdvgXN4
PHP_LDFLAGS-Wl,-O1 -pie
WEB_DOCUMENT_ROOT/var/www/html/indance.info
PWD/var/www/html
S3_PUBLIChttps://media.indance.info/images
S3_KEY_ID
WEB_ALIAS_DOMAIN*.vm
WEB_PHP_TIMEOUT600
DB_PORT3406
SERVICE_NGINX_CLIENT_MAX_BODY_SIZE50m
LD_PRELOAD/usr/lib/preloadable_libiconv.so
DB_USERdancerlatino_uAxEtw
HOME/home/application
LANGC.UTF-8
APPLICATION_GID1000
DOCKER_CONF_HOME/opt/docker/
PHP_SHA256166eaccde933381da9516a2b70ad0f447d7cec4b603d07b9a916032b215b90cc
PHPIZE_DEPSautoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c
WEB_PHP_SOCKET127.0.0.1:9000
S3_SOURCEindance-media.s3-website.us-east-1.amazonaws.com
TERMxterm
DB_HOST10.10.128.46
PHP_URLhttps://www.php.net/distributions/php-7.3.33.tar.xz
S3_KEY_VALUE
APPLICATION_GROUPapplication
SHLVL0
COMPOSER_VERSION2
APPLICATION_USERapplication
PHP_CFLAGS-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
DB_CHARSETutf8
PHP_DATE_TIMEZONEEurope/Moscow
APPLICATION_UID1000
LOG_STDOUT/proc/1/fd/1
SUPERVISOR_PROCESS_NAMEphp-fpmd
LC_ALLC.UTF-8
PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
S3_BUCKETindance-media
LOG_STDERR/proc/1/fd/2
CONTAINER_UIDapplication
DB_PASSXe4S8RLAvCK2ygnI1D0xoYPH
APPLICATION_PATH/app
S3_PATHimages
PHP_ASC_URLhttps://www.php.net/distributions/php-7.3.33.tar.xz.asc
PHP_CPPFLAGS-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
SUPERVISOR_ENABLED1
VIPSHOME/usr
USERapplication
HTTP_ACCEPT_ENCODINGgzip, br, zstd, deflate
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_ACCEPT*/*
HTTP_CONNECTIONclose
HTTP_X_REAL_IP216.73.216.149
HTTP_X_FORWARDED_FOR216.73.216.149
HTTP_HOSTindance.info
SCRIPT_FILENAME/var/www/html/indance.info/index.php
REDIRECT_STATUS200
SERVER_NAME_
SERVER_PORT80
SERVER_ADDR192.168.176.2
REMOTE_PORT39530
REMOTE_ADDR192.168.176.1
SERVER_SOFTWAREnginx/1.20.2
GATEWAY_INTERFACECGI/1.1
REQUEST_SCHEMEhttp
SERVER_PROTOCOLHTTP/1.0
DOCUMENT_ROOT/var/www/html/indance.info
DOCUMENT_URI/index.php
REQUEST_URI/nizhniy/studio
SCRIPT_NAME/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHODGET
QUERY_STRING
FCGI_ROLERESPONDER
PHP_SELF/index.php
REQUEST_TIME_FLOAT1767174201.9661
REQUEST_TIME1767174201
argvArray()
argc0
#Path
0/var/www/html/indance.info/index.php
1/var/www/html/apps/config/config.php
2/var/www/html/apps/config/loader.php
3/var/www/html/apps/vendor/autoload.php
4/var/www/html/apps/vendor/composer/autoload_real.php
5/var/www/html/apps/vendor/composer/platform_check.php
6/var/www/html/apps/vendor/composer/ClassLoader.php
7/var/www/html/apps/vendor/composer/autoload_static.php
8/var/www/html/apps/vendor/react/promise/src/functions_include.php
9/var/www/html/apps/vendor/react/promise/src/functions.php
10/var/www/html/apps/vendor/ralouphie/getallheaders/src/getallheaders.php
11/var/www/html/apps/vendor/symfony/polyfill-mbstring/bootstrap.php
12/var/www/html/apps/vendor/swiftmailer/swiftmailer/lib/swift_required.php
13/var/www/html/apps/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
14/var/www/html/apps/vendor/mtdowling/jmespath.php/src/JmesPath.php
15/var/www/html/apps/vendor/guzzlehttp/psr7/src/functions_include.php
16/var/www/html/apps/vendor/guzzlehttp/psr7/src/functions.php
17/var/www/html/apps/vendor/guzzlehttp/promises/src/functions_include.php
18/var/www/html/apps/vendor/guzzlehttp/promises/src/functions.php
19/var/www/html/apps/vendor/facebook/graph-sdk/src/Facebook/polyfills.php
20/var/www/html/apps/vendor/aws/aws-sdk-php/src/functions.php
21/var/www/html/apps/config/services.php
22/var/www/html/apps/config/modules.php
23/var/www/html/apps/config/routes.php
24/var/www/html/apps/models/GeoCityInfo.php
Memory
Usage2097152