mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR: Use Deprecation class to indicate deprecated methods in core.
This commit is contained in:
parent
ad9bc59d10
commit
e5afa25522
@ -7,11 +7,7 @@
|
||||
abstract class LeftAndMainDecorator extends LeftAndMainExtension {
|
||||
|
||||
public function __construct() {
|
||||
// TODO Re-enable before we release 3.0 beta, for now it "breaks" too many modules
|
||||
// user_error(
|
||||
// 'LeftAndMainDecorator is deprecated, please use LeftAndMainExtension instead.',
|
||||
// E_USER_NOTICE
|
||||
// );
|
||||
Deprecation::notice('3.0', 'Use LeftAndMainExtension instead.');
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
@ -282,6 +282,7 @@ class Director {
|
||||
* @deprecated 3.0 Use SS_HTTPRequest->latestParam()
|
||||
*/
|
||||
static function urlParam($name) {
|
||||
Deprecation::notice('3.0', 'Use SS_HTTPRequest->latestParam() instead.');
|
||||
if(isset(Director::$urlParams[$name])) return Director::$urlParams[$name];
|
||||
}
|
||||
|
||||
@ -291,6 +292,7 @@ class Director {
|
||||
* @deprecated 3.0 Use SS_HTTPRequest->latestParams()
|
||||
*/
|
||||
static function urlParams() {
|
||||
Deprecation::notice('3.0', 'Use SS_HTTPRequest->latestParams() instead.');
|
||||
return Director::$urlParams;
|
||||
}
|
||||
|
||||
@ -413,6 +415,7 @@ class Director {
|
||||
* @deprecated 2.5 Use Controller->redirectBack()
|
||||
*/
|
||||
static function redirectBack() {
|
||||
Deprecation::notice('2.5', 'Use Controller->redirectBack() instead.');
|
||||
Controller::curr()->redirectBack();
|
||||
}
|
||||
|
||||
|
@ -181,6 +181,7 @@ class ClassInfo {
|
||||
* @deprecated 3.0 Please use is_subclass_of.
|
||||
*/
|
||||
public static function is_subclass_of($class, $parent) {
|
||||
Deprecation::notice('3.0', 'Use is_subclass_of() instead.');
|
||||
return is_subclass_of($class, $parent);
|
||||
}
|
||||
|
||||
|
@ -318,6 +318,7 @@ function getTempFolder($base = null) {
|
||||
* @deprecated 3.0 Please use {@link SS_ClassManifest::getItemPath()}.
|
||||
*/
|
||||
function getClassFile($className) {
|
||||
Deprecation::notice('3.0', 'Use SS_ClassManifest::getItemPath() instead.');
|
||||
return SS_ClassLoader::instance()->getManifest()->getItemPath($className);
|
||||
}
|
||||
|
||||
|
@ -896,9 +896,7 @@ abstract class Object {
|
||||
* @deprecated
|
||||
*/
|
||||
public function set_uninherited() {
|
||||
user_error (
|
||||
'Object->set_uninherited() is deprecated, please use a custom static on your object', E_USER_WARNING
|
||||
);
|
||||
Deprecation::notice('2.4', 'Use a custom static on your object instead.');
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
@ -388,6 +388,7 @@ class PaginatedList extends SS_ListDecorator {
|
||||
* @deprecated 3.0 Use individual getter methods.
|
||||
*/
|
||||
public function getPageLimits() {
|
||||
Deprecation::notice('3.0', 'Use getPageStart, getPageLength, or getTotalItems instead.');
|
||||
return array(
|
||||
'pageStart' => $this->getPageStart(),
|
||||
'pageLength' => $this->pageLength,
|
||||
@ -399,6 +400,7 @@ class PaginatedList extends SS_ListDecorator {
|
||||
* @deprecated 3.0 Use individual setter methods.
|
||||
*/
|
||||
public function setPageLimits($pageStart, $pageLength, $totalSize) {
|
||||
Deprecation::notice('3.0', 'Use setPageStart, setPageLength, or setTotalItems instead.');
|
||||
$this->setPageStart($pageStart);
|
||||
$this->setPageLength($pageLength);
|
||||
$this->setTotalSize($totalSize);
|
||||
|
@ -460,8 +460,7 @@ class Debug {
|
||||
* @return boolean
|
||||
*/
|
||||
static function emailError($emailAddress, $errno, $errstr, $errfile, $errline, $errcontext, $errorType = "Error") {
|
||||
user_error('Debug::send_errors_to() and Debug::emailError() is deprecated. Please use SS_Log instead.
|
||||
See the class documentation in SS_Log.php for more information.', E_USER_NOTICE);
|
||||
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);
|
||||
@ -489,8 +488,7 @@ class Debug {
|
||||
* @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) {
|
||||
user_error('Debug::log_error_if_necessary() and Debug::log_errors_to() are deprecated. Please use SS_Log instead.
|
||||
See the class documentation in SS_Log.php for more information.', E_USER_NOTICE);
|
||||
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);
|
||||
@ -534,6 +532,7 @@ class Debug {
|
||||
* @param string $sendWarnings Set to true to send warnings as well as errors (Default: false)
|
||||
*/
|
||||
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;
|
||||
}
|
||||
@ -543,6 +542,7 @@ class Debug {
|
||||
* @deprecated 2.5 See SS_Log on setting up error email notification
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@ -551,6 +551,7 @@ class Debug {
|
||||
* @deprecated 2.5 See SS_Log on setting up error email notification
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@ -559,6 +560,7 @@ class Debug {
|
||||
* @deprecated 2.5 See SS_Log on setting up error email notification
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@ -567,6 +569,7 @@ class Debug {
|
||||
* @deprecated 2.5 See SS_Log on setting up error file logging
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@ -584,7 +587,7 @@ class Debug {
|
||||
* @deprecated 2.5 Please use {@link SS_Backtrace::backtrace()}
|
||||
*/
|
||||
static function backtrace($returnVal = false, $ignoreAjax = false) {
|
||||
user_error('Debug::backtrace() is deprecated. Please use SS_Backtrace::backtrace() instead', E_USER_NOTICE);
|
||||
Deprecation::notice('2.5', 'Use SS_Backtrace::backtrace instead.');
|
||||
return SS_Backtrace::backtrace($returnVal, $ignoreAjax);
|
||||
}
|
||||
|
||||
@ -592,7 +595,7 @@ class Debug {
|
||||
* @deprecated 2.5 Please use {@link SS_Backtrace::get_rendered_backtrace()}
|
||||
*/
|
||||
static function get_rendered_backtrace($bt, $plainText = false) {
|
||||
user_error('Debug::get_rendered_backtrace() is deprecated. Please use SS_Backtrace::get_rendered_backtrace() instead', E_USER_NOTICE);
|
||||
Deprecation::notice('2.5', 'Use SS_Backtrace::get_rendered_backtrace() instead.');
|
||||
return SS_Backtrace::get_rendered_backtrace($bt, $plainText);
|
||||
}
|
||||
|
||||
|
@ -173,6 +173,7 @@ class File extends DataObject {
|
||||
* @deprecated 3.0 Use getTreeTitle()
|
||||
*/
|
||||
function TreeTitle() {
|
||||
Deprecation::notice('3.0', 'Use getTreeTitle() instead.');
|
||||
return $this->getTreeTitle();
|
||||
}
|
||||
|
||||
@ -513,6 +514,7 @@ class File extends DataObject {
|
||||
* @deprecated 2.4
|
||||
*/
|
||||
function getLinkedURL() {
|
||||
Deprecation::notice('2.4', 'Use getTreeTitle() instead.');
|
||||
return "$this->Name";
|
||||
}
|
||||
|
||||
@ -689,6 +691,8 @@ class File extends DataObject {
|
||||
* @deprecated alternative_instance_get()
|
||||
*/
|
||||
public function instance_get($filter = "", $sort = "", $join = "", $limit="", $containerClass = "DataObjectSet", $having="") {
|
||||
Deprecation::notice('2.5', 'Use alternative_instance_get() instead.');
|
||||
|
||||
$query = $this->extendedSQL($filter, $sort, $limit, $join, $having);
|
||||
$baseTable = reset($query->from);
|
||||
|
||||
|
@ -227,7 +227,7 @@ class Upload extends Controller {
|
||||
* @return int Filesize in bytes
|
||||
*/
|
||||
public function getAllowedMaxFileSize($ext = null) {
|
||||
user_error('Upload::getAllowedMaxFileSize() is deprecated. Please use Upload_Validator::getAllowedMaxFileSize() instead', E_USER_NOTICE);
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::getAllowedMaxFileSize() instead.');
|
||||
return $this->validator->getAllowedMaxFileSize($ext);
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ class Upload extends Controller {
|
||||
* @param array|int $rules
|
||||
*/
|
||||
public function setAllowedMaxFileSize($rules) {
|
||||
user_error('Upload::setAllowedMaxFileSize() is deprecated. Please use Upload_Validator::setAllowedMaxFileSize() instead', E_USER_NOTICE);
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::setAllowedMaxFileSize() instead.');
|
||||
$this->validator->setAllowedMaxFileSize($rules);
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ class Upload extends Controller {
|
||||
* @return array
|
||||
*/
|
||||
public function getAllowedExtensions() {
|
||||
user_error('Upload::getAllowedExtensions() is deprecated. Please use Upload_Validator::getAllowedExtensions() instead', E_USER_NOTICE);
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::getAllowedExtensions() instead.');
|
||||
return $this->validator->getAllowedExtensions();
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ class Upload extends Controller {
|
||||
* @param array $rules
|
||||
*/
|
||||
public function setAllowedExtensions($rules) {
|
||||
user_error('Upload::setAllowedExtensions() is deprecated. Please use Upload_Validator::setAllowedExtensions() instead', E_USER_NOTICE);
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::setAllowedExtensions() instead.');
|
||||
$this->validator->setAllowedExtensions($rules);
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ class Upload extends Controller {
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValidSize($tmpFile) {
|
||||
user_error('Upload::isValidSize() is deprecated. Please use Upload_Validator::isValidSize() instead', E_USER_NOTICE);
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::isValidSize() instead.');
|
||||
$validator = new Upload_Validator();
|
||||
$validator->setTmpFile($tmpFile);
|
||||
return $validator->isValidSize();
|
||||
@ -294,7 +294,7 @@ class Upload extends Controller {
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValidExtension($tmpFile) {
|
||||
user_error('Upload::isValidExtension() is deprecated. Please use Upload_Validator::isValidExtension() instead', E_USER_NOTICE);
|
||||
Deprecation::notice('2.5', 'Use Upload_Validator::isValidExtension() instead.');
|
||||
$validator = new Upload_Validator();
|
||||
$validator->setTmpFile($tmpFile);
|
||||
return $validator->isValidExtension();
|
||||
|
@ -444,10 +444,10 @@ JS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @deprecated 3.0
|
||||
*/
|
||||
function setRelationAutoSetting($value) {
|
||||
user_error("ComplexTableField::setRelationAutoSetting() is deprecated; manipulate the DataList instead", E_USER_WARNING);
|
||||
Deprecation::notice('3.0', 'Manipulate the DataList instead.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,6 +56,7 @@ class CompositeField extends FormField {
|
||||
* @deprecated 3.0 Please use {@link FieldList()}.
|
||||
*/
|
||||
public function FieldSet() {
|
||||
Deprecation::notice('3.0', 'Use FieldList() instead.');
|
||||
return $this->FieldList();
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,10 @@
|
||||
class FieldSet extends FieldList {
|
||||
|
||||
/**
|
||||
* @deprecated 3.0.0 Use FieldList instead
|
||||
* @deprecated 3.0 Use FieldList instead
|
||||
*/
|
||||
public function __construct($items = array()) {
|
||||
Deprecation::notice('3.0.0', 'Use FieldList instead');
|
||||
Deprecation::notice('3.0', 'Use FieldList instead.');
|
||||
parent::__construct(!is_array($items) || func_num_args() > 1 ? func_get_args(): $items);
|
||||
}
|
||||
}
|
||||
|
@ -1215,6 +1215,7 @@ class Form extends RequestHandler {
|
||||
* @deprecated 2.5 Use SecurityToken::disable()
|
||||
*/
|
||||
static function disable_all_security_tokens() {
|
||||
Deprecation::notice('2.5', 'Use SecurityToken::disable() instead.');
|
||||
SecurityToken::disable();
|
||||
}
|
||||
|
||||
@ -1227,6 +1228,7 @@ class Form extends RequestHandler {
|
||||
* @return bool
|
||||
*/
|
||||
function securityTokenEnabled() {
|
||||
Deprecation::notice('2.5', 'Use Form->getSecurityToken()->isEnabled() instead.');
|
||||
return $this->securityToken->isEnabled();
|
||||
}
|
||||
|
||||
|
@ -127,6 +127,7 @@ class FormField extends RequestHandler {
|
||||
* @deprecated 3.0 Use {@link getName()}.
|
||||
*/
|
||||
public function Name() {
|
||||
Deprecation::notice('3.0', 'Use getName() instead.');
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
|
@ -473,6 +473,7 @@ JS
|
||||
* @deprecated Use getDataList() instead.
|
||||
*/
|
||||
function getQuery() {
|
||||
Deprecation::notice('3.0', 'Use getDataList() instead.');
|
||||
$list = $this->getDataList();
|
||||
if(method_exists($list,'dataQuery')) {
|
||||
return $this->getDataList()->dataQuery()->query();
|
||||
@ -483,6 +484,7 @@ JS
|
||||
* @deprecated Use getCsvDataList() instead.
|
||||
*/
|
||||
function getCsvQuery() {
|
||||
Deprecation::notice('3.0', 'Use getCsvDataList() instead.');
|
||||
$list = $this->getCsvDataList();
|
||||
if(method_exists($list,'dataQuery')) {
|
||||
return $list->dataQuery()->query();
|
||||
@ -745,7 +747,7 @@ JS
|
||||
* @deprecated Put the query string onto your form's link instead :-)
|
||||
*/
|
||||
function setExtraLinkParams($params){
|
||||
user_error("TableListField::setExtraLinkParams() deprecated - put the query string onto your form's FormAction instead; it will be handed down to all field with special handlers", E_USER_NOTICE);
|
||||
Deprecation::notice('2.4', 'Put the query string onto your FormAction instead().');
|
||||
$this->extraLinkParams = $params;
|
||||
}
|
||||
|
||||
@ -1086,6 +1088,7 @@ JS
|
||||
* @deprecated Please use the standard URL through Link() which gives you the FieldHolder as an HTML fragment.
|
||||
*/
|
||||
function ajax_refresh() {
|
||||
Deprecation::notice('2.4', 'Please use the standard URL through Link() which gives you the FieldHolder as an HTML fragment instead.');
|
||||
// compute sourceItems here instead of Items() to ensure that
|
||||
// pagination and filters are respected on template accessors
|
||||
//$this->sourceItems();
|
||||
|
@ -127,6 +127,7 @@ abstract class Validator extends Object {
|
||||
* @deprecated 2.4 Use Validator->getErrors() and custom code
|
||||
*/
|
||||
function showError() {
|
||||
Deprecation::notice('2.4', 'Use Validator->getErrors() and custom code instead.');
|
||||
Debug::show($this->errors);
|
||||
}
|
||||
|
||||
@ -134,6 +135,7 @@ abstract class Validator extends Object {
|
||||
* @deprecated 2.4 Use custom code
|
||||
*/
|
||||
function getCombinedError(){
|
||||
Deprecation::notice('2.4', 'Use custom code instead.');
|
||||
if($this->errors) {
|
||||
foreach($this->errors as $error){
|
||||
$ret['message'] .= $error['message']."<br />";
|
||||
@ -148,6 +150,7 @@ abstract class Validator extends Object {
|
||||
* @deprecated 2.4 Use getErrors()
|
||||
*/
|
||||
function getError(){
|
||||
Deprecation::notice('2.4', 'Use getErrors() instead.');
|
||||
return $this->getErrors();
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,7 @@
|
||||
* @deprecated 3.0 Use ManyManyList or HasManyList
|
||||
*/
|
||||
class ComponentSet extends DataObjectSet {
|
||||
|
||||
function setComponentInfo($type, $ownerObj, $ownerClass, $tableName, $childClass, $joinField = null) {
|
||||
user_error("ComponentSet is deprecated; use HasManyList or ManyManyList", E_USER_WARNING);
|
||||
Deprecation::notice('3.0', 'Use ManyManyList or HasManyList instead.');
|
||||
}
|
||||
}
|
@ -53,7 +53,7 @@ abstract class DataExtension extends Extension {
|
||||
|
||||
// @deprecated 2.4 - use extraStatics() now, not extraDBFields()
|
||||
if(method_exists($extensionClass, 'extraDBFields')) {
|
||||
user_error('DataExtension::extraDBFields() is deprecated. Please use extraStatics() instead.', E_USER_NOTICE);
|
||||
Deprecation::notice('2.4', 'DataExtension::extraDBFields() is deprecated. Please use extraStatics() instead.');
|
||||
$extraStaticsMethod = 'extraDBFields';
|
||||
} else {
|
||||
$extraStaticsMethod = 'extraStatics';
|
||||
|
@ -2457,10 +2457,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0.0 Use DataObject::get and DataList to do your querying
|
||||
* @deprecated 3.0 Use DataObject::get and DataList to do your querying
|
||||
*/
|
||||
public function buildSQL($filter = "", $sort = "", $limit = "", $join = "", $restrictClasses = true, $having = "") {
|
||||
Deprecation::notice('3.0.0', 'Use DataObject::get and DataList to do your querying');
|
||||
Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.');
|
||||
return $this->extendedSQL($filter, $sort, $limit, $join, $having);
|
||||
|
||||
}
|
||||
@ -2471,9 +2471,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
private static $cache_buildSQL_query;
|
||||
|
||||
/**
|
||||
* @deprecated 3.0.0 Use DataObject::get and DataList to do your querying
|
||||
* @deprecated 3.0 Use DataObject::get and DataList to do your querying
|
||||
*/
|
||||
public function extendedSQL($filter = "", $sort = "", $limit = "", $join = ""){
|
||||
Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.');
|
||||
$dataList = DataObject::get($this->class, $filter, $sort, $join, $limit);
|
||||
return $dataList->dataQuery()->query();
|
||||
}
|
||||
@ -2501,10 +2502,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0.0 Use DataObject::get and DataList to do your querying
|
||||
* @deprecated 3.0 Use DataObject::get and DataList to do your querying
|
||||
*/
|
||||
public function Aggregate($class = null) {
|
||||
Deprecation::notice('3.0.0', 'Use DataObject::get and DataList to do your querying');
|
||||
Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.');
|
||||
|
||||
if($class) {
|
||||
$list = new DataList($class);
|
||||
@ -2518,10 +2519,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0.0 Use DataObject::get and DataList to do your querying
|
||||
* @deprecated 3.0 Use DataObject::get and DataList to do your querying
|
||||
*/
|
||||
public function RelationshipAggregate($relationship) {
|
||||
Deprecation::notice('3.0.0', 'Use DataObject::get and DataList to do your querying');
|
||||
Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.');
|
||||
|
||||
return $this->$relationship();
|
||||
}
|
||||
@ -2530,7 +2531,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
* The internal function that actually performs the querying for get().
|
||||
* DataObject::get("Table","filter") is the same as singleton("Table")->instance_get("filter")
|
||||
*
|
||||
* @deprecated 3.0.0 Use DataObject::get and DataList to do your querying
|
||||
* @deprecated 3.0 Use DataObject::get and DataList to do your querying
|
||||
*
|
||||
* @param string $filter A filter to be inserted into the WHERE clause.
|
||||
* @param string $sort A sort expression to be inserted into the ORDER BY clause. If omitted, self::$default_sort will be used.
|
||||
@ -2541,14 +2542,14 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
* @return mixed The objects matching the filter, in the class specified by $containerClass
|
||||
*/
|
||||
public function instance_get($filter = "", $sort = "", $join = "", $limit="", $containerClass = "DataObjectSet") {
|
||||
Deprecation::notice('3.0.0', 'Use DataObject::get and DataList to do your querying');
|
||||
Deprecation::notice('3.0', 'Use DataObject::get and DataList to do your querying instead.');
|
||||
return self::get($this->class, $filter, $sort, $join, $limit, $containerClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take a database {@link SS_Query} and instanciate an object for each record.
|
||||
*
|
||||
* @deprecated 3.0.0 Replaced by DataList
|
||||
* @deprecated 3.0 Replaced by DataList
|
||||
*
|
||||
* @param SS_Query|array $records The database records, a {@link SS_Query} object or an array of maps.
|
||||
* @param string $containerClass The class to place all of the objects into.
|
||||
@ -2556,7 +2557,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
* @return mixed The new objects in an object of type $containerClass
|
||||
*/
|
||||
function buildDataObjectSet($records, $containerClass = "DataObjectSet", $query = null, $baseClass = null) {
|
||||
Deprecation::notice('3.0.0', 'Replaced by DataList');
|
||||
Deprecation::notice('3.0', 'Use DataList instead.');
|
||||
|
||||
foreach($records as $record) {
|
||||
if(empty($record['RecordClassName'])) {
|
||||
@ -2673,7 +2674,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
/**
|
||||
* Does the hard work for get_one()
|
||||
*
|
||||
* @deprecated 3.0.0 Use DataObject::get_one() instead
|
||||
* @deprecated 3.0 Use DataObject::get_one() instead
|
||||
*
|
||||
* @uses DataExtension->augmentSQL()
|
||||
*
|
||||
@ -2682,7 +2683,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
* @return DataObject The first item matching the query
|
||||
*/
|
||||
public function instance_get_one($filter, $orderby = null) {
|
||||
Deprecation::notice('3.0.0', 'Use DataObject::get_one() instead');
|
||||
Deprecation::notice('3.0', 'Use DataObject::get_one() instead.');
|
||||
return DataObject::get_one($this->class, $filter, true, $orderby);
|
||||
}
|
||||
|
||||
@ -2825,20 +2826,20 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0.0 Use DataObject::database_fields() instead
|
||||
* @deprecated 3.0 Use DataObject::database_fields() instead
|
||||
* @see DataObject::database_fields()
|
||||
*/
|
||||
public function databaseFields() {
|
||||
Deprecation::notice('3.0.0', 'Use DataObject::database_fields() instead');
|
||||
Deprecation::notice('3.0', 'Use DataObject::database_fields() instead.');
|
||||
return self::database_fields($this->class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.0.0 Use DataObject::custom_database_fields() instead
|
||||
* @deprecated 3.0 Use DataObject::custom_database_fields() instead
|
||||
* @see DataObject::custom_database_fields()
|
||||
*/
|
||||
public function customDatabaseFields() {
|
||||
Deprecation::notice('3.0.0', 'Use DataObject::custom_database_fields() instead');
|
||||
Deprecation::notice('3.0', 'Use DataObject::custom_database_fields() instead.');
|
||||
return self::custom_database_fields($this->class);
|
||||
}
|
||||
|
||||
|
@ -7,11 +7,7 @@
|
||||
abstract class DataObjectDecorator extends DataExtension {
|
||||
|
||||
public function __construct() {
|
||||
// TODO Re-enable before we release 3.0 beta, for now it "breaks" too many modules
|
||||
// user_error(
|
||||
// 'DataObjectDecorator is deprecated, please use DataExtension instead.',
|
||||
// E_USER_NOTICE
|
||||
// );
|
||||
Deprecation::notice('3.0', 'Use DataExtension instead.');
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
class DataObjectSet extends ArrayList {
|
||||
|
||||
/**
|
||||
* @deprecated 3.0.0
|
||||
* @deprecated 3.0
|
||||
*/
|
||||
public function __construct($items = array()) {
|
||||
Deprecation::notice('3.0.0', 'Use DataList or ArrayList instead');
|
||||
Deprecation::notice('3.0', 'Use DataList or ArrayList instead');
|
||||
|
||||
if ($items) {
|
||||
if (!is_array($items) || func_num_args() > 1) {
|
||||
|
@ -367,6 +367,7 @@ class DataQuery {
|
||||
* @deprecated Use innerJoin() or leftJoin() instead.
|
||||
*/
|
||||
function join($join) {
|
||||
Deprecation::notice('3.0', 'Use innerJoin() or leftJoin() instead.');
|
||||
if($join) {
|
||||
$clone = $this;
|
||||
$clone->query->from[] = $join;
|
||||
|
@ -131,6 +131,7 @@ class ManyManyList extends RelationList {
|
||||
* @deprecated this is experimental and will change. Don't use it in your projects.
|
||||
*/
|
||||
function removeByFilter($filter) {
|
||||
Deprecation::notice('3.0', 'This is experimental and will change. Don\'t use it in your projects.');
|
||||
$query = new SQLQuery("*", array("\"$this->joinTable\""));
|
||||
$query->delete = true;
|
||||
$query->where($filter);
|
||||
|
@ -19,6 +19,11 @@
|
||||
class Currency extends Decimal {
|
||||
protected static $currencySymbol = '$';
|
||||
|
||||
function __construct($name, $wholeSize = 9, $decimalSize = 2, $defaultValue = 0) {
|
||||
Deprecation::notice('2.5', 'Use Money class instead.');
|
||||
parent::__construct($name, $wholeSize, $decimalSize, $defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number as a currency, eg “$1,000.00”.
|
||||
*/
|
||||
|
@ -118,7 +118,7 @@ class BasicAuth {
|
||||
* @deprecated Use BasicAuth::protect_entire_site() instead.
|
||||
*/
|
||||
static function enable() {
|
||||
user_error("BasicAuth::enable() is deprecated. Use BasicAuth::protect_entire_site() instead.", E_USER_NOTICE);
|
||||
Deprecation::notice('2.4', 'Use BasicAuth::protect_entire_site() instead.');
|
||||
return self::protect_entire_site();
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ class BasicAuth {
|
||||
* @deprecated Use BasicAuth::protect_entire_site(false) instead.
|
||||
*/
|
||||
static function disable() {
|
||||
user_error("BasicAuth::disable() is deprecated. Use BasicAuth::protect_entire_site(false) instead.", E_USER_NOTICE);
|
||||
Deprecation::notice('2.4', 'Use BasicAuth::protect_entire_site(false) instead.');
|
||||
return self::protect_entire_site(false);
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ class Group extends DataObject {
|
||||
* @deprecated 2.5
|
||||
*/
|
||||
public static function addToGroupByName($member, $groupcode) {
|
||||
user_error('Group::addToGroupByName is deprecated. Please use $member->addToGroupByCode($groupcode)', E_USER_NOTICE);
|
||||
Deprecation::notice('2.5', 'Use $member->addToGroupByCode($groupcode) instead.');
|
||||
|
||||
return $member->addToGroupByCode($groupcode);
|
||||
}
|
||||
@ -291,6 +291,7 @@ class Group extends DataObject {
|
||||
* @deprecated 3.0 Use getTreeTitle()
|
||||
*/
|
||||
function TreeTitle() {
|
||||
Deprecation::notice('3.0', 'Use getTreeTitle() instead.');
|
||||
return $this->getTreeTitle();
|
||||
}
|
||||
|
||||
|
@ -792,6 +792,7 @@ class Member extends DataObject {
|
||||
* @return Returns TRUE if this user is an administrator.
|
||||
*/
|
||||
function isAdmin() {
|
||||
Deprecation::notice('2.4', 'Use Permission::check(\'ADMIN\') instead.');
|
||||
return Permission::checkMember($this, 'ADMIN');
|
||||
}
|
||||
|
||||
@ -1431,7 +1432,7 @@ class Member_GroupSet extends ManyManyList {
|
||||
* @deprecated Use setByIdList() and/or a CheckboxSetField
|
||||
*/
|
||||
function setByCheckboxes(array $checkboxes, array $data) {
|
||||
user_error("Member_GroupSet is deprecated and no longer works", E_USER_WARNING);
|
||||
Deprecation::notice('2.4', 'Use setByIdList() and/or a CheckboxSetField instead.');
|
||||
}
|
||||
|
||||
|
||||
@ -1504,7 +1505,7 @@ class Member_GroupSet extends ManyManyList {
|
||||
* @deprecated Use DataList::addMany
|
||||
*/
|
||||
function addManyByGroupID($ids){
|
||||
user_error('addManyByGroupID is deprecated, use addMany', E_USER_NOTICE);
|
||||
Deprecation::notice('2.4', 'Use addMany() instead.');
|
||||
return $this->addMany($ids);
|
||||
}
|
||||
|
||||
@ -1513,7 +1514,7 @@ class Member_GroupSet extends ManyManyList {
|
||||
* @deprecated Use DataList::removeMany
|
||||
*/
|
||||
function removeManyByGroupID($groupIds) {
|
||||
user_error('removeManyByGroupID is deprecated, use removeMany', E_USER_NOTICE);
|
||||
Deprecation::notice('2.4', 'Use removeMany() instead.');
|
||||
return $this->removeMany($ids);
|
||||
}
|
||||
|
||||
@ -1522,7 +1523,7 @@ class Member_GroupSet extends ManyManyList {
|
||||
* @deprecated Use DataObject::get("Group")->byIds()
|
||||
*/
|
||||
function getGroupsFromIDs($ids) {
|
||||
user_error('getGroupsFromIDs is deprecated, use DataObject::get("Group")->byIds()', E_USER_NOTICE);
|
||||
Deprecation::notice('2.4', 'Use DataObject::get("Group")->byIds() instead.');
|
||||
return DataObject::get("Group")->byIDs($ids);
|
||||
}
|
||||
|
||||
@ -1531,7 +1532,7 @@ class Member_GroupSet extends ManyManyList {
|
||||
* @deprecated Group.Code is deprecated
|
||||
*/
|
||||
function addManyByCodename($codenames) {
|
||||
user_error("addManyByCodename is deprecated and no longer works", E_USER_WARNING);
|
||||
Deprecation::notice('2.4', 'Don\'t rely on codename');
|
||||
}
|
||||
|
||||
|
||||
@ -1539,7 +1540,7 @@ class Member_GroupSet extends ManyManyList {
|
||||
* @deprecated Group.Code is deprecated
|
||||
*/
|
||||
function removeManyByCodename($codenames) {
|
||||
user_error("removeManyByCodename is deprecated and no longer works", E_USER_WARNING);
|
||||
Deprecation::notice('2.4', 'Don\'t rely on codename');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -777,6 +777,7 @@ class Security extends Controller {
|
||||
* store the passwords in clear text.
|
||||
*/
|
||||
public static function encrypt_passwords($encrypt) {
|
||||
Deprecation::notice('2.4', 'Use PasswordEncryptor_None instead.');
|
||||
self::$encryptPasswords = (bool)$encrypt;
|
||||
}
|
||||
|
||||
@ -790,6 +791,7 @@ class Security extends Controller {
|
||||
* @return array Returns an array of strings containing all supported encryption algorithms.
|
||||
*/
|
||||
public static function get_encryption_algorithms() {
|
||||
Deprecation::notice('2.4', 'Use PasswordEncryptor::get_encryptors() instead.');
|
||||
return array_keys(PasswordEncryptor::get_encryptors());
|
||||
}
|
||||
|
||||
|
@ -112,6 +112,7 @@ class ArrayData extends ViewableData {
|
||||
* @deprecated 3.0 Use {@link ArrayData::toMap()}.
|
||||
*/
|
||||
public function getArray() {
|
||||
Deprecation::notice('3.0', 'Use ArrayData::toMap() instead.');
|
||||
return $this->toMap();
|
||||
}
|
||||
|
||||
|
@ -658,6 +658,7 @@ class SSTemplateParser extends Parser {
|
||||
* @deprecated
|
||||
*/
|
||||
function ClosedBlock_Handle_Control(&$res) {
|
||||
Deprecation::notice('3.1', 'Use <% with %> or <% loop %> instead.');
|
||||
return $this->ClosedBlock_Handle_Loop($res);
|
||||
}
|
||||
|
||||
|
@ -715,7 +715,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
* @deprecated 3.0
|
||||
*/
|
||||
public function BaseHref() {
|
||||
user_error("Please use AbsoluteBaseURL", E_USER_WARNING);
|
||||
Deprecation::notice('3.0', 'Use AbsoluteBaseURL instead.');
|
||||
|
||||
return $this->AbsoluteBaseURL();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user