diff --git a/core/Object.php b/core/Object.php index 338945716..276c37795 100755 --- a/core/Object.php +++ b/core/Object.php @@ -441,7 +441,7 @@ abstract class Object { * instances, not existing ones (including all instances created through {@link singleton()}). * * @see http://doc.silverstripe.org/framework/en/trunk/reference/dataextension - * @param string $class Class that should be extended - has to be a subclass of {@link Object} + * @param string $classOrExtension Class that should be extended - has to be a subclass of {@link Object} * @param string $extension Subclass of {@link Extension} with optional parameters * as a string, e.g. "Versioned" or "Translatable('Param')" */ diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index 5519e0f76..4db25575e 100644 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -446,6 +446,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase { * {@link loadFixture()} */ public function clearFixtures() { + $this->fixtures = array(); $this->getFixtureFactory()->clear(); } diff --git a/docs/en/02_Developer_Guides/05_Extending/How_Tos/03_Track_member_logins.md b/docs/en/02_Developer_Guides/05_Extending/How_Tos/03_Track_member_logins.md index c3a00d601..e52c38171 100644 --- a/docs/en/02_Developer_Guides/05_Extending/How_Tos/03_Track_member_logins.md +++ b/docs/en/02_Developer_Guides/05_Extending/How_Tos/03_Track_member_logins.md @@ -28,7 +28,7 @@ explicitly logging in or by invoking the "remember me" functionality. public function updateCMSFields(FieldList $fields) { $fields->addFieldsToTab('Root.Main', array( ReadonlyField::create('LastVisited', 'Last visited'), - ReadonlyField::create('NumVisits', 'Number of visits') + ReadonlyField::create('NumVisit', 'Number of visits') )); } diff --git a/docs/en/04_Changelogs/3.2.0.md b/docs/en/04_Changelogs/3.2.0.md index a3206cfda..dad837b06 100644 --- a/docs/en/04_Changelogs/3.2.0.md +++ b/docs/en/04_Changelogs/3.2.0.md @@ -25,30 +25,14 @@ removes from both draft and live simultaneously. * Most of the `Image` manipulation methods have been renamed -## Deprecated classes/methods removed +## Deprecated classes/methods + +The following functionality deprecated in 3.0 has been removed: -* `ToggleField` was deprecated in 3.1, and has been removed. Use custom Javascript with `ReadonlyField` instead. -* `ExactMatchMultiFilter` was deprecated in 3.1, and has been removed. Use `ExactMatchFilter` instead. -* `NegationFilter` was deprecated in 3.1, and has been removed. Use `ExactMatchFilter:not` instead. -* `StartsWithMultiFilter` was deprecated in 3.1, and has been removed. Use `StartsWithFilter` instead. -* `ScheduledTask` and subclasses like `DailyTask` were deprecated in 3.1, and have been removed. - Use custom code instead, or a module like silverstripe-crontask: https://github.com/silverstripe-labs/silverstripe-crontask -* `Cookie::forceExpiry()` was removed. Use `Cookie::force_expiry()` instead -* `Object` statics removal: `get_static()`, `set_static()`, `uninherited_static()`, `combined_static()`, - `addStaticVars()` and `add_static_var()` removed. Use the Config methods instead. -* `GD` methods removed: `setGD()`, `getGD()`, `hasGD()`. Use `setImageResource()`, `getImageResource()`, and `hasImageResource()` instead -* `DataExtension::get_extra_config()` removed, no longer supports `extraStatics` or `extraDBFields`. Define your - statics on the class directly. * `DataList::getRange()` removed. Use `limit()` instead. * `SQLMap` removed. Call `map()` on a `DataList` or use `SS_Map` directly instead. -* `Profiler` removed. Use xhprof or xdebug for profiling instead. -* `Aggregate` removed. Call aggregate methods on a `DataList` instead e.g. `Member::get()->max('LastEdited')` -* `MySQLDatabase::set_connection_charset()` removed. Use `MySQLDatabase.connection_charset` config setting instead -* `SQLConditionalExpression/SQLQuery` `select()`, `limit()`, `orderby()`, `groupby()`, `having()`, `from()`, `leftjoin()`, `innerjoin()`, `where()` and `whereAny()` removed. +* `SQLQuery` methods `select()`, `limit()`, `orderby()`, `groupby()`, `having()`, `from()`, `leftjoin()`, `innerjoin()`, `where()` and `whereAny()` removed. Use `set*()` and `add*()` methods instead. -* Template `<% control $MyList %>` syntax removed. Use `<% loop $MyList %>` instead. -* Removed `Member.LastVisited` and `Member.NumVisits` properties, see - [Howto: Track Member Logins](/extending/how_tos/track_member_logins) to restore functionality as custom code ## New and changed API @@ -199,6 +183,27 @@ ## Upgrading Notes +### Disable `LastVisited` and `NumVisits` counter + +These fields were deprecated in 3.1 due to performance concerns, and should be disabled unless required by +your application. + +In order to disable these functions you can add the following yml to your configuration: + + :::yaml + --- + Name: disablevisits + --- + Member: + log_num_visits: false + log_last_visited: false + + +This functionality will be removed in 4.0 + +[Howto: Track Member Logins](/developer-guides/extending/how_tos/track_member_logins) to restore functionality +as custom code + ### UploadField "Select from files" shows files in all folders by default In order to list files in a single folder by default (previous default behaviour), diff --git a/model/DataList.php b/model/DataList.php index 0228eadb0..772febd1a 100644 --- a/model/DataList.php +++ b/model/DataList.php @@ -493,6 +493,12 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab throw new InvalidArgumentException("Bad field expression $field"); } + if (!$this->inAlterDataQueryCall) { + throw new BadMethodCallException( + 'getRelationName is mutating, and must be called inside an alterDataQuery block' + ); + } + if(strpos($field,'.') === false) { return '"'.$field.'"'; } diff --git a/security/Member.php b/security/Member.php index e5c41cbcc..07d554bc6 100644 --- a/security/Member.php +++ b/security/Member.php @@ -12,8 +12,6 @@ * @property string $RememberLoginToken * @property string $TempIDHash * @property string $TempIDExpired - * @property int $NumVisit - * @property string $LastVisited Date and time of last visit * @property string $AutoLoginHash * @property string $AutoLoginExpired * @property string $PasswordEncryption @@ -120,7 +118,6 @@ class Member extends DataObject implements TemplateGlobalProvider { 'TempIDHash', 'TempIDExpired', 'Salt', - 'NumVisit' ); /** @@ -549,7 +546,6 @@ class Member extends DataObject implements TemplateGlobalProvider { $member->RememberLoginToken = $hash; Cookie::set('alc_enc', $member->ID . ':' . $token, 90, null, null, false, true); - $member->NumVisit++; $member->write(); // Audit logging hook