mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Squashed commit of the following:
commit 94a61f32ae20d6b772ac90ef68ff983e1a082422 Merge: 57772569 8227303b Author: slawkens <slawkens@gmail.com> Date: Sat Nov 11 11:11:13 2023 +0100 Merge branch 'develop' into feature/debug-bar commit 577725690d177c6bb3af440e51b27a81b1723818 Author: slawkens <slawkens@gmail.com> Date: Mon Aug 21 11:08:12 2023 +0200 Add option to enable debugbar, even if dev mode is disabled commit c227fd4e9655f2dd7c1de0955f99e607c6881cbf Merge: 9fef84bf a692607c Author: slawkens <slawkens@gmail.com> Date: Mon Aug 21 10:20:04 2023 +0200 Merge branch 'develop' into feature/debug-bar commit 9fef84bffe63eb7bf0fcf68811873393164cb543 Author: slawkens <slawkens@gmail.com> Date: Fri Aug 11 06:39:50 2023 +0200 Fix debugBar mysql logs (Thanks @gpedro) commit dedd54286f6f086cb78287a5c1cd0f8cc9155984 Author: slawkens <slawkens@gmail.com> Date: Thu Aug 10 13:21:36 2023 +0200 Log PDO queries, as stated in docs, but doesn't work yet (don't know the reason) commit 7403a24030d75e525467dcaad937a4b14fd4ffae Author: slawkens <slawkens@gmail.com> Date: Thu Aug 10 13:21:20 2023 +0200 Use dev-master, cause of some bugs appearing commit cc7aec8e28c8839b2640ca9a7f62a1b4464fdbb3 Author: slawkens <slawkens@gmail.com> Date: Thu Aug 10 13:05:02 2023 +0200 Init debugBar
This commit is contained in:
parent
8227303b89
commit
d582120fac
@ -30,6 +30,27 @@ if(!$db->hasTable('myaac_account_actions')) {
|
|||||||
throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
|
throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hooks->register('debugbar_admin_head_end', HOOK_ADMIN_HEAD_END, function ($params) {
|
||||||
|
global $debugBar;
|
||||||
|
|
||||||
|
if (!isset($debugBar)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$debugBarRenderer = $debugBar->getJavascriptRenderer();
|
||||||
|
echo $debugBarRenderer->renderHead();
|
||||||
|
});
|
||||||
|
$hooks->register('debugbar_admin_body_end', HOOK_ADMIN_BODY_END, function ($params) {
|
||||||
|
global $debugBar;
|
||||||
|
|
||||||
|
if (!isset($debugBar)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$debugBarRenderer = $debugBar->getJavascriptRenderer();
|
||||||
|
echo $debugBarRenderer->render();
|
||||||
|
});
|
||||||
|
|
||||||
require SYSTEM . 'status.php';
|
require SYSTEM . 'status.php';
|
||||||
require SYSTEM . 'login.php';
|
require SYSTEM . 'login.php';
|
||||||
require __DIR__ . '/includes/functions.php';
|
require __DIR__ . '/includes/functions.php';
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
"peppeocchi/php-cron-scheduler": "4.*"
|
"peppeocchi/php-cron-scheduler": "4.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"filp/whoops": "^2.15"
|
"filp/whoops": "^2.15",
|
||||||
|
"maximebf/debugbar": "dev-master"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
@ -469,20 +469,30 @@ function tickers()
|
|||||||
*/
|
*/
|
||||||
function template_place_holder($type): string
|
function template_place_holder($type): string
|
||||||
{
|
{
|
||||||
global $twig, $template_place_holders;
|
global $twig, $template_place_holders, $debugBar;
|
||||||
$ret = '';
|
$ret = '';
|
||||||
|
|
||||||
|
if (isset($debugBar)) {
|
||||||
|
$debugBarRenderer = $debugBar->getJavascriptRenderer();
|
||||||
|
}
|
||||||
|
|
||||||
if(array_key_exists($type, $template_place_holders) && is_array($template_place_holders[$type]))
|
if(array_key_exists($type, $template_place_holders) && is_array($template_place_holders[$type]))
|
||||||
$ret = implode($template_place_holders[$type]);
|
$ret = implode($template_place_holders[$type]);
|
||||||
|
|
||||||
if($type === 'head_start') {
|
if($type === 'head_start') {
|
||||||
$ret .= template_header();
|
$ret .= template_header();
|
||||||
|
if (isset($debugBar)) {
|
||||||
|
$ret .= $debugBarRenderer->renderHead();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif ($type === 'body_start') {
|
elseif ($type === 'body_start') {
|
||||||
$ret .= $twig->render('browsehappy.html.twig');
|
$ret .= $twig->render('browsehappy.html.twig');
|
||||||
}
|
}
|
||||||
elseif($type === 'body_end') {
|
elseif($type === 'body_end') {
|
||||||
$ret .= template_ga_code();
|
$ret .= template_ga_code();
|
||||||
|
if (isset($debugBar)) {
|
||||||
|
$ret .= $debugBarRenderer->render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@ -16,10 +16,16 @@ if(!isset($config['installed']) || !$config['installed']) {
|
|||||||
throw new RuntimeException('MyAAC has not been installed yet or there was error during installation. Please install again.');
|
throw new RuntimeException('MyAAC has not been installed yet or there was error during installation. Please install again.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use DebugBar\StandardDebugBar;
|
||||||
|
|
||||||
if(config('env') === 'dev') {
|
if(config('env') === 'dev') {
|
||||||
require SYSTEM . 'exception.php';
|
require SYSTEM . 'exception.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config('env') === 'dev' || getBoolean(config('enable_debugbar'))) {
|
||||||
|
$debugBar = new StandardDebugBar();
|
||||||
|
}
|
||||||
|
|
||||||
if(empty($config['server_path'])) {
|
if(empty($config['server_path'])) {
|
||||||
throw new RuntimeException('Server Path has been not set. Go to config.php and set it.');
|
throw new RuntimeException('Server Path has been not set. Go to config.php and set it.');
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,14 @@ class POT
|
|||||||
throw new RuntimeException('Please install PHP pdo extension. MyAAC will not work without it.');
|
throw new RuntimeException('Please install PHP pdo extension. MyAAC will not work without it.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global $debugBar;
|
||||||
|
if (isset($debugBar)) {
|
||||||
|
$this->db = new DebugBar\DataCollector\PDO\TraceablePDO(new OTS_DB_MySQL($params));
|
||||||
|
$debugBar->addCollector(new DebugBar\DataCollector\PDO\PDOCollector($this->db));
|
||||||
|
}
|
||||||
|
else {
|
||||||
$this->db = new OTS_DB_MySQL($params);
|
$this->db = new OTS_DB_MySQL($params);
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user