Skip to content

Commit

Permalink
Updated debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
eSilverStrike committed Mar 14, 2020
1 parent 75dddff commit aed5c51
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion public_html/siteconfig.php.dist
Expand Up @@ -76,7 +76,7 @@ $_CONF['site_enabled'] = true;
// $_CONF['developer_mode_log']['search'] = true; // Search class
// $_CONF['developer_mode_log']['security'] = true; // lib-security.php
// $_CONF['developer_mode_log']['session'] = true; // lib-session.php
// $_CONF['developer_mode_log']['template'] = true; // Template class
// $_CONF['developer_mode_log']['template'] = true; // Template class - Note: class also has a debug public variable that echos debug info on page. Must be set manually. See class for more details.
// $_CONF['developer_mode_log']['topic'] = true; // lib-topic.php
// $_CONF['developer_mode_log']['user'] = true; // lib-user.php

Expand Down
22 changes: 10 additions & 12 deletions system/classes/Resource.php
Expand Up @@ -255,9 +255,7 @@ class Resource
*/
public function __construct(array $config)
{
if (isset($config['developer_mode'], $config['developer_mode_log']['resource']) &&
$config['developer_mode'] &&
$config['developer_mode_log']['resource']) {
if (COM_isEnableDeveloperModeLog('resource')) {
$this->setDebug(true);
}

Expand Down Expand Up @@ -381,7 +379,7 @@ private function checkCssAttributes(array $attributes)
public function setJavaScriptLibrary($name, $isFooter = true)
{
global $LANG_DIRECTION;

// Sometimes it matters the order the libraries are submitted by Geeklog
// Example jquery-ui-timepicker-addon must be before jquery-ui-timepicker-addon-i18n
// Since the sort happens later and libraries which have the same priority may get shuffled within the priority
Expand Down Expand Up @@ -457,7 +455,7 @@ public function setJavaScriptLibrary($name, $isFooter = true)
'file' => $this->libraryLocations[$name],
'priority' => $library_priority,
];

$library_priority = $library_priority + 1;

// In case of a UIkit component, add a suitable CSS file
Expand Down Expand Up @@ -519,9 +517,9 @@ public function setJavaScriptFile($name, $file, $isFooter = true, $priority = 10
if ($this->isHeaderSet && !$isFooter) {
return false;
}

$position = $isFooter ? 'footer' : 'header';

if ($this->isExternal($file) && array_search($file, array_column($this->externalJsFiles[$position], 'file')) == 0) {
$this->externalJsFiles[$position][] = [
'file' => $file,
Expand Down Expand Up @@ -860,7 +858,7 @@ private function makeFileServerTag(array $files, $isCss = true)
$excludedFiles = '';

// *******************************
// Exclude files for advanced editor
// Exclude files for advanced editor
// Since they wouldn't work in displaced locations (ie in the new resource file and location)
// Also include them after the resource file

Expand Down Expand Up @@ -922,8 +920,8 @@ private function makeFileServerTag(array $files, $isCss = true)
$retval .= sprintf(self::JS_TAG_TEMPLATE, $this->config['site_url'] . $file['file']) . PHP_EOL;
}
}
// Add excluded files at the end

// Add excluded files at the end
$retval .= $excludedFiles;

return $retval;
Expand Down Expand Up @@ -1019,7 +1017,7 @@ private function makeTagsForSystemLibraries($isFooter = true)

// UIkit
if ((!$isFooter && ($this->UIkitPosition === 'header')) ||
($isFooter && ($this->UIkitPosition === 'footer'))) {
($isFooter && ($this->UIkitPosition === 'footer'))) {
if ($this->config['cdn_hosted']) {
$retval .= sprintf(
self::JS_TAG_TEMPLATE,
Expand All @@ -1037,7 +1035,7 @@ private function makeTagsForSystemLibraries($isFooter = true)

// UIkit3
if ((!$isFooter && ($this->UIkit3Position === 'header')) ||
($isFooter && ($this->UIkit3Position === 'footer'))) {
($isFooter && ($this->UIkit3Position === 'footer'))) {
if ($this->config['cdn_hosted']) {
$retval .= sprintf(
self::JS_TAG_TEMPLATE,
Expand Down
4 changes: 1 addition & 3 deletions system/classes/search.class.php
Expand Up @@ -125,9 +125,7 @@ public function __construct(array $config)
{
global $_CONF, $_TABLES;

if (isset($config['developer_mode'], $config['developer_mode_log']['search']) &&
$config['developer_mode'] &&
$config['developer_mode_log']['search']) {
if (COM_isEnableDeveloperModeLog('search')) {
$this->setDebug(true);
}

Expand Down
1 change: 1 addition & 0 deletions system/classes/template.class.php
Expand Up @@ -877,6 +877,7 @@ public function subst($varName)

// Lets try to error gracefully if we need too when evaluating PHP
// Cannot use COM_handleEval as that is an outside function as the code we need to evaluate contains references to the template class ($this->...)
// This code gets executed when the template class function set_view is uses (like in the staticpages plugin when a page is used as a template)
$errorMessage = '';
$templateCode = '?>' . $templateCode . '<?php ';
ob_start();
Expand Down
2 changes: 1 addition & 1 deletion system/lib-sessions.php
Expand Up @@ -90,7 +90,7 @@ function SESS_sessionCheck()

// Flag indicates if session cookie exists on users device and session data exist on server
$validUserSessionExists = Session::init(array(
'debug' => isset($_CONF['developer_mode_log']['session']) && $_CONF['developer_mode_log']['session'],
'debug' => COM_isEnableDeveloperModeLog('session'),
'logger' => 'COM_errorLog',
'cookie_disabled' => false,
'cookie_lifetime' => $_CONF['session_cookie_timeout'],
Expand Down

0 comments on commit aed5c51

Please sign in to comment.