Commit Graph

61 Commits

Author SHA1 Message Date
Damian Mooyman
7c448bb4a2 Merge remote-tracking branch 'origin/3.2' into 3.3
# Conflicts:
#	tests/model/DataObjectLazyLoadingTest.php
#	tests/model/VersionedTest.yml
2016-01-25 14:11:37 +13:00
Damian Mooyman
bf8bf5e4d5 BUG Prevent Versioned::doRollbackTo from creating incorrect versions on subclasses of Versioned DataObjects
Document correct configuration of Versioned DataObjects
Fixes #4936
2016-01-22 15:35:58 +13:00
Damian Mooyman
df76d783fe BUG Fix VersionedTest sometimes failing given certain querystring arguments 2016-01-20 14:49:46 +13:00
Damian Mooyman
fce82519bd BUG Workaround for issues in testing version 2015-12-22 17:47:53 +13:00
Ingo Schommer
0175167761 Merge pull request #4830 from open-sausages/pulls/3/fix-querystring-stage
API Disable unauthenticated get parameter access to site stage mode
2015-12-10 10:44:43 +13:00
Damian Mooyman
fa0160a874 BUG Fix regression in canViewStage 2015-12-09 14:53:21 +13:00
Damian Mooyman
6089a7c5bd API Create default security permission model for versioned data objects 2015-12-09 11:33:53 +13:00
Damian Mooyman
38e154af0a API Disable get parameter access to site stage mode
BUG Fix missing and undocumented response from Security::permissionFailure()
2015-12-07 17:39:18 +13:00
Damian Mooyman
cf9d2d12ac BUG Fix duplicate primary key crash on duplicate 2015-08-10 09:54:30 +12:00
Benjamin R. White
6212b4bd4b FIX: Versioned not ignoring obsolete fields 2015-02-08 18:42:36 +13:00
Damian Mooyman
19549d620f Moved deprecation of SQLQuery to 4.0 2014-12-04 09:30:50 +13:00
Damian Mooyman
c140459ac6 BUG Fix versioned
Versioned is not writing Version to _version tables for subclasses of Version dataobjects which have their own DB fields
- Fix disjoint of ID / RecordID (which should be the same)
- Fix calculation of new record version
- Fix use of empty vs !isset to check for existing version
2014-09-02 09:14:08 +12:00
Damian Mooyman
eb069e605d Remove all redundant whitespace 2014-08-19 09:17:15 +12:00
Simon Welsh
c14d58f585 Merge branch '3.1'
Conflicts:
	.travis.yml
	model/ManyManyList.php
	model/fieldtypes/DBField.php
2014-07-16 21:24:02 +10:00
Damian Mooyman
d8e9af8af8 API New Database abstraction layer. Ticket #7429
Database abstraction broken up into controller, connector, query builder, and schema manager, each independently configurable via YAML / Injector
Creation of new DBQueryGenerator for database specific generation of SQL
Support for parameterised queries, move of code base to use these over escaped conditions
Refactor of SQLQuery into separate query classes for each of INSERT UPDATE DELETE and SELECT
Support for PDO
Installation process upgraded to use new ORM
SS_DatabaseException created to handle database errors, maintaining details of raw sql and parameter details for user code designed interested in that data.
Renamed DB static methods to conform correctly to naming conventions (e.g. DB::getConn -> DB::get_conn)
3.2 upgrade docs
Performance Optimisation and simplification of code to use more concise API
API Ability for database adapters to register extensions to ConfigureFromEnv.php
2014-07-09 18:04:05 +12:00
Sean Harvey
0ee3a683a5 Better support for overloading start and destroy methods in Session
Move functionality from static start and destroy functions into instance
methods, allowing these to be overloaded. This works the same way as
calling Session::set() which then in turn calls inst_set()

Additionally use Injector to create the default Session instance to
allow the class to be swapped out.
2014-06-20 10:35:53 +12:00
Ingo Schommer
bb03f6ba2f Merge remote-tracking branch 'origin/3.1'
Conflicts:
	forms/HtmlEditorField.php
2014-06-15 22:50:20 +12:00
Damian Mooyman
4c5de82625 Versioned no longer sets redundant session data 2014-06-11 16:42:22 +12:00
Damian Mooyman
4a34c364e6 BUG Fix access to protected Session::current_session()
Fixes #3144
2014-05-20 10:17:33 +12:00
Damian Mooyman
ec578e5c8a Merge remote-tracking branch 'origin/3.1' 2014-05-12 11:32:22 +12:00
Damian Mooyman
ae573f829f BUG Fix Versioned stage not persisting in Session. Fixes #962
BUG Disabled disruptive test case in DirectorTest
API RequestProcessor and VersionedRequestFilter now both correctly implement RequestFilter
Better PHPDoc on RequestFilter and implementations
2014-05-06 14:11:44 +12:00
Simon Welsh
8f31352039 Merge remote-tracking branch 'origin/3.1'
Conflicts:
	.travis.yml
2014-03-16 09:36:48 +13:00
Damian Mooyman
23f5f08eda BUG Fix DataObject::loadLazyFields discarding original query parameters
BUG Fix Versioned::writeToStage failing to write object with unchanged fields
2014-03-04 16:12:07 +13:00
Fred Condo
b88a0955a5 API: Support string descriptors for unique indexes in Versioned
- Document the format for descriptor arrays
- Implement the behaviour that developers have come to expect for
  string descriptors of indexes
- Add test for handling of unique indexes (MySQL & sqlite3)
- Resolve #2403

Versioned needs to convert unique indexes to non-unique for its suffixed
tables, such as Foo_Live and Foo_versions. Because DataObject accepts
string descriptors such as array('UniqIDX' => 'unique (Uniq)') as well
as array-based descriptors, Versioned needs to recognize string
descriptors. This patch accomplishes that. Before, Versioned would fail
to convert string-described indexes to non-unique, resulting in run-time
errors when creating a new version of an object.
2013-12-06 10:02:44 -08:00
Ingo Schommer
dfabd54bdb Fixed support for single stage in Versioned
This used to work in 2.4, so is considered a regression.
To test, simply add a Versioned("Stage") extension to
some record in 2.4 vs. 3.1.
2013-10-24 17:09:17 +02:00
Will Rossiter
f6cd582dd9 FIX: Remove version field from default scaffolded CMS fields. 2013-05-21 22:47:54 +12:00
Sean Harvey
f1a4e7203e BUG Fixing queries on non-existent table breaking archive site
With a many to many relation, e.g. SiteTree_MyRelation, and listing
them in your template then adding ?archiveDate=x in the URL, a SQL
error is shown because Versioned::augmentSQL() tries to query the
non-existent table "SiteTree_MyRelation_versions" assuming there's
versioning setup, but there isn't.
2013-05-07 12:34:46 +12:00
Ingo Schommer
3334eafcb1 API Marked statics private, use Config API instead (#8317)
See "Static configuration properties are now immutable, you must use Config API." in the 3.1 change log for details.
2013-03-24 17:20:53 +01:00
Ingo Schommer
9e82d8e857 Fixed line lengths 2013-01-11 09:59:33 +01:00
Damian Mooyman
6aa16e1f01 BUG Test case for versioned now correctly checks IDs returned from Versioned::get_including_deleted
BUG Issue with deleted records not being queried properly.
API DataQuery::expressionForField no longer requires a second parameter. Rather the query object is inferred from the DataQuery itself. This should improve consistency of use of this function.
2012-12-17 17:15:26 +13:00
Simon Welsh
b0121b541c Add codesniffer that ensures indentation is with tabs. 2012-12-12 17:33:31 +13:00
Sam Minnee
1f7fc1f76a FIX Remove instances of lines longer than 120c
The entire framework repo (with the exception of system-generated files) has been amended to respect the 120c line-length limit.  This is in preparation for the enforcement of this rule with PHP_CodeSniffer.
2012-09-30 17:18:13 +13:00
Ingo Schommer
e2f073f38a Method visibility according to coding conventions 2012-09-20 10:46:59 +02:00
Damian Mooyman
89728acece UPDATED: Improved get_all_versions test case to test versions in the middle of version updates. 2012-08-20 13:48:48 +12:00
Damian Mooyman
56fe7f881a REMOVED: Unnecessary publish actions from test cases
ADDED: Test case for get_all_versions
2012-08-20 13:44:56 +12:00
Damian Mooyman
0f09305e3d FIXED: Issue where temporary table would cause unpredictable behaviour. Temporary table functionality was substituted with subqueries in each use case.
ADDED: Test case for version archive functionality.
2012-08-20 13:24:28 +12:00
Sam Minnee
b654b95472 BUGFIX: Allow Versioned::get_latest_version() and Version::get_version() to return results if the classname has changed.
Without this bugfix, if you had a Page that used to be a SiteTree, and you tried to use Versiond::get_version() or Versioned::get_latest_version() to return the older SiteTree version, nothing would be returned, because the results were being filtered by ClassName.  This caused bugs in the history panel for certain combinbations of page classname alteration.
2012-06-28 13:00:40 +12:00
Sean Harvey
b1e17578c7 API CHANGE Removed assertType() and assertEmpty() workarounds. Use assertInstanceOf()
instead of assertType(), assertEmpty() is available in PHPUnit 3.5+.
PHPUnit 3.4 is no longer supported, so please upgrade your version to
work.

MINOR Removed FullTestSuite which was a workaround for PHPUnit but not
used.
2012-05-09 23:05:39 +12:00
Robert Curry
ff6909df97 ENHANCEMENT: Add lazy loading to DataQuery. 2012-04-30 16:12:15 +12:00
Sam Minnee
6915e58a39 BUGFIX: Fix SQLQuery::queriedTables() and added test. 2011-05-01 15:26:29 +12:00
Sam Minnee
de1494e3a8 ENHANCEMENT: Implemented DataList as the successor of DataObjectSet. DataList doesn't execute the query until it's actually needed, allowing for a more flexible ORM.
API CHANGE: augmentSQL is now passed a DataQuery object from which query parameters can be extracted.
API CHANGE: DataObjectDecorators that manipulate the query can now define augmentDataQueryCreation().
API CHANGE: The container class argument for DataObject::get() is deprecated.
API CHANGE: DataObject::buildSQL() and DataObject::extendedSQL() are deprecated; just use DataObject::get() now.
API CHANGE: DataObject::instance_get() and DataObject::instance_get_one() are deprecated, and can no longer be overloaded.
API CHANGE: DataObject::buildDataObjectSet() is deprecated.
API CHANGE: Cant't call manual manipulation methods on DataList such as insertFirst()
2011-05-01 15:25:45 +12:00
Ingo Schommer
2870eb9212 MINOR Changed $fixture_path to relative filenames in all sapphire test cases in order to allow easier file moving and less verbosity in tests 2011-03-30 23:04:48 +13:00
Ingo Schommer
a9b13509d2 MINOR Removed dependency on SiteTree in various unit tests 2011-03-29 18:07:58 +13:00
Ingo Schommer
2184acf17d Revert "MINOR Replaced assertType() calls with assertInstanceOf(), deprecated in PHPUnit 3.6 (throws warnings as of 3.5.10)" - cased too many problems with mixed build environments that require PHP 3.4
This reverts commit 65f6104cd6.
2011-03-11 15:06:09 +13:00
Ingo Schommer
65f6104cd6 MINOR Replaced assertType() calls with assertInstanceOf(), deprecated in PHPUnit 3.6 (throws warnings as of 3.5.10) 2011-02-21 18:49:09 +13:00
Sam Minnee
ffba082738 BUGFIX Fixed column names that were not quoted that broke PostgreSQL (from r110944)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112869 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-19 03:06:15 +00:00
Sam Minnee
0b2ed12c63 BUGFIX: delete orphaned records from versioned tables when updating. #5936 (from r110901)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112866 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-19 03:01:51 +00:00
Sam Minnee
97be4d2ca6 BUGFIX: Remove () that was breaking coverage report (from r109128)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112787 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-19 00:58:40 +00:00
Sam Minnee
2058ee31ee BUGFIX: DataObjects without the Versioned decorator cannot have a "Version" field. ticket #5775. Thanks ajshort (from r108399)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112725 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-18 22:53:19 +00:00
Ingo Schommer
b64015e2cf BUGFIX Remove dummy entry created by Versioned if record is first written to Live stage (fixes #5596, thanks muzdowski) (from r107537)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112603 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-15 03:53:14 +00:00