static public function registerShutdownPerfLogger( $onlyIfConfigured = false, $eZ5Context = false )
    {
        if ( $onlyIfConfigured && eZPerfLoggerINI::variable( 'GeneralSettings', 'AlwaysRegisterShutdownPerfLogger' ) !== 'enabled' )
        {
            return false;
        }

        foreach( eZExecution::cleanupHandlers() as $handler )
        {
            if ( $handler == array( __CLASS__, 'cleanup' ) || $handler == array( __CLASS__, 'cleanupOnCleanExit' ) )
            {
                return true;
            }
        }

        if ( $eZ5Context )
        {
            eZExecution::addCleanupHandler( array( __CLASS__, 'cleanupOnCleanExit' ) );
        }
        else
        {
            eZExecution::addCleanupHandler( array( __CLASS__, 'cleanup' ) );
        }

        return true;
    }