Merge pull request #223 from halkyon/deprecation_fixes

Deprecation fixes
This commit is contained in:
Sam Minnée 2012-03-08 18:49:45 -08:00
commit 2b245899b2
4 changed files with 6 additions and 70 deletions

View File

@ -626,16 +626,6 @@ class File extends DataObject {
return Director::baseURL() . $this->getFilename();
}
/**
* Return the last 50 characters of the URL.
*
* @deprecated 2.4
*/
function getLinkedURL() {
Deprecation::notice('2.4', 'Use getTreeTitle() instead.');
return "$this->Name";
}
/**
* Returns an absolute filesystem path to the file.
* Use {@link getRelativePath()} to get the same path relative to the webroot.

View File

@ -47,25 +47,17 @@ abstract class DataExtension extends Extension {
if(preg_match('/^([^(]*)/', $extension, $matches)) {
$extensionClass = $matches[1];
} else {
user_error("Bad extenion '$extension' - can't find classname", E_USER_WARNING);
user_error("Bad extension '$extension' - can't find classname", E_USER_WARNING);
return;
}
// @deprecated 2.4 - use extraStatics() now, not extraDBFields()
if(method_exists($extensionClass, 'extraDBFields')) {
Deprecation::notice('2.4', 'DataExtension::extraDBFields() is deprecated. Please use extraStatics() instead.');
$extraStaticsMethod = 'extraDBFields';
} else {
$extraStaticsMethod = 'extraStatics';
}
// If the extension has been manually applied to a subclass, we should ignore that.
if(Object::has_extension(get_parent_class($class), $extensionClass)) return;
// If there aren't any extraStatics we shouldn't try to load them.
if (!method_exists($extensionClass, $extraStaticsMethod) ) return;
$statics = call_user_func(array(singleton($extensionClass), $extraStaticsMethod), $class, $extension);
if(!method_exists($extensionClass, 'extraStatics')) return;
$statics = call_user_func(array(singleton($extensionClass), 'extraStatics'), $class, $extension);
if($statics) {
foreach($statics as $name => $newVal) {

View File

@ -81,7 +81,6 @@ abstract class PasswordEncryptor {
/**
* Return a string value stored in the {@link Member->Salt} property.
* Note: Only used when {@link Security::$useSalt} is TRUE.
*
* @uses RandomGenerator
*
@ -237,4 +236,4 @@ class PasswordEncryptor_None extends PasswordEncryptor {
* @package sapphire
* @subpackage security
*/
class PasswordEncryptor_NotFoundException extends Exception {}
class PasswordEncryptor_NotFoundException extends Exception {}

View File

@ -44,14 +44,6 @@ class Security extends Controller {
*/
protected static $strictPathChecking = false;
/**
* Should passwords be stored encrypted?
* @deprecated 2.4 Please use 'none' as the default $encryptionAlgorithm instead
*
* @var bool
*/
protected static $encryptPasswords = true;
/**
* The password encryption algorithm to use by default.
* This is an arbitrary code registered through {@link PasswordEncryptor}.
@ -60,14 +52,6 @@ class Security extends Controller {
*/
protected static $encryptionAlgorithm = 'sha1_v2.4';
/**
* Should a salt be used for the password encryption?
* @deprecated 2.4 Please use a custom {@link PasswordEncryptor} instead
*
* @var bool
*/
protected static $useSalt = true;
/**
* Showing "Remember me"-checkbox
* on loginform, and saving encrypted credentials to a cookie.
@ -733,35 +717,6 @@ class Security extends Controller {
}
/**
* Set if passwords should be encrypted or not
*
* @deprecated 2.4 Use PasswordEncryptor_None instead.
*
* @param bool $encrypt Set to TRUE if you want that all (new) passwords
* will be stored encrypted, FALSE if you want to
* store the passwords in clear text.
*/
public static function encrypt_passwords($encrypt) {
Deprecation::notice('2.4', 'Use PasswordEncryptor_None instead.');
self::$encryptPasswords = (bool)$encrypt;
}
/**
* Get a list of all available encryption algorithms.
* Note: These are arbitrary codes, and not callable methods.
*
* @deprecated 2.4 Use PasswordEncryptor::get_encryptors()
*
* @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());
}
/**
* Set the password encryption algorithm
*
@ -816,7 +771,7 @@ class Security extends Controller {
// if the password is empty, don't encrypt
strlen(trim($password)) == 0
// if no algorithm is provided and no default is set, don't encrypt
|| (!$algorithm && self::$encryptPasswords == false)
|| (!$algorithm)
) {
$algorithm = 'none';
} else {