Skip to content

Commit

Permalink
Fix EZP-24113: eZ REST API v1: all eZ log files except error.log are
Browse files Browse the repository at this point in the history
disabled unless DebugOutput=enabled

> https://jira.ez.no/browse/EZP-24113

Ensures AlwaysLog is honored.
Note that eZDebug error handling needs to be changed in order for logs
to be written.
  • Loading branch information
lolautruche committed Mar 30, 2015
1 parent b302114 commit b8a3cd1
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions index_rest.php
Expand Up @@ -14,8 +14,7 @@
// Below we are setting up a minimal eZ Publish environment from the old index.php
// This is a temporary measure.

// We want PHP to deal with all errors here.
eZDebug::setHandleType( eZDebug::HANDLE_TO_PHP );
eZDebug::setHandleType( eZDebug::HANDLE_NONE );
$GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable( 'REQUEST_URI' );
$ini = eZINI::instance();
eZSys::init( 'index_rest.php', $ini->variable( 'SiteAccessSettings', 'ForceVirtualHost' ) == 'true' );
Expand All @@ -25,10 +24,27 @@
// load extensions
eZExtension::activateExtensions( 'default' );

// setup for eZSiteAccess:change() needs some methods defined in old index.php
// We disable it, since we dont' want any override settings to change the
// debug settings here
function eZUpdateDebugSettings() {}
// setup for eZSiteAccess:change() needs some functions defined in old index.php
function eZUpdateDebugSettings()
{
$ini = eZINI::instance();
$debugSettings = array( 'debug-enabled' => false );
$logList = $ini->variable( 'DebugSettings', 'AlwaysLog' );
$logMap = array(
'notice' => eZDebug::LEVEL_NOTICE,
'warning' => eZDebug::LEVEL_WARNING,
'error' => eZDebug::LEVEL_ERROR,
'debug' => eZDebug::LEVEL_DEBUG,
'strict' => eZDebug::LEVEL_STRICT
);
$debugSettings['always-log'] = array();
foreach ( $logMap as $name => $level )
{
$debugSettings['always-log'][$level] = in_array( $name, $logList );
}

eZDebug::updateSettings( $debugSettings );
}

// set siteaccess from X-Siteaccess header if given and exists
if ( isset( $_SERVER['HTTP_X_SITEACCESS'] ) && eZSiteAccess::exists( $_SERVER['HTTP_X_SITEACCESS'] ) )
Expand All @@ -55,7 +71,6 @@ function eZUpdateDebugSettings() {}
$debug->updateDebugSettings();
}


$mvcConfig = new ezpMvcConfiguration();

$frontController = new ezpMvcConfigurableDispatcher( $mvcConfig );
Expand Down

0 comments on commit b8a3cd1

Please sign in to comment.