Throw a E_USER_NOTICE on use of deprecated functions

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@47306 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-12-18 22:50:23 +00:00
parent 76d482b2cd
commit 50b2f7180f
7 changed files with 54 additions and 16 deletions

View File

@ -279,27 +279,40 @@ class Convert extends Object {
* *
* @param $val the string you wish to convert * @param $val the string you wish to convert
* @return the HTML version of the string * @return the HTML version of the string
* @deprecated
*/ */
static function raw2html($val) { static function raw2html($val) {
user_error("Convert::raw2html is deprecated. Used Convert::raw2xml instead", E_USER_WARNING); user_error("Convert::raw2html is deprecated. Used Convert::raw2xml instead", E_USER_NOTICE);
return self::raw2xml($val); return self::raw2xml($val);
} }
/**
* @deprecated
*/
static function html2plain($val){ static function html2plain($val){
user_error("html2plain is deprecated. Use xml2raw instead.", E_USER_WARNING); user_error("html2plain is deprecated. Use xml2raw instead.", E_USER_NOTICE);
return self::html2raw($val); return self::html2raw($val);
} }
/**
* @deprecated
*/
static function html2text($val, $preserveLinks = false) { static function html2text($val, $preserveLinks = false) {
user_error("html2text is deprecated. Use xml2raw instead.", E_USER_WARNING); user_error("html2text is deprecated. Use xml2raw instead.", E_USER_NOTICE);
return self::html2raw($val); return self::html2raw($val);
} }
/**
* @deprecated
*/
static function raw2reserveNL($val){ static function raw2reserveNL($val){
user_error("Convert::raw2reserveNL is deprecated. Used Convert::raw2xml instead", E_USER_WARNING); user_error("Convert::raw2reserveNL is deprecated. Used Convert::raw2xml instead", E_USER_NOTICE);
return self::raw2xml($val); return self::raw2xml($val);
} }
/**
* @deprecated
*/
static function raw2attr($val) { static function raw2attr($val) {
user_error("raw2attr is deprecated. Use raw2att instead.", E_USER_WARNING); user_error("raw2attr is deprecated. Use raw2att instead.", E_USER_WARNING);
return self::raw2att($val); return self::raw2att($val);

View File

@ -214,9 +214,10 @@ class Debug {
/** /**
* Deprecated. Send live errors and warnings to the given address. * Deprecated. Send live errors and warnings to the given address.
* Use send_errors_to() instead. * @deprecated Use send_errors_to() instead.
*/ */
static function sendLiveErrorsTo($emailAddress) { static function sendLiveErrorsTo($emailAddress) {
user_error('Debug::sendLiveErrorsTo() is deprecated. Use Director::send_errors_to() instead.', E_USER_NOTICE);
if(!Director::isDev()) self::send_errors_to($emailAddress, true); if(!Director::isDev()) self::send_errors_to($emailAddress, true);
} }

View File

@ -311,10 +311,11 @@ class Controller extends ViewableData {
} }
/** /**
* Deprecated - use Controller::curr() instead * @deprecated use Controller::curr() instead
* @returns Controller * @returns Controller
*/ */
public static function currentController() { public static function currentController() {
user_error('Controller::currentController() is deprecated. Use Controller::curr() instead.', E_USER_NOTICE);
return self::curr(); return self::curr();
} }

View File

@ -506,11 +506,28 @@ class Director {
} }
/** /**
* @todo These functions are deprecated, let's use isLive isDev and isTest instead. * @deprecated use isDev() instead
*/ */
function isDevMode() { return self::isDev(); } function isDevMode() {
function isTestMode() { return self::isTest(); } user_error('Director::isDevMode() is deprecated. Use Director::isDev() instead.', E_USER_NOTICE);
function isLiveMode() { return self::isLive(); } return self::isDev();
}
/**
* @deprecated use isTest() instead
*/
function isTestMode() {
user_error('Director::isTestMode() is deprecated. Use Director::isTest() instead.', E_USER_NOTICE);
return self::isTest();
}
/**
* @deprecated use isLive() instead
*/
function isLiveMode() {
user_error('Director::isLiveMode() is deprecated. Use Director::isLive() instead.', E_USER_NOTICE);
return self::isLive();
}
} }

View File

@ -386,6 +386,7 @@ class DataObjectSet extends ViewableData implements Iterator {
* @deprecated Use merge() * @deprecated Use merge()
*/ */
public function append(DataObjectSet $doset){ public function append(DataObjectSet $doset){
user_error('DataObjectSet::append() is deprecated. Use DataObjectSet::merge() instead.', E_USER_NOTICE);
foreach($doset as $item){ foreach($doset as $item){
$this->push($item); $this->push($item);
} }

View File

@ -2,6 +2,10 @@
if(!class_exists('Datetime')) { if(!class_exists('Datetime')) {
class Datetime extends Date { class Datetime extends Date {
function __construct($name) {
user_error('Datetime is deprecated. Use SSDatetime instead.', E_USER_NOTICE);
parent::__construct($name);
}
function setValue($value) { function setValue($value) {
if($value) $this->value = date('Y-m-d H:i:s', strtotime($value)); if($value) $this->value = date('Y-m-d H:i:s', strtotime($value));

View File

@ -393,9 +393,10 @@ HTML;
// ################### // ###################
/** /**
* DEPRECATED Please use addExtraClass * @deprecated please use addExtraClass
*/ */
function setExtraClass($extraClass){ function setExtraClass($extraClass) {
user_error('FormField::setExtraClass() is deprecated. Use FormField::addExtraClass() instead.', E_USER_NOTICE);
$this->extraClasses[] = $extraClass; $this->extraClasses[] = $extraClass;
} }
} }