Skip to content
This repository
Browse code

Removing deprecated Debug functions, use SS_Log and SS_Backtrace instead

  • Loading branch information...
commit 9eca2d676f9278ba528cb2ea6be4151703ed8fc2 1 parent b6870ad
Sean Harvey authored November 15, 2012

Showing 1 changed file with 0 additions and 162 deletions. Show diff stats Hide diff stats

  1. 162  dev/Debug.php
162  dev/Debug.php
@@ -447,168 +447,6 @@ public static function showLines($errfile, $errline) {
447 447
 		}
448 448
 		echo '</pre>';		
449 449
 	}
450  
-
451  
-	/**
452  
-	 * Dispatch an email notification message when an error is triggered.
453  
-	 * @deprecated 2.5
454  
-	 * To create error logs by email, use this code instead:
455  
-	 * <code>
456  
-	 * $emailWriter = new SS_LogEmailWriter('my@email.com');
457  
-	 * SS_Log::add_writer($emailWriter, SS_Log::ERR);
458  
-	 * </code>
459  
-	 * 
460  
-	 * @param string $emailAddress
461  
-	 * @param string $errno
462  
-	 * @param string $errstr
463  
-	 * @param string $errfile
464  
-	 * @param int $errline
465  
-	 * @param string $errcontext
466  
-	 * @param string $errorType "warning" or "error"
467  
-	 * @return boolean
468  
-	 */
469  
-	public static function emailError($emailAddress, $errno, $errstr, $errfile, $errline, $errcontext,
470  
-			$errorType = "Error") {
471  
-
472  
-		Deprecation::notice('2.5',
473  
-			'Use SS_Log instead. See the class documentation in SS_Log.php for more information.');
474  
-		$priority = ($errorType == 'Error') ? SS_Log::ERR : SS_Log::WARN;
475  
-		$writer = new SS_LogEmailWriter($emailAddress);
476  
-		SS_Log::add_writer($writer, $priority);
477  
-		SS_Log::log(
478  
-			array(
479  
-				'errno' => $errno,
480  
-				'errstr' => $errstr,
481  
-				'errfile' => $errfile,
482  
-				'errline' => $errline,
483  
-				'errcontext' => $errcontext
484  
-			),
485  
-			$priority
486  
-		);
487  
-		SS_Log::remove_writer($writer);
488  
-	}
489  
-	
490  
-	/**
491  
-	 * Log the given error, if self::$log_errors is set.
492  
-	 * Uses the native error_log() funtion in PHP.
493  
-	 * 
494  
-	 * Format: [d-M-Y h:i:s] <type> at <file> line <line>: <errormessage> <url>
495  
-	 * 
496  
-	 * @todo Detect script path for CLI errors
497  
-	 * @todo Log detailed errors to full file
498  
-	 * @deprecated 2.5 See SS_Log on setting up error file logging
499  
-	 */
500  
-	protected static function log_error_if_necessary($errno, $errstr, $errfile, $errline, $errcontext, $errtype) {
501  
-		Deprecation::notice('2.5',
502  
-			'Use SS_Log instead. See the class documentation in SS_Log.php for more information.');
503  
-		$priority = ($errtype == 'Error') ? SS_Log::ERR : SS_Log::WARN;
504  
-		$writer = new SS_LogFileWriter('../' . self::$log_errors_to);
505  
-		SS_Log::add_writer($writer, $priority);
506  
-		SS_Log::log(
507  
-			array(
508  
-				'errno' => $errno,
509  
-				'errstr' => $errstr,
510  
-				'errfile' => $errfile,
511  
-				'errline' => $errline,
512  
-				'errcontext' => $errcontext
513  
-			),
514  
-			$priority
515  
-		);
516  
-		SS_Log::remove_writer($writer);
517  
-	}
518  
-	
519  
-	/**
520  
-	 * @param string $server IP-Address or domain
521  
-	 * @deprecated 2.5 See SS_Log on setting up error email notification
522  
-	 */
523  
-	public static function set_custom_smtp_server($server) {
524  
-		self::$custom_smtp_server = $server;
525  
-	}
526  
-
527  
-	/**
528  
-	 * @return string
529  
-	 * @deprecated 2.5 See SS_Log on setting up error email notification
530  
-	 */
531  
-	public static function get_custom_smtp_server() {
532  
-		return self::$custom_smtp_server;
533  
-	}
534  
-	
535  
-	/**
536  
-	 * Send errors to the given email address.
537  
-	 * Can be used like so:
538  
-	 * if(Director::isLive()) Debug::send_errors_to("sam@silverstripe.com");
539  
-	 * 
540  
-	 * @deprecated 2.5 See SS_Log on setting up error email notification
541  
-	 * 
542  
-	 * @param string $emailAddress The email address to send errors to
543  
-	 * @param string $sendWarnings Set to true to send warnings as well as errors (Default: false)
544  
-	 */
545  
-	public static function send_errors_to($emailAddress, $sendWarnings = false) {
546  
-		Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.');
547  
-		self::$send_errors_to = $emailAddress;
548  
-		self::$send_warnings_to = $sendWarnings ? $emailAddress : null;
549  
-	}
550  
-	
551  
-	/**
552  
-	 * @return string
553  
-	 * @deprecated 2.5 See SS_Log on setting up error email notification
554  
-	 */
555  
-	public static function get_send_errors_to() {
556  
-		Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.');
557  
-		return self::$send_errors_to;
558  
-	}
559  
-	
560  
-	/**
561  
-	 * @param string $emailAddress
562  
-	 * @deprecated 2.5 See SS_Log on setting up error email notification
563  
-	 */
564  
-	public static function send_warnings_to($emailAddress) {
565  
-		Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.');
566  
-		self::$send_warnings_to = $emailAddress;
567  
-	}
568  
-
569  
-	/**
570  
-	 * @return string
571  
-	 * @deprecated 2.5 See SS_Log on setting up error email notification
572  
-	 */
573  
-	public static function get_send_warnings_to() {
574  
-		Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error email notification.');
575  
-		return self::$send_warnings_to;
576  
-	}
577  
-	
578  
-	/**
579  
-	 * Call this to enable logging of errors.
580  
-	 * @deprecated 2.5 See SS_Log on setting up error file logging
581  
-	 */
582  
-	public static function log_errors_to($logFile = ".sserrors") {
583  
-		Deprecation::notice('2.5', 'Use SS_Log instead. See SS_Log on setting up error file logging.');
584  
-		self::$log_errors_to = $logFile;
585  
-	}
586  
-	
587  
-	public static function caller() {
588  
-		$bt = debug_backtrace();
589  
-		$caller = $bt[2];
590  
-		$caller['line'] = $bt[1]['line'];
591  
-		$caller['file'] = $bt[1]['file'];
592  
-		if(!isset($caller['class'])) $caller['class'] = '';
593  
-		if(!isset($caller['type'])) $caller['type'] = '';
594  
-		return $caller;
595  
-	}
596  
-	
597  
-	/**
598  
-	 * @deprecated 2.5 Please use {@link SS_Backtrace::backtrace()}
599  
-	 */
600  
-	public static function backtrace($returnVal = false, $ignoreAjax = false) {
601  
-		Deprecation::notice('2.5', 'Use SS_Backtrace::backtrace instead.');
602  
-		return SS_Backtrace::backtrace($returnVal, $ignoreAjax);
603  
-	}
604  
-	
605  
-	/**
606  
-	 * @deprecated 2.5 Please use {@link SS_Backtrace::get_rendered_backtrace()}
607  
-	 */
608  
-	public static function get_rendered_backtrace($bt, $plainText = false) {
609  
-		Deprecation::notice('2.5', 'Use SS_Backtrace::get_rendered_backtrace() instead.');
610  
-		return SS_Backtrace::get_rendered_backtrace($bt, $plainText);
611  
-	}
612 450
 	
613 451
 	/**
614 452
 	 * Check if the user has permissions to run URL debug tools,

0 notes on commit 9eca2d6

Please sign in to comment.
Something went wrong with that request. Please try again.