Major updates
Added support: 1. Composer for packages below; 2. symfony/polyfill to work with newer versions of php 3. filp/whoops to display php errors on screen 4. monolog/monolog for logging errors to a file and browser console
This commit is contained in:
parent
abab8bccea
commit
61b7226828
6 changed files with 53 additions and 3 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
.idea
|
||||||
|
.vscode
|
|
@ -22,7 +22,13 @@
|
||||||
$start_point = $_SERVER['REQUEST_TIME'];
|
$start_point = $_SERVER['REQUEST_TIME'];
|
||||||
|
|
||||||
$mcache = new Memcache;
|
$mcache = new Memcache;
|
||||||
$mcache->connect('127.0.0.1', 11211) or exit('Ошибка: #mc0, обновите страницу позже, если ошибка повторяется, обратитесь в тех.поддержку: <a href="https://enginegp.ru">EGPv3</a>');
|
$mcache->connect('127.0.0.1', 11211) or exit('Ошибка подключения Memcache');
|
||||||
|
|
||||||
|
// Composer
|
||||||
|
if (!file_exists(ROOT.'vendor/autoload.php')) {
|
||||||
|
die('Please <a href="https://getcomposer.org/download/" target="_blank" rel="noreferrer" style="color:#0a25bb;">install composer</a> and run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">composer install</code>');
|
||||||
|
}
|
||||||
|
require(ROOT.'vendor/autoload.php');
|
||||||
|
|
||||||
// Настройки
|
// Настройки
|
||||||
include(DATA.'config.php');
|
include(DATA.'config.php');
|
||||||
|
|
7
composer.json
Normal file
7
composer.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"symfony/polyfill": "1.28.0",
|
||||||
|
"filp/whoops": "2.15.4",
|
||||||
|
"monolog/monolog": "2.9.2"
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,7 +24,13 @@
|
||||||
$start_point = $_SERVER['REQUEST_TIME'];
|
$start_point = $_SERVER['REQUEST_TIME'];
|
||||||
|
|
||||||
$mcache = new Memcache;
|
$mcache = new Memcache;
|
||||||
$mcache->connect('127.0.0.1', 11211) or exit('Ошибка: #mc0, обновите страницу позже, если ошибка повторяется, обратитесь в тех.поддержку: <a href="https://enginegp.ru">EGPv3</a>');
|
$mcache->connect('127.0.0.1', 11211) or exit('Ошибка подключения Memcache');
|
||||||
|
|
||||||
|
// Composer
|
||||||
|
if (!file_exists(ROOT.'vendor/autoload.php')) {
|
||||||
|
die('Please <a href="https://getcomposer.org/download/" target="_blank" rel="noreferrer" style="color:#0a25bb;">install composer</a> and run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">composer install</code>');
|
||||||
|
}
|
||||||
|
require(ROOT.'vendor/autoload.php');
|
||||||
|
|
||||||
// Настройки
|
// Настройки
|
||||||
include(DATA.'config.php');
|
include(DATA.'config.php');
|
||||||
|
|
|
@ -2,6 +2,21 @@
|
||||||
if(!DEFINED('EGP'))
|
if(!DEFINED('EGP'))
|
||||||
exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
|
exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
|
||||||
|
|
||||||
|
// Подключение filp/whoops
|
||||||
|
$whoops = new \Whoops\Run;
|
||||||
|
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
|
||||||
|
$whoops->register();
|
||||||
|
// Логи в консоль браузера
|
||||||
|
$loggingInConsole = new \Whoops\Handler\PlainTextHandler();
|
||||||
|
$loggingInConsole->loggerOnly(true);
|
||||||
|
$loggingInConsole->setLogger((new \Monolog\Logger('EngineGP', [(new \Monolog\Handler\BrowserConsoleHandler())->setFormatter((new \Monolog\Formatter\LineFormatter(null, null, true)))])));
|
||||||
|
$whoops->pushHandler($loggingInConsole);
|
||||||
|
// Логи в файл
|
||||||
|
$loggingInFile = new \Whoops\Handler\PlainTextHandler();
|
||||||
|
$loggingInFile->loggerOnly(true);
|
||||||
|
$loggingInFile->setLogger((new \Monolog\Logger('EngineGP', [(new \Monolog\Handler\StreamHandler(DIR . 'logs/enginegp.log'))->setFormatter((new \Monolog\Formatter\LineFormatter(null, null, true)))])));
|
||||||
|
$whoops->pushHandler($loggingInFile);
|
||||||
|
|
||||||
$device = '!mobile';
|
$device = '!mobile';
|
||||||
|
|
||||||
// Парсинг адреса
|
// Парсинг адреса
|
||||||
|
|
|
@ -1,8 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if(!DEFINED('EGP'))
|
if(!DEFINED('EGP'))
|
||||||
exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
|
exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
|
||||||
|
|
||||||
|
// Подключение filp/whoops
|
||||||
|
$whoops = new \Whoops\Run;
|
||||||
|
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
|
||||||
|
$whoops->register();
|
||||||
|
// логи в консоль браузера
|
||||||
|
$loggingInConsole = new \Whoops\Handler\PlainTextHandler();
|
||||||
|
$loggingInConsole->loggerOnly(true);
|
||||||
|
$loggingInConsole->setLogger((new \Monolog\Logger('EngineGP', [(new \Monolog\Handler\BrowserConsoleHandler())->setFormatter((new \Monolog\Formatter\LineFormatter(null, null, true)))])));
|
||||||
|
$whoops->pushHandler($loggingInConsole);
|
||||||
|
// логи в файл
|
||||||
|
$loggingInFile = new \Whoops\Handler\PlainTextHandler();
|
||||||
|
$loggingInFile->loggerOnly(true);
|
||||||
|
$loggingInFile->setLogger((new \Monolog\Logger('EngineGP', [(new \Monolog\Handler\StreamHandler(DIR . 'logs/enginegp.log'))->setFormatter((new \Monolog\Formatter\LineFormatter(null, null, true)))])));
|
||||||
|
$whoops->pushHandler($loggingInFile);
|
||||||
|
|
||||||
// Парсинг адреса
|
// Парсинг адреса
|
||||||
$url = is_array(sys::url()) ? sys::url() : array();
|
$url = is_array(sys::url()) ? sys::url() : array();
|
||||||
$route = sys::url(false);
|
$route = sys::url(false);
|
||||||
|
|
Loading…
Reference in a new issue