diff --git a/dev/Debug.php b/dev/Debug.php index c23719e00..58b7331d8 100644 --- a/dev/Debug.php +++ b/dev/Debug.php @@ -447,168 +447,6 @@ class Debug { } echo ''; } - - /** - * Dispatch an email notification message when an error is triggered. - * @deprecated 2.5 - * To create error logs by email, use this code instead: - * - * $emailWriter = new SS_LogEmailWriter('my@email.com'); - * SS_Log::add_writer($emailWriter, SS_Log::ERR); - * - * - * @param string $emailAddress - * @param string $errno - * @param string $errstr - * @param string $errfile - * @param int $errline - * @param string $errcontext - * @param string $errorType "warning" or "error" - * @return boolean - */ - public static function emailError($emailAddress, $errno, $errstr, $errfile, $errline, $errcontext, - $errorType = "Error") { - - Deprecation::notice('2.5', - 'Use SS_Log instead. See the class documentation in SS_Log.php for more information.'); - $priority = ($errorType == 'Error') ? SS_Log::ERR : SS_Log::WARN; - $writer = new SS_LogEmailWriter($emailAddress); - SS_Log::add_writer($writer, $priority); - SS_Log::log( - array( - 'errno' => $errno, - 'errstr' => $errstr, - 'errfile' => $errfile, - 'errline' => $errline, - 'errcontext' => $errcontext - ), - $priority - ); - SS_Log::remove_writer($writer); - } - - /** - * Log the given error, if self::$log_errors is set. - * Uses the native error_log() funtion in PHP. - * - * Format: [d-M-Y h:i:s] at line : - * - * @todo Detect script path for CLI errors - * @todo Log detailed errors to full file - * @deprecated 2.5 See SS_Log on setting up error file logging - */ - protected static function log_error_if_necessary($errno, $errstr, $errfile, $errline, $errcontext, $errtype) { - Deprecation::notice('2.5', - 'Use SS_Log instead. See the class documentation in SS_Log.php for more information.'); - $priority = ($errtype == 'Error') ? SS_Log::ERR : SS_Log::WARN; - $writer = new SS_LogFileWriter('../' . self::$log_errors_to); - SS_Log::add_writer($writer, $priority); - SS_Log::log( - array( - 'errno' => $errno, - 'errstr' => $errstr, - 'errfile' => $errfile, - 'errline' => $errline, - 'errcontext' => $errcontext - ), - $priority - ); - SS_Log::remove_writer($writer); - } - - /** - * @param string $server IP-Address or domain - * @deprecated 2.5 See SS_Log on setting up error email notification - */ - public static function set_custom_smtp_server($server) { - self::$custom_smtp_server = $server; - } - - /** - * @return string - * @deprecated 2.5 See SS_Log on setting up error email notification - */ - public static function get_custom_smtp_server() { - return self::$custom_smtp_server; - } - - /** - * Send errors to the given email address. - * Can be used like so: - * if(Director::isLive()) Debug::send_errors_to("sam@silverstripe.com"); - * - * @deprecated 2.5 See SS_Log on setting up error email notification - * - * @param string $emailAddress The email address to send errors to - * @param string $sendWarnings Set to true to send warnings as well as errors (Default: false) - */ - public static function send_errors_to($emailAddress, $sendWarnings = false) { - Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.'); - self::$send_errors_to = $emailAddress; - self::$send_warnings_to = $sendWarnings ? $emailAddress : null; - } - - /** - * @return string - * @deprecated 2.5 See SS_Log on setting up error email notification - */ - public static function get_send_errors_to() { - Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.'); - return self::$send_errors_to; - } - - /** - * @param string $emailAddress - * @deprecated 2.5 See SS_Log on setting up error email notification - */ - public static function send_warnings_to($emailAddress) { - Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.'); - self::$send_warnings_to = $emailAddress; - } - - /** - * @return string - * @deprecated 2.5 See SS_Log on setting up error email notification - */ - public static function get_send_warnings_to() { - Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.'); - return self::$send_warnings_to; - } - - /** - * Call this to enable logging of errors. - * @deprecated 2.5 See SS_Log on setting up error file logging - */ - public static function log_errors_to($logFile = ".sserrors") { - Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error file logging.'); - self::$log_errors_to = $logFile; - } - - public static function caller() { - $bt = debug_backtrace(); - $caller = $bt[2]; - $caller['line'] = $bt[1]['line']; - $caller['file'] = $bt[1]['file']; - if(!isset($caller['class'])) $caller['class'] = ''; - if(!isset($caller['type'])) $caller['type'] = ''; - return $caller; - } - - /** - * @deprecated 2.5 Please use {@link SS_Backtrace::backtrace()} - */ - public static function backtrace($returnVal = false, $ignoreAjax = false) { - Deprecation::notice('2.5', 'Use SS_Backtrace::backtrace instead.'); - return SS_Backtrace::backtrace($returnVal, $ignoreAjax); - } - - /** - * @deprecated 2.5 Please use {@link SS_Backtrace::get_rendered_backtrace()} - */ - public static function get_rendered_backtrace($bt, $plainText = false) { - Deprecation::notice('2.5', 'Use SS_Backtrace::get_rendered_backtrace() instead.'); - return SS_Backtrace::get_rendered_backtrace($bt, $plainText); - } /** * Check if the user has permissions to run URL debug tools,