API Removed methods previously deprecated in 3.0

This commit is contained in:
Ingo Schommer 2012-12-14 01:05:11 +01:00
parent aed58a55c4
commit 644cc79ebb
7 changed files with 10 additions and 159 deletions

View File

@ -21,3 +21,12 @@
* Removed non-functional `$inlineImages` option for sending emails * Removed non-functional `$inlineImages` option for sending emails
* Removed support for keyed arrays in `SelectionGroup`, use new `SelectionGroup_Item` object * Removed support for keyed arrays in `SelectionGroup`, use new `SelectionGroup_Item` object
to populate the list instead (see [API docs](api:SelectionGroup)). to populate the list instead (see [API docs](api:SelectionGroup)).
* Removed `Form->Name()`: Use getName()
* Removed `FormField->setContainerFieldSet()`: Use setContainerFieldList()
* Removed `FormField->rootFieldSet()`: Use rootFieldList()
* Removed `Group::map()`: Use DataList::("Group")->map()
* Removed `Member->generateAutologinHash()`: Tokens are no longer saved directly into the database in plaintext. Use the return value of the Member::generateAutologinTokenAndHash to get the token
* Removed `Member->sendInfo()`: use Member_ChangePasswordEmail or Member_ForgotPasswordEmail directly
* Removed `SQLMap::map()`: Use DataList::("Member")->map()
* Removed `SQLMap::mapInGroups()`: Use Member::map_in_groups()
* Removed `PasswordEncryptor::register()/unregister()`: Use config system instead

View File

@ -864,14 +864,6 @@ class Form extends RequestHandler {
return $this; return $this;
} }
/**
* @return string
*/
public function Name() {
Deprecation::notice('3.0', 'Use getName() instead.');
return $this->getName();
}
/** /**
* Get the name of the form. * Get the name of the form.
* @return string * @return string

View File

@ -814,11 +814,6 @@ class FormField extends RequestHandler {
} }
} }
public function setContainerFieldSet($list) {
Deprecation::notice('3.0', 'Use setContainerFieldList() instead.');
return $this->setContainerFieldList($list);
}
/** /**
* Set the FieldList that contains this field. * Set the FieldList that contains this field.
* *
@ -830,11 +825,6 @@ class FormField extends RequestHandler {
return $this; return $this;
} }
public function rootFieldSet() {
Deprecation::notice('3.0', 'Use rootFieldList() instead.');
return $this->rootFieldList();
}
public function rootFieldList() { public function rootFieldList() {
if(is_object($this->containerFieldList)) return $this->containerFieldList->rootFieldList(); if(is_object($this->containerFieldList)) return $this->containerFieldList->rootFieldList();
else user_error("rootFieldList() called on $this->class object without a containerFieldList", E_USER_ERROR); else user_error("rootFieldList() called on $this->class object without a containerFieldList", E_USER_ERROR);

View File

@ -252,17 +252,6 @@ class Group extends DataObject {
return $this->getManyManyComponents('Members'); return $this->getManyManyComponents('Members');
} }
public static function map($filter = "", $sort = "", $blank="") {
Deprecation::notice('3.0', 'Use DataList::("Group")->map()');
$list = Group::get()->where($filter)->sort($sort);
$map = $list->map();
if($blank) $map->unshift(0, $blank);
return $map;
}
/** /**
* Return a set of this record's "family" of IDs - the IDs of * Return a set of this record's "family" of IDs - the IDs of
* this record and all its descendants. * this record and all its descendants.

View File

@ -472,23 +472,6 @@ class Member extends DataObject implements TemplateGlobalProvider {
return $token; return $token;
} }
/**
* @deprecated 3.0
*/
public function generateAutologinHash($lifetime = 2) {
Deprecation::notice('3.0',
'Member::generateAutologinHash is deprecated - tokens are no longer saved directly into the database '.
'in plaintext. Use the return value of the Member::generateAutologinTokenAndHash to get the token '.
'instead.',
Deprecation::SCOPE_METHOD);
user_error(
'Member::generateAutologinHash is deprecated - tokens are no longer saved directly into the database '.
'in plaintext. Use the return value of the Member::generateAutologinTokenAndHash to get the token '.
'instead.',
E_USER_ERROR);
}
/** /**
* Check the token against the member. * Check the token against the member.
* *
@ -526,35 +509,6 @@ class Member extends DataObject implements TemplateGlobalProvider {
return $member; return $member;
} }
/**
* Send signup, change password or forgot password informations to an user
*
* @param string $type Information type to send ("signup", "changePassword" or "forgotPassword")
* @param array $data Additional data to pass to the email (can be used in the template)
*/
public function sendInfo($type = 'signup', $data = null) {
Deprecation::notice('3.0',
'Please use Member_ChangePasswordEmail or Member_ForgotPasswordEmail directly instead');
switch($type) {
case "changePassword":
$e = Member_ChangePasswordEmail::create();
break;
case "forgotPassword":
$e = Member_ForgotPasswordEmail::create();
break;
}
if(is_array($data)) {
foreach($data as $key => $value)
$e->$key = $value;
}
$e->populateTemplate($this);
$e->setTo($this->Email);
$e->send();
}
/** /**
* Returns the fields for the member form - used in the registration/profile module. * Returns the fields for the member form - used in the registration/profile module.
* It should return fields that are editable by the admin and the logged-in user. * It should return fields that are editable by the admin and the logged-in user.
@ -1011,42 +965,6 @@ class Member extends DataObject implements TemplateGlobalProvider {
return $this->getManyManyComponents('Groups'); return $this->getManyManyComponents('Groups');
} }
/**
* Get member SQLMap
*
* @param string $filter Filter for the SQL statement (WHERE clause)
* @param string $sort Sorting function (ORDER clause)
* @param string $blank Shift a blank member in the items
* @return SQLMap Returns an SQLMap that returns all Member data.
*
* @todo Improve documentation of this function! (Markus)
*/
public static function map($filter = "", $sort = "", $blank="") {
Deprecation::notice('3.0', 'Use DataList::("Member")->map()');
$list = Member::get()->where($filter)->sort($sort);
$map = $list->map();
if($blank) $map->unshift(0, $blank);
return $map;
}
/**
* Get a member SQLMap of members in specific groups
*
* If no $groups is passed, all members will be returned
*
* @param mixed $groups - takes a SS_List, an array or a single Group.ID
* @return SQLMap Returns an SQLMap that returns all Member data.
* @see map()
*/
public static function mapInGroups($groups = null) {
Deprecation::notice('3.0', 'Use Member::map_in_groups() instead');
return self::map_in_groups();
}
/** /**
* Get a member SQLMap of members in specific groups * Get a member SQLMap of members in specific groups
* *

View File

@ -25,29 +25,6 @@ abstract class PasswordEncryptor {
return Config::inst()->get('PasswordEncryptor', 'encryptors'); return Config::inst()->get('PasswordEncryptor', 'encryptors');
} }
/**
* Add a new encryptor implementation.
*
* Note: Due to portability concerns, its not advisable to
* override an existing $code mapping with different behaviour.
*
* @param String $code This value will be stored stored in the
* {@link Member->PasswordEncryption} property.
* @param String $class Classname of a {@link PasswordEncryptor} subclass
*/
public static function register($code, $class) {
Deprecation::notice('3.0', 'Use the Config system to register Password encryptors');
self::$encryptors[$code] = $class;
}
/**
* @param String $code Unique lookup.
*/
public static function unregister($code) {
Deprecation::notice('3.0', 'Use the Config system to unregister Password encryptors');
if(isset(self::$encryptors[$code])) unset(self::$encryptors[$code]);
}
/** /**
* @param String $algorithm * @param String $algorithm
* @return PasswordEncryptor * @return PasswordEncryptor

View File

@ -25,30 +25,6 @@ class GroupTest extends FunctionalTest {
$this->assertNull($g3->Code, 'Default title doesnt trigger attribute setting'); $this->assertNull($g3->Code, 'Default title doesnt trigger attribute setting');
} }
/**
* Test the Group::map() function
*/
public function testGroupMap() {
// 2.4 only
$originalDeprecation = Deprecation::dump_settings();
Deprecation::notification_version('2.4');
/* Group::map() returns an SQLMap object implementing iterator. You can use foreach to get ID-Title pairs. */
// We will iterate over the map and build mapOuput to more easily call assertions on the result.
$map = Group::map();
$mapOutput = $map->toArray();
$group1 = $this->objFromFixture('Group', 'group1');
$group2 = $this->objFromFixture('Group', 'group2');
/* We have added 2 groups to our fixture. They should both appear in $mapOutput. */
$this->assertEquals($mapOutput[$group1->ID], $group1->Title);
$this->assertEquals($mapOutput[$group2->ID], $group2->Title);
Deprecation::restore_settings($originalDeprecation);
}
public function testMemberGroupRelationForm() { public function testMemberGroupRelationForm() {
Session::set('loggedInAs', $this->idFromFixture('GroupTest_Member', 'admin')); Session::set('loggedInAs', $this->idFromFixture('GroupTest_Member', 'admin'));