Exemplo n.º 1
0
/**
 * Deletes the cache.
 *
 * @package redaxo\core
 */
function rex_delete_cache()
{
    // close logger, so the logfile can also be deleted
    rex_logger::close();
    $finder = rex_finder::factory(rex_path::cache())->recursive()->childFirst()->ignoreFiles(['.htaccess', '.redaxo'], false)->ignoreSystemStuff(false);
    rex_dir::deleteIterator($finder);
    rex_clang::reset();
    // ----- EXTENSION POINT
    return rex_extension::registerPoint(new rex_extension_point('CACHE_DELETED', rex_i18n::msg('delete_cache_message')));
}
Exemplo n.º 2
0
 /**
  * Logs with an arbitrary level.
  *
  * @param mixed  $level
  * @param string $message
  * @param array  $context
  * @param string $file
  * @param int    $line
  *
  * @throws InvalidArgumentException
  */
 public function log($level, $message, array $context = [], $file = null, $line = null)
 {
     $levelType = is_int($level) ? self::getLogLevel($level) : $level;
     $firephp = FirePHP::getInstance(true);
     if (in_array($levelType, [LogLevel::NOTICE, LogLevel::INFO])) {
         $firephp->log($message);
     } elseif (in_array($levelType, [LogLevel::WARNING])) {
         $firephp->warn($message);
     } else {
         $firephp->error($message);
     }
     parent::log($level, $message, $context, $file, $line);
 }
Exemplo n.º 3
0
<?php

/**
 * Verwaltung der Content Sprachen.
 *
 * @package redaxo5
 */
// -------------- Defaults
$func = rex_request('func', 'string');
$error = '';
$success = '';
$logFile = rex_path::cache('system.log');
if ($func == 'delLog') {
    // close logger, to free remaining file-handles to syslog
    // so we can safely delete the file
    rex_logger::close();
    if (rex_log_file::delete($logFile)) {
        $success = rex_i18n::msg('syslog_deleted');
    } else {
        $error = rex_i18n::msg('syslog_delete_error');
    }
}
$message = '';
$content = '';
if ($success != '') {
    $message .= rex_view::success($success);
}
if ($error != '') {
    $message .= rex_view::error($error);
}
$content .= '
Exemplo n.º 4
0
 /**
  * Closes the logfile. The logfile is not be able to log further message after beeing closed.
  *
  * You dont need to close the logfile manually when it was registered during the request.
  */
 public static function close()
 {
     self::$file = null;
 }
Exemplo n.º 5
0
 public static function delete($path)
 {
     $fullpath = self::PATH . self::getPath($path);
     $error = null;
     try {
         $socket = rex_socket::factory(self::HOST, self::PORT, self::SSL);
         $socket->setPath($fullpath);
         $response = $socket->doDelete();
         if ($response->isOk()) {
             $data = json_decode($response->getBody(), true);
             if (!isset($data['error']) || !is_string($data['error'])) {
                 return;
             }
             $error = rex_i18n::msg('install_webservice_error') . '<br />' . $data['error'];
         }
     } catch (rex_socket_exception $e) {
         rex_logger::logException($e);
     }
     if (!$error) {
         $error = rex_i18n::msg('install_webservice_unreachable');
     }
     throw new rex_functional_exception($error);
 }
Exemplo n.º 6
0
 /**
  * Handles a error message.
  *
  * @param int    $errno   The error code to handle
  * @param string $errstr  The error message
  * @param string $errfile The file in which the error occured
  * @param int    $errline The line of the file in which the error occured
  *
  * @throws ErrorException
  */
 public static function handleError($errno, $errstr, $errfile, $errline)
 {
     if (in_array($errno, [E_USER_ERROR, E_ERROR, E_COMPILE_ERROR, E_RECOVERABLE_ERROR, E_PARSE])) {
         throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
     } elseif ((error_reporting() & $errno) == $errno) {
         if (ini_get('display_errors') && (rex::isSetup() || rex::isDebugMode() || ($user = rex_backend_login::createUser()) && $user->isAdmin())) {
             echo '<div><b>' . self::getErrorType($errno) . "</b>: {$errstr} in <b>{$errfile}</b> on line <b>{$errline}</b></div>";
         }
         rex_logger::logError($errno, $errstr, $errfile, $errline);
     }
 }
Exemplo n.º 7
0
<?php

require 'vendor/FirePHPCore/fb.php';
rex_sql::setFactoryClass('rex_sql_debug');
rex_extension::setFactoryClass('rex_extension_debug');
rex_logger::setFactoryClass('rex_logger_debug');
rex_api_function::setFactoryClass('rex_api_function_debug');