Commit Graph

913 Commits

Author SHA1 Message Date
Ingo Schommer
8bf2f16c75 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	README.md
2013-05-17 13:50:40 +02:00
Ingo Schommer
79cf1faf53 Merge remote-tracking branch 'origin/2.4' into 3.0
Conflicts:
	README.md
	composer.json
	docs/en/installation/from-source.md
	docs/en/misc/contributing.md
	model/Database.php
2013-05-17 00:37:30 +02:00
Damian Mooyman
6e0e3564e1 NEW Added beforeExtending, afterExtending, and beforeUpdateCMSFields to allow user code better control over interaction with extending methods 2013-05-16 10:34:45 +12:00
Will Rossiter
7ade1ebd59 FIX: Money should use current locale by default. (Fixes: #6558) 2013-05-11 23:30:13 +12:00
Will Rossiter
1bc945f98c Partial code formatting / phpdoc cleanup of Versioned 2013-05-10 21:19:16 +12:00
Damian Mooyman
de41a2a75e BUG Fixes issue with '+' characters in url. 2013-05-10 16:16:31 +12:00
Ingo Schommer
3b02d22989 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	dev/CsvBulkLoader.php
2013-05-09 10:34:20 +02:00
Marcus Dalgren
7f871fa18b Fix orphaned records when running update
When DataObject::update() is run with relation fields and the relationship
is new the relationship ID was not set on the DataObject. This patch fixes
this. Fixes issue 6195 in open.silverstripe.org.
2013-05-09 03:53:53 +02:00
Will Rossiter
16231ce253 FIX: Falling back to summaryFields() should skip non database fields. 2013-05-08 23:05:05 +12:00
Ingo Schommer
c01511eaa3 Merge pull request #1854 from wilr/image-derp
Deprecate Image::loadUploadedImage(), Use Upload::load()
2013-05-08 03:01:41 -07:00
Will Rossiter
b2937decfc Deprecate Image::loadUploadedImage(), Use Upload::load() 2013-05-08 21:49:38 +12:00
Ingo Schommer
65fd1a7ff4 Merge pull request #1833 from oddnoc/1687-dataobject-forcewrite
FIX: Enable $forceWrite argument of DataObject#write()
2013-05-08 01:38:16 -07: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
Fred Condo
ea7b94206d FIX: Enable $forceWrite argument of DataObject#write()
$forceWrite was being ignored because it was tested in a part of the
code that is reachable if and only if there are changes to the object.
This patch adds an additional test to correct that logic error.

Also, refrain from needlessly checking for changes when $forceWrite is
true.

Fixes #1687
2013-05-03 16:29:33 -07:00
Ingo Schommer
6c2e791a48 Merge remote-tracking branch 'origin/3.1' 2013-04-29 08:59:06 +02:00
Nico Haase
5fbb3da661 Enhanced tests for regeneration of images and a bugfix for images that were cached in multiple steps 2013-04-24 10:27:20 +02:00
Sam Minnee
eb583c5f14 NEW: Added DataObject::getQueriedDatabaseFields() as faster alternative to toMap()
API: CompositeDBField::setValue() may be passed an object as its second argument, in addition to array.

These changes provide a 15% - 20% performance improvement, and as such justify an small API change in the 3.0 branch. It will likely affect anyone who has created their own composite fields, which is fortunately not all that common.
2013-04-21 13:39:11 +12:00
Simon Welsh
93a8e6f16e Merge pull request #1773 from silverstripe-rebelalliance/fix/htmlvalue_attr_escaping
FIX We still need XML escaping on href attributes in HTML4Value
2013-04-17 15:05:33 -07:00
Hamish Friedlander
8d26bdbd2e FIX We still need XML escaping on href attributes in HTML4Value 2013-04-18 09:13:24 +12:00
Will Rossiter
e366fabd55 Remove duplicate functionality between float and double 2013-04-17 17:35:59 +12:00
Ingo Schommer
9eab893e7c Merge remote-tracking branch 'origin/3.1'
Conflicts:
	model/Image.php
2013-04-12 01:14:55 +02:00
Ingo Schommer
59dc0085d8 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	docs/en/reference/urlvariabletools.md
	tests/forms/CheckboxFieldTest.php
2013-04-12 01:13:32 +02:00
Ingo Schommer
933fbf8ea4 l10n key to make "yes" and "no" translatable (see #1749) 2013-04-12 01:11:24 +02:00
g4b0
c8e8b5147d API: used call_user_func_array in order to have an arbitrary number of parameter for getFormattedImage (fixes #1752) 2013-04-11 16:51:36 +02:00
Ingo Schommer
0343a77d30 Merge remote-tracking branch 'origin/3.1' 2013-04-11 11:42:04 +02:00
Ingo Schommer
9856fcef21 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	javascript/DateField.js
	model/DataQuery.php
	model/Versioned.php
	tests/forms/RequirementsTest.php
	tests/model/DataObjectLazyLoadingTest.php
	view/Requirements.php
2013-04-09 14:45:35 +02:00
Ingo Schommer
e26090a840 Avoid double encoding Date->Formati18n()
See https://github.com/silverstripe/sapphire/pull/1314
Thanks to @ivoba
2013-04-09 11:04:45 +02:00
Sam Minnée
a6929f11b2 Merge pull request #1185 from chillu/pulls/augment-lazy-versioned
Versioned lazy loading fixes (backport from 3.1)
2013-04-08 16:04:50 -07:00
Ingo Schommer
01f46d039f NEW Enforce max node counts to avoid excessive resource usage
Rendering potentially 1000s of nodes can exceed the CPU and memory constraints
of a normal PHP process, as well as the rendering capabilities of browsers.
Set a hard maximum for the renderable nodes, deferring to a "show as list" action
in the main CMS tree. For TreeDropdownField, we don't have the list fallback option,
so ask the user to search for the node title instead.

Also makes both the "node_threshold_total" and "node_threshold_leaf" values configurable
2013-04-09 10:24:18 +12:00
Sam Minnée
88d77db9e0 Merge pull request #1318 from tractorcow/3.1-api-image-resampling-compatible
API Better detection and prevention of image resampling
2013-04-08 15:18:55 -07:00
Ingo Schommer
f296439a24 NEW Hints for scaffolded date/time fields 2013-04-08 19:38:50 +12:00
Nico Haase
8908a6bcd7 This is a fixed version for RegenerateCachedImagesTask (former FlushGeneratedImagesTask) such that it regenerates images instead of silently removing them and breaking existing pages
The pull request also contains some enhancements and fixes to the corresponding testcases.

Fixes #318
2013-04-06 15:56:27 +02:00
Ingo Schommer
700453b7dc Merge pull request #1731 from wilr/open5551
FIX: Decimal field change detection.
2013-04-06 04:32:27 -07:00
Ingo Schommer
e2b42ca4c2 Fixed Versioned hook regression
Introduced by 5238e9cf48
2013-04-06 12:24:57 +02:00
Will Rossiter
e619329dc3 FIX: Decimal field change detection. 2013-04-06 23:20:28 +13:00
Will Rossiter
5238e9cf48 API: add onBeforeRollback() and onAfterRollback() hooks. 2013-04-06 22:59:33 +13:00
Will Rossiter
ddb017a6ff API: Move LimitWordCount() to Varchar 2013-04-05 21:58:03 +13:00
Sean Harvey
65cb182c98 BUG Don't sort when deleting records in ManyManyList::removeAll()
This breaks databases like MSSQL which don't allow an ORDER BY with
a subquery at the same time. DELETE queries don't need to be ordered,
so we can safely remove the default.
2013-04-05 11:50:25 +13:00
Ingo Schommer
6d5925708e FIX Empty fields on SQLQuery->aggregate() with alias
Breaks Postgres otherwise, because it produces a
"SELECT *, <field> ... " statement without putting all
fields into the GROUP BY.
2013-04-03 12:22:12 +02:00
Ingo Schommer
5a8a067ae8 FIX Consistently quote orderby in DataQuery->ensureSelectContainsOrderbyColumns()
Otherwise aggregate queries through DataQuery->column() fail unless the
passed in field is specifically quoted already. This fixes ManyManyListTest->testRemoveAll()
2013-04-03 12:11:53 +02:00
Ingo Schommer
fb5ef0293e Clearer docs on where SQL strings are expected to be escaped already
Also quoted some phpdoc examples, to avoid them failing by default on
stricter DB drivers like Postgres
2013-04-03 12:11:53 +02:00
Ingo Schommer
ff3b63f2a9 FIX Remove unnecessary DISTINCT from ManyManyList->removeAll()
Breaks Postgres if the innermost query has an ORDER BY statement as well
2013-04-03 12:11:50 +02:00
Joseph Madden
df4d7428fa FIX Saving of custom meta tags (fixes #8288)
This should allow custom meta tags to be saved in the admin panel.

Also, if you use html5 video or audio the source sub tag
would have been stripped two these are all the tags that may be empty
and are valid.
2013-04-02 12:02:56 +02:00
Ingo Schommer
f0d92f7bcc Merge pull request #1094 from silverstripe-big-o/pulls/3.1-versioned-relfield
BUGFIX Versioned_Version->relField()
2013-04-02 02:49:27 -07:00
Ingo Schommer
ef3d974821 Merge remote-tracking branch 'origin/3.1'
Conflicts:
	docs/en/misc/contributing/issues.md
2013-04-02 02:05:58 +02:00
Andrew Short
5ec85d06f6 API: Don't allow dots in URL segments 2013-03-30 19:47:17 +11:00
Ingo Schommer
afb8465d05 Merge remote-tracking branch 'origin/3.1'
Conflicts:
	.travis.yml
2013-03-29 17:37:19 +01:00
Ingo Schommer
373da53826 Removed unused DataExtension::$extendable_statics
Oversight from cleanup in 876f4c5
2013-03-27 16:09:17 +01:00
Ingo Schommer
538bf01860 Merge remote-tracking branch 'origin/3.1' 2013-03-27 12:12:16 +01:00
Ingo Schommer
b0d3f7f3a2 Merge remote-tracking branch 'origin/3.1'
Conflicts:
	api/RSSFeed.php
	dev/SapphireTest.php
	tests/control/RequestHandlingTest.php
2013-03-26 10:46:41 +01:00
Ingo Schommer
880702fc74 Fixed static config access in Currency and i18n (fixes #8341) 2013-03-26 10:13:51 +01:00
Simon Welsh
f175d0bf66 Merge pull request #1275 from Zauberfisch/hierarchy
API: Hierarchy class cleanup
2013-03-25 13:03:04 -07:00
Zauberfisch
215628a1ea API: re factored Hierarchy class to use new ::get() syntax
API: removed broken & unused method Hierarchy->partialTreeAsUL()
2013-03-25 19:55:19 +00: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
Damian Mooyman
dd6aaaf484 ENHANCEMENT Additional image generation functions now self-determine if a modification to the underlying image backend is necessary before generating additional image files. 2013-03-21 12:15:28 +13:00
Ingo Schommer
61dbafc4e5 Merge pull request #1292 from tractorcow/3.1-validationexception-fixes
BUG Issue with ValidationException having blank ValidationResult
2013-03-20 03:55:42 -07:00
Ingo Schommer
4f95a07936 Removed deprecated NegationFilter tests, rewrote ExactMatchMultiFilter tests 2013-03-19 12:58:14 +01:00
Andrew Short
94f209eb74 Merge branch '3.1' 2013-03-19 22:36:47 +11:00
Andrew Short
b8a51c3792 Merge branch '3.0' into 3.1 2013-03-19 22:27:09 +11:00
Ingo Schommer
dd6f33ab37 FIX Respect tree node limits, fix search result node display
- Renamed $minNodeCount to more accurate $nodeCountThreshold
- The $minNodeCount attribute wasn't properly respected
during actual querying, so SilverStripe would always traverse
the entire tree (and load all objects into memory),
before then marking nodes as "unexpanded", which prevents
them from actually being rendered.
- Fixes nodes on search results to be expanded by default
- Fixes nodes on search results to correctly ajax-expand
2013-03-19 00:05:14 +01:00
Simon Welsh
5087b25a65 Allow setting the MySQL database port 2013-03-19 10:50:20 +13:00
Andrew Short
bc941c18b6 Merge branch '3.1' 2013-03-15 21:58:37 +11:00
Damian Mooyman
cd27bf71fb BUG Enforced requirement that ValidationException::getResult() is expected to consistently produce a valid ValidationResult object. 2013-03-15 13:56:43 +13:00
Hamish Friedlander
743a186c32 API Make SSViewer#process return HTMLText not string
This means that you dont have to worry about casting it
as HTMLText again when using the result in a template or other context

However in some situations code might be assuming it can
check with is_string, in which case you now need to use instanceof HTMLText
2013-03-14 12:49:03 +13:00
Hamish Friedlander
cd41a536b9 NEW Let shortcodes be disabled in HTMLText & HTMLVarchar 2013-03-14 12:49:03 +13:00
Hamish Friedlander
53128c5d2f Make ShortcodeParser use HTMLValue for HTML parsing 2013-03-14 12:49:03 +13:00
Hamish Friedlander
168f071499 API Make HTMLValue replace-able via DI
Extracted common code out to SS_HTMLValue and made abstract, then
put HTML 4 specific code in SS_HTML4Value. Its now possible to
replace HTMLValue with one designed for HTML 5 or XHTML

Requires a code change from new SS_HTMLValue to
Injector::inst()->create(HTMLValue)
2013-03-14 12:49:02 +13:00
Robert Curry
b9dc2dc650 Define getIDList on UnsavedRelationList
This is to fix a bug that caused CheckboxSetFields to throw an error
when trying to call this function when editing a new DataObject. This
occurred when using the advancedworkflow module.

Thanks to simonwelsh for the majority of the work on this fix.
2013-03-08 12:34:52 +13:00
Ingo Schommer
d57caa6477 Merge pull request #1247 from ajshort/mml-remove-filtered
BUG: Fix ManyManyList->removeAll() when filters are applied to the query
2013-03-04 00:55:45 -08:00
ajshort
b537ee28a2 BUG: Fix ManyManyList->removeAll() when filters are applied to the query
In order to be cross-database compatible and support filters, the IDs to
delete must be retrieved in a sub-query.
2013-03-02 17:23:15 +11:00
g4b0
4bd235be8b Removed code "ad personam" 2013-02-28 16:50:53 +01:00
Ingo Schommer
ce66bc1eaf Merge remote-tracking branch 'origin/3.1'
Conflicts:
	tests/travis/before_script
2013-02-27 13:34:03 +01:00
Ingo Schommer
bea1b9002d Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	control/HTTP.php
2013-02-26 13:28:35 +01:00
Ingo Schommer
0c6ac1960e Fixed whitespace usage 2013-02-18 15:43:52 +01:00
Ingo Schommer
92458d9f43 Fixed line lengths 2013-02-18 14:41:49 +01:00
Ingo Schommer
af96432c1e Merge remote-tracking branch 'origin/3.1'
Conflicts:
	api/RSSFeed.php
2013-02-18 14:18:54 +01:00
Hamish Friedlander
f4f2862188 Fix up /dev/build which should really have ever worked, but used to 2013-02-18 15:08:15 +13:00
Julian Seidenberg
10199f908a API Data corruption on Versioned due to lazy loading
Lazy loading no longer loads fields from the versions table when querying. This could lead to incorrect data being displayed if the data on the object and the version it pointed to did not match.

API methods to allow setting of the context of the query that generated the DataObject on that object (used by the lazy loading mechanism to correctly query the Stage, Live, or Versions tables)

See https://github.com/silverstripe/sapphire/pull/1178 for context.
2013-02-14 14:28:42 +01:00
jean
e2bf9649f3 FIX 7934 When lazy loading fields respect version of the record 2013-02-14 14:27:44 +01:00
Julian Seidenberg
f931b8d326 API Data corruption on Versioned due to lazy loading
Lazy loading no longer loads fields from the versions table when querying. This could lead to incorrect data being displayed if the data on the object and the version it pointed to did not match.

API methods to allow setting of the context of the query that generated the DataObject on that object (used by the lazy loading mechanism to correctly query the Stage, Live, or Versions tables)

See https://github.com/silverstripe/sapphire/pull/1178 for context.
2013-02-14 14:18:10 +01:00
Zauberfisch
54237d5b10 NEW Return $this on setters in DataObject 2013-02-13 18:18:37 +01:00
Ingo Schommer
14a56c18e9 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	control/Director.php
2013-02-07 21:45:16 +01:00
Ingo Schommer
a1beda14d1 Removed explicit pass-by-ref in DataExtension->validate()
Same fix as be97535b for 3.1. Makes the method signature
more consistent with other DataExtension methods,
and comply with its subclass implementation in
Hierarchy->validate(). See accbd7f1e2 for more comments.
2013-02-06 19:00:23 +01:00
Ingo Schommer
d289016bc3 DataObject on*() callbacks now consistently invoke on subclasses as well
Before this was only possible for some specific ones, like onBeforeWrite.
This excludes any callbacks with augment*() or update*() naming,
since these are assumed to be on extension only, with a corresponding
base method available on the class itself (e.g. "updateCMSFields()"
vs "getCMSFields()").
2013-02-05 23:28:09 +01:00
Daniel Hensby
f0621cdd91 FEATURE: Added ability to query size of Varchar
This allows a developer to programatically access the size of the DB Varchar field. This allows us to be a bit more DRY and to define the size in one place and limit TextFields to the same value
2013-02-05 18:41:11 +00:00
Ingo Schommer
accbd7f1e2 Revert "FIX: Strict error warnings on DataExtension"
This reverts commit 1960df8bc3.

Revert "FIX: validate doesn't take var by reference"
This reverts commit 866bb0713b.

@ajshort has changed the method signatures in 1f6f7f08. While it wasn't explicitly noted in the commit message, I think its a good change - objects like a FieldList are always passed by reference in PHP, no need to declare that behaviour.
2013-02-04 17:23:11 +01:00
Michael Andrewartha
866bb0713b FIX: validate doesn't take var by reference
Got a bit carried away, validate doesn't take the var by reference
2013-02-04 12:42:39 +00:00
Michael Andrewartha
1960df8bc3 FIX: Strict error warnings on DataExtension
PHP is throwing strict error warnings when overriding the
updateCMSFields and other functions in custom DataExtensions due to
the fact that the abstract class doesn't declare the variables should
be passed by reference
2013-02-04 12:37:53 +00:00
ajshort
fd71a3d55e Consistently exposed ManyManyList information through getters. 2013-01-31 15:21:46 +01:00
Ingo Schommer
634c91c6ff Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	email/Mailer.php
2013-01-30 12:46:24 +01:00
Sam Minnee
c4dde9022d NEW: Allow hashes to be passed as ArrayList items; the will be turned into ArrayData objects. 2013-01-29 18:03:49 +01:00
Sam Minnee
1e1df8c43e BUGFIX: Improved detection of empty HTMLText fields. 2013-01-29 18:03:47 +01:00
Mateusz Uzdowski
7026a488e6 BUGFIX: for date manipulation use the SS_Datetime::now, otherwise it does not respect the mock date. 2013-01-29 17:23:23 +01:00
Simon Welsh
3439e30ac1 Corrects indentation and line length 2013-01-24 19:56:02 +13:00
Kirk Mayo
e1e64839e2 BUG: Replaced extendedSQL/buildSQL with DataList as per ticket 8183
BUG: Correcting the4 case of a function

Corrcting the case of a function

BUG: replaced deprecated extendedSQL call with DataList->where
2013-01-24 10:36:16 +13:00
Nicolaas
3ae9ba10b3 MINOR: typo in DataList
small change in DataList::filterByCallback.  new ArrayList; changed to new ArrayList(); and added @return as this is particular important for this method (unexpected return type).
2013-01-23 08:36:35 +13:00
Ingo Schommer
c11b3918fc Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	admin/css/screen.css
	admin/scss/_style.scss
	core/PaginatedList.php
	email/Mailer.php
2013-01-21 11:14:57 +01:00
Ingo Schommer
f7cd316d1f BUGFIX Versioned_Version->relField() so fields can be used in GridField etc
Copied from DataObject, since we can't use the $fallback opion in this case
(will try to retrieve from wrong class)
2013-01-14 17:01:44 +01:00
Ingo Schommer
3a1df46743 Merge pull request #1055 from stojg/bug-relField
BUG Calling DataObject::relField() on a object with an empty relation list
2013-01-11 07:09:55 -08:00
Ingo Schommer
4f39af1a85 Merge pull request #1090 from sminnee/fix-get-one-case
FIX: Fix DataObject::get_one() when the classname is passed with imprope...
2013-01-11 01:42:29 -08:00
Ingo Schommer
f3c0669fec Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	_config/uploadfield.yml
	css/UploadField.css
	forms/UploadField.php
	scss/UploadField.scss
	templates/UploadField.ss
	tests/forms/uploadfield/UploadFieldTest.php
2013-01-11 10:02:39 +01:00
Sam Minnee
f4efaeefa7 FIX: Fix DataObject::get_one() when the classname is passed with improper casing. 2013-01-11 12:20:57 +13:00
Ingo Schommer
f922321287 ManyManyList->getExtraFields()
Needed for introspection for many_many relationships
without knowing the name of the relationship,
meaning we can't use DataObject->many_many_extraFields().
2013-01-10 22:35:20 +01:00
Ingo Schommer
f07ad307e4 API Removed non-functional $join argument from DataObject::get() and other APIs
See 68bb74820
2013-01-09 18:28:55 +01:00
Ingo Schommer
79997477b3 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	model/DataList.php
2013-01-08 17:16:09 +01:00
Sean Harvey
baaa270ceb Merge pull request #1032 from halkyon/datalist_filter_docs
Improve class naming and docs for DataList::applyFilterContext()
2013-01-06 17:23:43 -08:00
g4b0
e53280c650 BUG SQLQuery::aggregate() with limit, groupBy and orderBy (fixes #8148) 2012-12-21 15:20:59 +01:00
Ingo Schommer
8ec3641e60 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	admin/javascript/LeftAndMain.FieldHelp.js
	lang/en.yml
	model/URLSegmentFilter.php
2012-12-21 15:04:17 +01:00
Sean Harvey
aa3b358469 Adding test for SortColumn to SQLQueryTest
Mostly for the benefit of MSSQLDatabase which is having problems
with subselects and alias functions.
2012-12-20 15:52:46 +13:00
Ingo Schommer
e4cb25b831 Merge pull request #1058 from chillu/pulls/remove-testsession
API Remove dev/tests/startsession etc, use new "testsession" module
2012-12-19 11:42:56 -08:00
Ingo Schommer
86940aa684 Made hyphen escaping clearer in FileNameFilter and URLSegmentFilter
Does not actually change behaviour, but ensures that the hyphen
is not interpreted as a range identifier should it be placed
between two characters which PCRE regards as "rangeable".
2012-12-19 17:30:28 +01:00
Ingo Schommer
2e1a5081fa API Remove dev/tests/startsession etc, use new "testsession" module
Removed commands: startsession, endsession, sessionloadyml, setdb, emptydb.
See https://github.com/silverstripe-labs/silverstripe-testsession
2012-12-19 16:05:37 +01:00
Stig Lindqvist
22efd3848e BUG Calling DataObject::relField() on a object with an empty relation list
This causes a 'Fatal error: Call to a member function hasMethod() on a non-object'.

This can happen when displaying a field in a gridfield on a belongs_to relationship.
2012-12-19 16:47:07 +13:00
Mateusz Uzdowski
d5a1c3d99a BUG SS has problems handling + in URLs. Filter them out.
+ has a special meaning in the URLs so overall it's a good idea to
strip them out. Otherwise they would need to appear in their ugly url
encoded form "%2B".

Refer: http://open.silverstripe.org/ticket/7929
2012-12-18 09:44:47 +01:00
Damian Mooyman
b01b91ffc3 BUG When selecting stage_unique from Versioned the augmentSQL function would permanantly alter the DataQuery while doing a recursive augmentSQL. This fix correctly maintains the correct Versioned.mode so that subsequent calls to this function exhibit the same expected behaviour. 2012-12-18 10:11:30 +13: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
Ingo Schommer
d13c53fda6 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	tests/model/DataQueryTest.php
2012-12-14 10:57:28 +01:00
Hamish Friedlander
bd59f842f0 FIX Make sure you can only remove items from a DataList that are actually in it 2012-12-14 13:30:36 +13:00
Hamish Friedlander
9979b11b59 FIX Make sure ArrayList#limit uses clone so for subclasses it returns instances of same subclass 2012-12-14 13:30:35 +13:00
Hamish Friedlander
27113f82c3 API Make DataList and ArrayList immutable
In 3.0 there was some confusion about whether DataLists and ArrayLists
were mutable or not. If DataLists were immutable, they'd return the result, and your code
would look like

  $list = $list->filter(....);

If DataLists were mutable, they'd operate on themselves, returning nothing, and your code
would look like

 $list->filter(....);

This makes all DataLists and ArrayList immutable for all _searching_ operations.
Operations on DataList that modify the underlying SQL data store remain mutating.

- These functions no longer mutate the existing object, and if you do not capture the value
returned by them will have no effect:

  ArrayList#reverse
  ArrayList#sort
  ArrayList#filter
  ArrayList#exclude

  DataList#dataQuery (use DataList#alterDataQuery to modify dataQuery in a safe manner)
  DataList#where
  DataList#limit
  DataList#sort
  DataList#addFilter
  DataList#applyFilterContext
  DataList#innerJoin
  DataList#leftJoin
  DataList#find
  DataList#byIDs
  DataList#reverse

- DataList#setDataQueryParam has been added as syntactic sugar around the most common
cause of accessing the dataQuery directly - setting query parameters

- RelationList#setForeignID has been removed. Always use RelationList#forForeignID
when querying, and overload RelationList#foreignIDList when subclassing.

- Relatedly,the protected variable RelationList->foreignID has been removed, as the ID is
now stored on a query parameter. Use RelationList#getForeignID to read it.
2012-12-14 13:30:35 +13:00
Sean Harvey
c23df511cd Improve class naming and docs for DataList::applyFilterContext() 2012-12-14 12:06:25 +13:00
Ingo Schommer
c6b1d4aa6b API Storing alternative DB name in cookie rather than session
Session is not initialized by the time we need to use
the setting in DB::connect(). Cookie values get initialized
automatically for each request.

Tightened name format validation to ensure it can only
be used for temporary databases, rather than switching
the browser session to a different production database.

Encrypting token for secure cookie usage.
Added dev/generatesecuretoken to generate this token.
Not storing in YML config directly because of web access issues.
2012-12-13 23:21:48 +01:00
Ingo Schommer
7e4629073a NEW Date->Ago() with "less than a minute" support 2012-12-13 19:01:27 +01:00
Ingo Schommer
2e9b5e9221 Merge branch 'orm-join-bug' of git://github.com/stojg/sapphire into stojg-orm-join-bug 2012-12-12 15:53:19 +01:00
Simon Welsh
b0121b541c Add codesniffer that ensures indentation is with tabs. 2012-12-12 17:33:31 +13:00
Simon Welsh
fc5dd2994c Add codesniffer that ensures indentation is with tabs. 2012-12-12 00:12:11 +13:00
Ingo Schommer
e6e47cb35e API DB-specific comparisators in SearchFilter and DataList
Too many edge cases to leave this up to datalists,
particularly now that we introduced enforced
case sensitivity/insensitivity in the ORM APIs.
2012-12-11 12:04:48 +01:00
Andrew O'Neil
9d74c99e08 BUGFIX: ArrayList now discards keys of the array passed in and keeps the numerically indexed array sequential.
This fixes FirstLast and EvenOdd in templates, and makes ArrayList more consistent, as several methods already discarded the keys.
2012-12-11 10:12:00 +01:00
stojg
efa9ff9b08 API: Queries added by DataList::addInnerJoin() and DataList::leftJoin() come after the base joins, not before.
This bug will surface when using the ORM and adding an join to DataList
where a DataObject inherits another DataObject.

If you for example want to restrict the number of pages that only have a
related Staff object:

    $list = DataList::create('Page')
		->InnerJoin('Staff', '"Staff"."ID" = "Page"."StaffID");

This will create a SQL query where the INNER JOIN is before the
LEFT JOIN of Page and SiteTree in the resulting SQL string. In MySQL
and PostgreSQL this will create an invalid query.

This patch solves the problem by sorting the joins.
2012-12-11 11:04:29 +13:00
Ingo Schommer
fa84c2d705 Merge remote-tracking branch 'origin/3.0' 2012-12-10 17:50:43 +01:00
Simon Elvery
205ee42110 BUGFIX Make sure a message is set on ValidationException objects. 2012-12-05 12:18:36 +10:00
Ingo Schommer
a108f67476 Merge pull request #922 from simonwelsh/rellist-presave
NEW: Allows setting of has_many and many_many relations before writing
2012-12-04 01:25:15 -08:00
Ingo Schommer
fa2057bcd9 Merge remote-tracking branch 'origin/3.0'
Conflicts:
	search/FulltextSearchable.php
2012-11-30 14:25:06 +01:00
Ingo Schommer
3f67404a8a Revert "BUGFIX: ArrayList now discards keys of the array passed in and keeps the numerically indexed array sequential."
This reverts commit b6017a7c90.
It breaks SelectionGroup, and its most prominent usage,
the "add page" dialog.
2012-11-30 14:24:03 +01:00
João Martins
cc3e500f82 return $this, for do things like this: new DropdownField('XPTOName', 'XPTO Label', XPTOModel::get()->map("ID", "Name")->unshift(0,'- Select -'))
This does not break anything and makes things more natural
2012-11-30 01:37:36 +00:00
Simon Welsh
bbc4443af7 NEW: Allows setting of has_many and many_many relations before writing
Adds a new wrapper list, UnsavedRelationList, that maintains the relations until
writing, where it is converted into the correct RelationList.
2012-11-28 09:37:08 +13:00
jean
fbfff8df28 FIX 7934 When lazy loading fields respect version of the record 2012-11-27 17:31:45 +01:00
Ingo Schommer
15a687f1e7 Merge remote-tracking branch 'origin/3.0' 2012-11-23 15:31:08 +01:00
Ingo Schommer
aa72425e84 Fixed PHPUnit assertions for incomplete tests in core
Avoid PHPUnit throwing "test didn't run any assertions"
notices in PHP. If nothing else, it keeps test output
looking less broken by default, making it more likely
that actual errors do get noticed.
2012-11-23 15:16:39 +01:00
Ingo Schommer
c55c7c33f8 Merge branch '3.0'
Conflicts:
	admin/code/CMSProfileController.php
	composer.json
	tests/model/DataObjectTest.php
2012-11-22 23:51:28 +01:00
Sean Harvey
477cf6b793 Removing redundant DatabaseAdmin::testinstall()
The original intention of this method was to be a rewrite
check by the installer, but it doesn't belong in
DatabaseAdmin, nor is it used by the installer anymore,
since the rewrite test is done by the installer directly.
2012-11-22 17:07:28 +13:00
Sean Harvey
8168a7db09 Remove deprecated DBField::create(), use create_field() instead 2012-11-16 14:36:26 +13:00
Sean Harvey
b3d5b68019 Remove deprecated SQLQuery::setWhere() multiple arguments 2012-11-16 14:35:30 +13:00
Sean Harvey
a2bd378d46 Remove deprecated ArrayList::getRange(), use limit() instead 2012-11-16 14:35:05 +13:00
Damian Mooyman
76c63fe4a4 BUG Fixed issue with SQLQuery::lastRow crashing on empty set. Added test cases for lastRow and firstRow.
Quoted table / column names to make test cases work in postgres

BUG Fixed issue with SQLQuery::lastRow crashing on empty set. Added test cases for lastRow and firstRow.

Quoted table / column names to make test cases work in postgres

Merge branch '3.0-sqlquery-lastrow-fix' of github.com:tractorcow/sapphire into 3.0-sqlquery-lastrow-fix
2012-11-16 13:27:51 +13:00
Andrew O'Neil
b6017a7c90 BUGFIX: ArrayList now discards keys of the array passed in and keeps the numerically indexed array sequential.
This fixes FirstLast and EvenOdd in templates, and makes ArrayList more consistent, as several methods already discarded the keys.
2012-11-16 09:39:01 +13:00
Sean Harvey
e1c5f084ad Removing deprecated container class argument to DataObject::get() 2012-11-15 14:43:20 +13:00
Sean Harvey
3a198c32d5 Removing deprecated DataObject::databaseFields() and customDatabaseFields()
Use database_fields() and custom_database_fields() instead
2012-11-15 14:43:19 +13:00
Sean Harvey
e4088feb46 Removing deprecated instance_get_one() and instance_get()
Use DataList API instead
2012-11-15 14:43:19 +13:00
Sean Harvey
a8d779b4de Removing deprecated DataObject::buildDataObjectSet()
Use DataList API instead
2012-11-15 14:43:19 +13:00
Sean Harvey
dde820d87d Extend deprecation of DataObject::Aggregate() and RelationshipAggregate() 2012-11-15 14:43:19 +13:00
Sean Harvey
0db33f7f04 Removing DataObject::buildSQL() and extendedSQL(), use DataList instead 2012-11-15 14:43:19 +13:00
Sean Harvey
651d4b3d41 Removing DataObject::getAllFields(), use toMap() instead 2012-11-15 14:43:18 +13:00
Sean Harvey
5f852ae7bc Removing deprecated DataObject::setComponent()
This is not used internally any longer
2012-11-15 14:43:18 +13:00
Sean Harvey
3108dea2c2 Removing deprecated DataList::limit() arguments
Use 2 arguments, the first being limit and the second offset instead.
2012-11-15 14:43:18 +13:00
Sean Harvey
68bb74820a Removing join() on DataList/DataQuery
Use leftJoin() or innerJoin() instead
2012-11-15 14:43:18 +13:00
Sean Harvey
5c983a25f0 emove deprecated StringField::Lower() and Upper() methods
Use LowerCase() and UpperCase() instead
2012-11-15 14:43:16 +13:00
Sean Harvey
9e7bdb3e93 Removing deprecated Text::EscapeXML(), use DBField->XML() instead 2012-11-15 14:43:16 +13:00
Sean Harvey
4c3b804fa5 Remove deprecated ComponentSet, use ManyManyList or HasManyList instead 2012-11-15 14:43:12 +13:00
Sean Harvey
0a046af932 Remove deprecated DataObjectDecorator, use DataExtension instead 2012-11-15 14:43:12 +13:00
Sean Harvey
a371db4300 Remove deprecated DataObjectSet, use DataList or ArrayList instead 2012-11-15 14:43:12 +13:00
Sean Harvey
f69c2b0495 Improve performance of DataObject::db() with caching
In a usual CMS request, DataObject::db() is called potentially
thousands of times, calling Config::get() constantly for the same
uninherited statics, which is slow. This improves performance
by caching those into DataObject::$_cache_db
2012-11-08 10:38:16 +13:00
Sean Harvey
fdcd7a2e60 Fixing performance of DataObject::custom_database_fields()
On sites with lots of modules, and pages with plenty of database
queries, DataObject::custom_database_fields() can be called
thousands of times, and slow down page render times. This fixes
it so the fields are cached by class in a static variable, and
are cleared when reset() is called on the DataObject.
2012-11-07 17:23:36 +13:00
Justin Martin
d24b586830 NEW: Enable multiple image manipulation back-ends on the Image class 2012-11-03 19:38:09 -07:00
Simon Welsh
d8c920285c Merge pull request #917 from TheFrozenFire/feature-DataObjectFromStdClass
API: DataObject::__construct() now accepts stdClass for $record
2012-11-03 02:16:07 -07:00
Simon Welsh
123a742872 Merge pull request #920 from TheFrozenFire/feature-SSListEach
API: Add new method "each" to SS_List
2012-11-03 02:10:23 -07:00
Simon Welsh
5a793990d8 Merge pull request #921 from TheFrozenFire/bug-DataObjectCreated
BUG: DataObject::write overwrites Created on first write
2012-11-03 02:08:35 -07:00
Justin Martin
f2a709d849 BUG: DataObject::write overwrites Created on first write 2012-11-02 20:37:17 -07:00
Justin Martin
26e5afc0c4 NEW: Add new method "each" to SS_List and core implementors thereof 2012-11-02 18:21:02 -07:00
Simon Welsh
8a0f234acf Merge pull request #870 from chillu/pulls/datalist-filterany
NEW DataList->filterAny()
2012-11-02 16:17:48 -07:00
Justin Martin
a651d730f2 BUG: DataObject::__construct() now accepts stdClass for $record 2012-11-01 16:57:07 -07:00
Ingo Schommer
efabde1416 Merge remote-tracking branch 'origin/3.0'
Conflicts:
	admin/css/screen.css
	admin/scss/_style.scss
	security/Member.php
2012-10-30 17:52:49 +01:00
Sean Harvey
ac489509be BUG Fixing "+" characters being replaced with whitespace
SS_HTMLValue::getContent() uses urldecode() on the content returned
by saveHTML() -- this was done to fix encoded HTML entities like
square brackets, which are used by shortcodes. Unfortunately, this
also removes valid characters like "+" from the content.

This fixes it so square bracket entities are decoded *only*, and
leaves everything else as-is.
2012-10-24 14:44:14 +13:00
Simon Welsh
bedb579b07 Merge branch '3.0' 2012-10-23 15:21:20 +13:00
icecaster
8a7f9ede97 fixed empty string always on scaffolded enum fields 2012-10-17 12:30:05 +13:00
Mateusz Uzdowski
8eb0fa91bd API Add the ability to query if the schema update is in progress.
The specific situation where this is useful is where populateDefaults on
DataObjects needs to query the database. This will break the dev/build
when it tries to create the object via singleton - the query will not be
able to be executed if the table is not there or its schema has changed.

For an example of such use case see Translatable::populateDefaults.
2012-10-17 11:45:21 +13:00
Ingo Schommer
1181ba089a Merge remote-tracking branch 'origin/3.0'
Conflicts:
	.travis.yml
2012-10-16 10:26:04 +02:00
Will Rossiter
9eb4af37bf Merge pull request #878 from chillu/pulls/alternative-db-session
BUG Using Session::set() for DB::set_alternative_database_name()
2012-10-15 22:34:05 -07:00
Sean Harvey
a171c7e4b0 BUG Fixing regression in 26d70d6fca with formatted output in SS_HTMLValue
If formatOutput is set to TRUE, then the regexes in getContent()
will not match the newlines, and the output will include html, body
and meta tags. Introduce a few new tests to ensure the output is
correct, and fix the regex.
2012-10-16 11:59:30 +13:00
Ingo Schommer
35da873ad9 BUG Using Session::set() for DB::set_alternative_database_name()
Setting session directly through $_SESSION relies on
session_autostart which might not be set on every environment,
and isn't consistent with other framework use.
2012-10-15 20:40:38 +02:00
Sean Harvey
f6a90467e4 Merge branch '3.0' 2012-10-15 10:10:01 +13:00
Ingo Schommer
5be3a4c35a NEW DataList->filterAny() 2012-10-12 15:24:25 +02:00
Sean Harvey
bc345803d5 BUG Fixing model not being set before populateDefaults()
In cases where a getter on a DataObject calls getComponent() or
other relational getter, $this->model won't have been set at
this point, and a fatal error is triggered.

This fixes it so $this->model is set *before* populateDefaults()
in DataObject::__construct() and the getters can operate normally.
2012-10-12 09:57:11 +13:00
Simon Welsh
c49f7566c3 API Allow use of :not, :nocase and :case modifiers to SearchFilters.
More modifiers can be added to each class as desired.
2012-10-10 10:26:47 +13:00
Simon Welsh
2faf7d112d API Allow using SearchFilters in DataList::exclude() 2012-10-09 14:47:22 +13:00
Ingo Schommer
fb5e488103 Line length fixes 2012-10-03 18:11:31 +02:00
Ingo Schommer
56f7ce1dcf Merge remote-tracking branch 'origin/3.0'
Conflicts:
	control/Cookie.php
	control/Director.php
	control/HTTPResponse.php
	model/Database.php
	model/MySQLDatabase.php
	model/SQLQuery.php
	view/Requirements.php
	view/SSViewer.php
2012-10-03 16:16:19 +02:00
Sam Minnee
323fd4aa0f FIX: Fixed ef81318aea for PostgreSQL by quoting fields. 2012-10-03 15:34:39 +13:00
Sam Minnee
4e1b6af10f Fixed long line. 2012-10-03 15:15:21 +13:00
Ingo Schommer
ef81318aea BUG Retaining join extraFields on ManyManyList->add() 2012-10-03 14:58:28 +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
Sean Harvey
e4ab02e1c3 Merge branch '3.0' 2012-09-27 10:39:31 +12:00
Sean Harvey
92e62ebb91 Merge pull request #812 from chillu/pull/sitetree-meta-removal
Removed SiteTree.MetaTitle and MetaKeywords usage
2012-09-24 21:15:20 -07:00
Sean Harvey
0b17e0036a BUG Fixing percent encoding issues with saveHTML 2012-09-23 22:28:42 +12:00
Ingo Schommer
5df519c6b5 Removed SiteTree.MetaTitle and MetaKeywords usage 2012-09-21 11:31:24 +02:00
Simon Welsh
6d696d506f API Allow subgroups in the WHERE clause of a Data/SQLQuery
Adds three extra methods to Data/SQLQuery query that allow for starting
a disjunctive subgroup, a conjunctive subgroup and for ending a subgroup.

Database::sqlWhereToString() now builds up the WHERE clause one by one
instead of with a straight implode. Uses a stack to know which conenctive
to use.
2012-09-21 14:59:47 +12:00
Simon Welsh
1e629f4585 Merge branch '3.0'
Conflicts:
	control/Cookie.php
	control/Director.php
	dev/Profiler.php
	view/Requirements.php
2012-09-21 14:56:56 +12:00
Ingo Schommer
e44a3558dd Merge pull request #793 from halkyon/htmlvalue_parsing_fixes
BUG HtmlEditorField doesn't save HTML fragments in HTMLValue correctly
2012-09-20 02:09:36 -07:00
Ingo Schommer
e2f073f38a Method visibility according to coding conventions 2012-09-20 10:46:59 +02:00
Sean Harvey
26d70d6fca BUG HtmlEditorField doesn't save HTML fragments in HTMLValue correctly
The issue was raised in #7628, where an anchor tag was being changed from
<a name="anchor"></a> to <a name="anchor"/> by SS_HTMLValue, when
HtmlEditorField::saveInto() parses the HTML fragments.

This is because SS_HTMLValue uses DOMDocument::saveXML(), which is fine
for saving an XML document, but not suitable for HTML. This fix changes
that to use DOMDocument::saveHTML() instead.
Note that we can't use the parameter to saveHTML() for selecting a single
node only, as that's only supported in PHP 5.3.6+, SilverStripe 3.0 supports
PHP 5.3.2 as a minimum. The workaround for this shortcoming is to replace
unncessary output by DOMDocument with a regular expression.
2012-09-19 11:39:01 +12:00
Sam Minnée
95dbad6195 Merge pull request #796 from stozze/3.0-bugfix
BUGFIX Fix to prevent unintended results from getComponentsQuery(...)
2012-09-17 18:26:44 -07:00
Sam Minnée
651f45e0e4 Merge pull request #782 from tractorcow/3.0-index-generation-fixes
FIXED: Generation of table indexes
2012-09-16 23:43:17 -07:00
Sean Harvey
9c2be0f025 Merge branch '3.0' 2012-09-17 15:16:52 +12:00
stozze
499b7c9ff9 BUGFIX Fix to prevent unintended results from getComponentsQuery(...)
Wrapped $filter inside parentheses to prevent unintended results if $filter contains "OR".
2012-09-14 18:31:37 +03:00
Ingo Schommer
b0fc1cb16a Merge branch '3.0.2' into 3.0 2012-09-12 11:05:50 +02:00
Hamish Friedlander
df5a9e087d FIX Cache ClassName enum so we dont query DB every call 2012-09-12 11:14:59 +12:00
Damian Mooyman
30e15d11a7 FIXED: Generation of tables with fulltext indexes now no longer incorrectly thinks that all fulltext indexes have changed.
ADDED: Test cases correctly checking for changes (and no changes) to the data model for both fields and indexes.
FIXED: References to indexes throughough the code that probably should have quoted field names. This prevents a lot of 'spam' during dev build. This includes an updated FulltextSearchable test case.
2012-09-11 12:53:08 +12:00
Ingo Schommer
1088d044c5 Merge remote-tracking branch 'origin/3.0'
Conflicts:
	.travis.yml
2012-09-07 17:21:41 +02:00
Simon Welsh
a6f3e9f9eb Corrects replacement method name in deprecation notice. 2012-09-04 15:25:53 +12:00
Ingo Schommer
fb6efb9d21 BUG Calling extraStatics() with args (regression from fa37c448) 2012-09-02 13:55:35 +02:00
Sam Minnée
57ad36e11d Merge pull request #750 from silverstripe-rebelalliance/open/5971
FIX If ClassName read from DB doesnt exist, dont break
2012-08-29 22:48:31 -07:00
Hamish Friedlander
2f00884e79 FIX If ClassName read from DB doesnt exist, dont break
We know the subclass of a record by its ClassName value, but code changes
might have meant that class no longer exists. We used to just break,
but this patch overrides the apparent value of ClassName to be
one that exists in that situation
2012-08-30 11:02:50 +12:00
Ingo Schommer
f070f971cf BUG Allow custom getters in summaryFields() (fixes #7788)
Regression from ca1d38dffd
2012-08-29 13:42:29 +02:00
Simon Welsh
78fdcc580b API DataList->leftJoin()/innerJoin() args no longer escaped
The table name in the join was being escaped, though table
names aren't escaped anywhere else. This breaks
namespaced classes, which rely on unescaped backslashes.
2012-08-29 11:54:42 +02:00
Hamish Friedlander
cc2e250719 NEW Allow querying if a field exists on a table 2012-08-29 15:08:48 +12:00
Ingo Schommer
a8f335360b Merge remote-tracking branch 'origin/3.0' 2012-08-27 09:25:59 +02:00
Sean Harvey
674b52b4f7 Merge pull request #734 from silverstripe-rebelalliance/trac/7799
API Reverse config extra statics control flow
2012-08-26 14:24:05 -07:00
Sam Minnee
f1c021ff22 Merge branch '3.0' 2012-08-23 12:56:17 +12:00
Sam Minnee
87685eefdd BUGFIX: Fix Versioned's stage_unique mode on PostgreSQL. 2012-08-23 12:56:06 +12:00
Sam Minnee
824afffd2e Merge branch '3.0' 2012-08-23 12:39:41 +12:00
Sam Minnee
ed0341e82f BUGFIX: Ensure that subtracting a sorted DataList works. 2012-08-23 12:38:54 +12:00
Sam Minnee
296ee1fa0f BUGFIX: Add double quotes to index columns for more reliable DB-schema management. 2012-08-23 12:38:44 +12:00
Sam Minnee
dd302a68a7 BUGFIX: Ensure that all_versions are sorted explicitly for better cross-db behaviour. 2012-08-23 12:38:37 +12:00
Hamish Friedlander
fa37c448a5 API Reverse config extra statics control flow
Config system used to provide an add_static_source method, which was intended for
use by Extensions to add statics. But extensions for a class arent initialised
until at least one instance of that class is created, so before that the
Config system didnt include values from extensions

This patch reverses the control flow, so that the Config system explictly asks
each Object for its additional config sources via the new method
get_extra_config_sources. This method returns an array that can contain
string names of classes and also raw associative arrays.

The developer visible change is that Extension#add_to_class has been
deprecated. Instead there is a new method, get_extra_config, which has
the same method signature but needs to guarantee that it doesnt
cause side effects. Additionally there is no need to call
parent::get_extra_config - this is handled automatically.
2012-08-23 09:29:13 +12:00
Sam Minnée
e0e96343cf Merge pull request #729 from silverstripe-rebelalliance/trac/7717
FIX Hierarchy#liveChildren couldnt handle lots of pages
2012-08-20 20:59:41 -07:00
Hamish Friedlander
d0bc9c6d23 FIX Hierarchy#liveChildren couldnt handle lots of pages
Hierarchy#liveChildren was generating a list of all IDs of all pages
on staging. When a site had lots of pages, this basically killed the
tree.

Fix by adding new versioned mode, stage_unique, which uses a
subselect to only return items from a stage that are in no
other stage.
2012-08-21 15:52:12 +12:00
Sam Minnee
f9b1485640 Merge branch '3.0' 2012-08-21 14:38:19 +12:00
Damian Mooyman
f7ffb79542 FIXED: Compatibility fixes for MS SQL Server. Replaced back ticks (which are mysql specific) with double quotes 2012-08-21 13:46:19 +12:00
Ingo Schommer
4cc82e906b Merge remote-tracking branch 'origin/3.0' 2012-08-20 10:13:55 +02:00
Sam Minnée
47b56d4ef8 Merge pull request #716 from tractorcow/3.0-versioned-fixes
FIXED: Crashed caused by viewing versioned page
2012-08-19 19:02:24 -07: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
Ingo Schommer
29b62adec2 Merge branch 'augmentSQL-on-wrong-class' of git://github.com/creamarketing/sapphire into creamarketing-augmentSQL-on-wrong-class 2012-08-16 23:47:48 +02:00
Ingo Schommer
ea0554a466 Merge pull request #666 from silverstripe-droptables/versioned-param-order
BUG Correct wrong parameter order.
2012-08-16 14:03:16 -07:00
Ingo Schommer
4598cc02aa Merge pull request #659 from ajshort/instance-search-filters
BUG: Allow using instances for search filters.
2012-08-16 13:07:35 -07:00
Damian Mooyman
c55b018feb FIXED: Issue where versioned would join _versions tables on ID,Version instead of RecordID,Version 2012-08-10 13:54:29 +12:00
Damian Mooyman
22c5f3129c FIXED: Issue where viewing an archived version of a page caused invalid SQL to be generated. This would only occur with subclasses of Page. 2012-08-10 12:45:37 +12:00
Ingo Schommer
cac540d252 Merge branch '3.0' 2012-08-10 00:19:00 +02:00
Ingo Schommer
ca1d38dffd BUG Localize DataObject->summaryFields() 2012-08-10 00:14:02 +02:00
Ingo Schommer
fb7008627c Merge remote-tracking branch 'origin/3.0' 2012-08-09 10:47:44 +02:00
Juerg Rast
00a2edd9bc Wrong deprecation notice in DBField::create() 2012-08-04 19:14:16 +02:00
Niklas Forsdahl
76c5b56e81 BUG: augmentSQL always extended on base data class on query finalization
The augmentSQL DataExtension method is always extended on the base data
class of data objects in DataQuery::getFinilisedQuery(). This results
in augmentSQL not being called for extensions that are applied to non-
base data classes when finalizing the query.

For example, if Versioned was applied to class B which extends class A,
which in turn extends DataObject, then augmentSQL would be extended for
class A in DataQuery::getFinilisedQuery(). Since class A doesn't have
the Versioned extension in this example, it would not work for class B.

Fixed this by extending augmentSQL on the actual data class and not
on the base class.
2012-08-02 16:09:58 +03:00
Hamish Friedlander
3efdb5c981 Merge in changes from 3.0.1 final 2012-07-31 16:51:10 +12:00
Hamish Friedlander
367c49d6b1 API DataObject#relField now checks for method on model before property 2012-07-27 14:44:38 +12:00
Hamish Friedlander
95d0be636c Merge remote-tracking branch 'origin/3.0' 2012-07-25 11:44:53 +12:00
Mateusz Uzdowski
143ecebbfb BUG Correct wrong parameter order. 2012-07-24 14:17:12 +12:00
Hamish Friedlander
36c8fc2e93 Merge pull request #660 from silverstripe-rebelalliance/trac/7673
API Prep ArrayList, DataList, forForeignID for immutability in 3.1 per 7673
2012-07-22 21:30:53 -07:00
Hamish Friedlander
b7691077cf API Prep forForeignID for immutability in 3.1 per 7673 2012-07-23 10:31:47 +12:00
Hamish Friedlander
5fa18e9ab6 Merge pull request #652 from silverstripe-rebelalliance/trac/7482
BUG Fix issues with composite fields, as per Trac/7482
2012-07-22 15:14:30 -07:00
Andrew Short
c058f97edd BUG: Allow using instances for search filters.
Previously search filters could only be specified as strings, this
allows instances to be used so more complex filter configuration
can be used.
2012-07-23 02:11:35 +10:00
Hamish Friedlander
e8e4604457 API Prep DataList for immutability in 3.1 per 7673
DataList had several methods that should act on a copy and return
that copy, but was instead mutating the existing list.

We cant change this behaviour in the 3.0 line for backwards compt.
reasons, but this makes the desired behavior the default, and
makes disabling the mutation in 3.1 easier

It also introduces two new methods to deal with the common pattern
of wanting to modify the underlying dataQuery, which we want to be
able to reliably do in a way that always acts immutably. The main
method of these two is alterDataQuery
2012-07-20 15:58:18 +12:00
Hamish Friedlander
1ed41b8d67 API Prep ArrayList for immutability in 3.1 per 7673
ArrayList had several methods that should act on a copy and return
that copy, but was instead mutating the existing list.

We cant change this behaviour in the 3.0 line for backwards compt.
reasons, but this makes the desired behavior the default, and
makes disabling the mutation in 3.1 easier
2012-07-20 14:55:44 +12:00
Hamish Friedlander
c9b3430470 Update docs to indicate lists not mutable as per 7673 2012-07-20 14:51:12 +12:00
Ingo Schommer
3ae8b0b665 Merge remote-tracking branch 'origin/3.0' 2012-07-18 15:00:06 +02:00
Ingo Schommer
e0477321d3 Merge pull request #651 from willrossi/enumtidyup
API: Renamed EnumField::Lower() and EnumField::Upper() to LowerCase() and UpperCase()
2012-07-17 23:43:00 -07:00
Hamish Friedlander
e8cd675c94 BUG trac 7482 couldnt publish composite fields to live
When publishing to live, DataObject#forceChange is called, which wasnt correctly loading
in fields that were lazy (unloaded) if those fields were from composite fields
like Money. The end result is that any Money values would be forced to null on
publish to live

Also changes the API of the (internal, protected) loadLazyFields method so that
not passing a class argument just unlazys all lazy fields regardless of source table
2012-07-18 16:28:24 +12:00
Hamish Friedlander
69928631fe BUG trac 7482, we werent unlazying composite fields right
In getField we check if the field we are getting is currently lazy (unloaded), and
load it if it is. This was only working for simple fields though - composite
fields like Money werent working
2012-07-18 16:25:37 +12:00
Will Rossiter
a38bfc577c API: Deprecate EnumField::Lower() and EnumField::Upper() to LowerCase() and UpperCase() for consistency with StringField 2012-07-18 11:54:42 +12:00
Mateusz Uzdowski
70dcb55fe0 BUG Use prepStringForDB consistently across the framework.
Also remove a line from DBFieldTest, it's redundant with the previous
line.

Ref: os7229
2012-07-17 14:27:58 +12:00
Ingo Schommer
712f28bc78 Scoped deprecation messages (fixes #7645) 2012-07-13 11:37:35 +02:00
Ingo Schommer
55c348d01b Merge pull request #621 from chillu/pull/dbdatetimetest-offsets
Skip tests rather than throw PHP error on wrong offests in DBDatetimeTest
2012-07-06 02:34:19 -07:00
Ingo Schommer
e00c87541e Merge pull request #618 from chillu/pull/deprecate-profiler
API Deprecated Profiler class, removed related debug GET params
2012-07-05 13:43:37 -07:00
Ingo Schommer
64357a4522 Merge branch '3.0'
Conflicts:
	admin/css/screen.css
	admin/scss/_forms.scss
	docs/en/changelogs/3.0.0.md
2012-07-05 18:01:09 +02:00
Ingo Schommer
683d420247 NEW Database->supportsTimezoneOverride() 2012-07-05 16:16:36 +02:00
Ingo Schommer
0fe515e182 API Deprecated Profiler class, removed related debug GET params
Use third party tools like XHProf instead.
Removed defunct or unnecessary debug GET parameters:
debug_profile, debug_memory, profile_trace, debug_javascript, debug_behaviour
2012-07-05 12:02:06 +02:00
Hamish Friedlander
890f7e3919 BUG $db in extensions not inited early enough (#7598)
When querying DataObjects by a generic parent class (like SiteTree for instance), fields added via $db
set on child classes wouldnt appear.

This is because Object::__construct wasnt called early enough in DataObject::__construct, so
extensions werent initialised when $db was first accessed
2012-07-02 17:25:14 +12:00
Simon Welsh
cd0a1ff623 FIX DataQuery::applyRelation was returning the base class.
If the applyRelation() was passed a relation that went to a class with a parent
class with a database table, applyRelation would return the name of the parent
class, rather than the class the relation was actually too.
2012-06-29 21:54:48 +12:00
Will Rossiter
4ee709e88d FIX: ensure limits to SQLQuery are passed as positive values 2012-06-29 19:40:28 +12:00
Ingo Schommer
63afdba7a5 Merge pull request #584 from silverstripe-droptables/ssexpress
BUG: notify PaginatedList the full-text results are already limited.
2012-06-27 23:59:01 -07:00
Mateusz Uzdowski
3141e713b7 BUG: notify PaginatedList the full-text results are already limited.
PaginatedList needs to be notified about this, otherwise it will
errorneously try to further limit the already limited set, making the
subsequent pages empty.
2012-06-28 13:19:13 +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
Ingo Schommer
34a2ce23d8 NEW Documentation for Versioned 2012-06-27 16:09:31 +02:00
Ingo Schommer
868d3697fd Fixed usage of DataList etc in docs (fixes #7518) 2012-06-27 16:09:31 +02:00
Simon Welsh
070ba56104 FIX DataQuery::applyRelation was returning the base class.
If the applyRelation() was passed a relation that went to a class with a parent
class with a database table, applyRelation would return the name of the parent
class, rather than the class the relation was actually too.
2012-06-25 11:34:02 +12:00
Andrew Short
119da09549 BUG Fixed DataList filtering and excluding by ID.
If a filter or exclude by ID was applied across more than one table it
would throw an ambiguous column error as the table name was not specified.
2012-06-25 10:16:18 +12:00
Sam Minnee
1b5768975c BUG: exclude() clears previously selected filters() (Trac #7529)
This bug was caused by the fact that SQLQuery::whereAny() removed existing filters.  In line with addWhere() and setWhere(), I split this into addWhereAny() and setWhereAny().  Strictly speaking, this drops the method SQLQuery::whereAny(), but it was really just an internal function for exclude, and so I think that's acceptable.
2012-06-22 16:31:29 +12:00
Ingo Schommer
3a7128d00c MINOR Fixed phpdocs 2012-06-20 23:59:16 +02:00
Ingo Schommer
88582e7483 Revert "BUGFIX Aborting marking in Hierarchy->markPartialTree() before loading nodes, if the expected node count would exceed the totals (regardless of the in-memory marking state)"
This reverts commit f1bf0d0fc4. Fixes #7481
2012-06-15 11:53:33 +02:00
Sam Minnée
d014b4d106 Merge pull request #539 from simonwelsh/transliterator_rename
API CHANGE Renames Transliterator to SS_Transliterator
2012-06-14 20:59:56 -07:00
Simon Welsh
9bd7765272 API CHANGE Renames Transliterator to SS_Transliterator
The intl extension in PHP 5.4 provides a Transliterator class, which
conflicts with the SilverStripe one. This leads to some really weird
ReflectionExceptions about Transliterator's constructor being
private.
2012-06-15 15:54:47 +12:00
Sean Harvey
538bcdc74d BUGFIX Ensure that the DataList is being used correctly when applying filters in HtmlEditorField and Hierarchy 2012-06-15 15:49:22 +12:00
Sam Minnee
a1e7c1f9bf BUGFIX: Updated MySQLDatabase::indexList() to return index columns escaped by double quotes 2012-06-15 13:25:50 +12:00
Sam Minnée
a93dd9459e Merge pull request #496 from sminnee/dataquery-aggregate
Dataquery aggregate
2012-06-14 17:20:35 -07:00
Sam Minnée
aebfea7f68 Merge pull request #505 from schmengler/index-fix
BUGFIX: Added double quotes to column names in automatically generated i...
2012-06-14 17:19:48 -07:00
Sean Harvey
0a2e877625 MINOR Remove PostgreSQLDatabase boolean workaround in
DataObject::__construct()

The database adapter uses smallint instead of the boolean datatype,
which works around the issue instead of converting the value.
2012-06-12 14:21:59 +12:00
Sean Harvey
59e68f16da MINOR Remove MSSQLDatabase date/datetime workarounds from DataObject::__construct()
These are being handled by the MSSQLDatabase class in the mssql module
instead, which keeps the workarounds separated from the framework core.
2012-06-12 12:25:15 +12:00
Sam Minnee
1aefc0aa94 BUGFIX: Ensure that extensio arugments are passed when temporarily instantiating for setting up statics. 2012-06-11 22:56:11 +12:00
Sam Minnee
114ebb6953 API CHANGE: Don't have any instance caching in singleton(), rely on Injector for this. 2012-06-11 22:41:12 +12:00
Sam Minnee
f65a7c6b21 API CHANGE: Remove dodgy DataObject::destroy() behaviour, opting instead for using PHP5.3's garbage collector. 2012-06-11 22:41:12 +12:00
Sam Minnee
e19ab7aa5a BUGFIX: Ensure that DataList::filter() doesn't modify the original object. 2012-06-06 16:13:54 +12:00
Sam Minnee
0821f021cc API CHANGE: Added DataList::filterByCallback() to allow filtering by PHP code. 2012-06-06 16:12:05 +12:00
Sam Minnee
780f2d2b16 API CHANGE: Added DataQuery::aggregate() to allow for aggregates beyond Min, Max, Avg, Sum. 2012-06-06 16:12:05 +12:00
Sean Harvey
13be7cb2b9 BUGFIX Ensure that enum values with a single quote are escaped correctly for PHP coming out of MySQL ('' to \'), otherwise dev/build shows these as changed all the time. 2012-06-06 10:39:00 +12:00
Fabian Schmengler
afdd8683e4 BUGFIX: Added double quotes to column names in automatically generated indexes for many_many relationships (this time in the right place, should not interfere with index name - all tests pass) 2012-06-05 11:51:04 +02:00
Sam Minnee
5499079c1c BUGFIX: Fixed ORM bugs introduced in ec55468932 2012-06-05 11:07:19 +12:00
Sam Minnée
f8921f7c9f Merge pull request #500 from nyeholt/injector_strong_create
RECOMMIT This is a recommit of a previously merged, but reverted, commit...
2012-06-04 15:32:19 -07:00
Sam Minnée
90378b0998 Merge pull request #504 from schmengler/namespace-fixes-rc1
BUGFIX: Handling of classes with namespaces in database
2012-06-04 15:31:26 -07:00
Fabian Schmengler
ec55468932 BUGFIX: Handling of classes with namespaces in database
MySQLDatabase::enumValuesForField() - Added stripslashes because backslashes are escaped in the type description

DataObject::requireTable() - Added double quotes to column names in automatically generated indexes for many_many relationships

DataObject::write() - Escaped class name for DB query

DataQuery::getFinalisedQuery() - Escaped class names for DB query
2012-06-04 20:22:37 +02:00
Marcus Nyeholt
82a1e7d282 MINOR Use injector for creating Member_GroupSet object
MINOR Use injector for creating many many list objects

MINOR Use injector for creating objects from within the DataList

MINOR Use Injector::inst() for creating objects; cannot rely on this->injector being present due to many classes being created with 'new', so use inst() directly

MINOR Remove injector autoset property for now; automatically setting it breaks a few test cases that don't know about it for now, and it's not needed just yet
2012-06-05 01:33:44 +10:00
Marcus Nyeholt
ae7fc6f4d2 RECOMMIT This is a recommit of a previously merged, but reverted, commit. The initial commit had problems when running "tests/all flush=all" when dev/build would re-analyse a bunch of stuff; fixes to address this went into https://github.com/silverstripe/sapphire/pull/487, but for some reason the actual base changes didn't, so I'm re-submitting them in a separate pull.
BUGFIX Versioned's constructor doesn't provide suitable defaults. Previously a bug/feature in singleton, where it would pass null,true as params to strong_create, which would then get passed through as params to Versioned's constructor, meant that the code still executed fine (as was set to something that wasn't an array, so the null and true were instead taken as args). The fact that the usage of singleton(Versioned) never really used the classes code, purely for value lookup, meant that this never propagated errors. I've now switched singleton() to use the injector for retrieving values, which means these dud values are no longer passed through

CHANGE Given that Config::inst is an implementation of the singleton pattern itself, I've removed the extra call to singleton(). A side effect of this is that it gets around a possibly nasty circular reference with the dependency injector (which relies on the config object); in future, this dependency structure should really be structured from the DI directly.

MINOR Change singleton and strong_create to use dependency injector
2012-06-03 20:41:00 +10:00
Sean Harvey
c4a1523fac Merge pull request #465 from halkyon/aggregate_fixes
Deprecated aggregates fix
2012-05-30 02:04:36 -07:00
Sean Harvey
909c5bd3b1 MINOR Fixed spelling error 2012-05-29 20:10:34 +12:00
Sean Harvey
f43273f217 MINOR Provide a better error if incorrect number of arguments are passed
to filter() or exclude() on a DataList
2012-05-29 20:09:36 +12:00
Sean Harvey
792c89e103 ENHANCEMENT Adding List() in the GenericTemplateGlobalProvider so
templates can use <% cached List(Member).max(LastEdited) %> instead
of deprecated "Aggregate" syntax.
2012-05-29 20:04:51 +12:00
Sean Harvey
c3eabffcb9 MINOR Use shorthand {class}::get() syntax instead of DataList::create()
in core code.
2012-05-28 21:13:42 +12:00
Sean Harvey
862d7f249b MINOR If $containerClass passed in to DataObject::get() isn't DataList,
use Deprecation::notice() instead of throwing a notice
2012-05-28 21:12:06 +12:00
Sean Harvey
9074f524cc BUGFIX Fixing regression in Boolean::scaffoldSearchField() 2012-05-24 14:13:55 +12:00
Sam Minnée
c5616f8724 Merge pull request #487 from nyeholt/injector_bugfixes
Change singleton and strong_create to use dependency injector, with additional fixes to existing classes to behave correctly
2012-05-23 18:46:48 -07:00
Sean Harvey
1ed5e3c9be Merge pull request #485 from halkyon/deprecate_director_statics_for_controller
Deprecate director controller static functions
2012-05-23 15:54:57 -07:00
Marcus Nyeholt
82495f5a7e BUGFIX Versioned's constructor doesn't provide suitable defaults. Previously a bug/feature in singleton, where it would pass null,true as params to strong_create, which would then get passed through as params to Versioned's constructor, meant that the code still executed fine (as was set to something that wasn't an array, so the null and true were instead taken as args). The fact that the usage of singleton(Versioned) never really used the classes code, purely for value lookup, meant that this never propagated errors. I've now switched singleton() to use the injector for retrieving values, which means these dud values are no longer passed through
CHANGE Given that Config::inst is an implementation of the singleton pattern itself, I've removed the extra call to singleton(). A side effect of this is that it gets around a possibly nasty circular reference with the dependency injector (which relies on the config object); in future, this dependency structure should really be structured from the DI directly.

MINOR Change singleton and strong_create to use dependency injector

BUGFIX: Provide default constructor values for classes (fixes issues when used in 'singleton' scenario during dev/build in particular)

MINOR Clear out injector state when resetting db schema during tests (a follow on from changing singleton() calls to use the injector underneath)
2012-05-23 21:10:04 +10:00
Sean Harvey
60c72c40d9 API CHANGE Use of the DropdownField $emptyString argument is now
properly deprecated (has been marked as deprecated since 2.3). Please
use setEmptyString() on the DropdownField instance instead.
2012-05-23 22:59:40 +12:00
Sean Harvey
77c2365b87 MINOR Replacing deprecated static function calls to Director with
current Controller instance replacements.
2012-05-23 21:50:02 +12:00
Sean Harvey
29e04a1049 Revert "BUGFIX Versioned's constructor doesn't provide suitable defaults. Previously a bug/feature in singleton, where it would pass null,true as params to strong_create, which would then get passed through as params to Versioned's constructor, meant that the code still executed fine (as was set to something that wasn't an array, so the null and true were instead taken as args). The fact that the usage of singleton(Versioned) never really used the classes code, purely for value lookup, meant that this never propagated errors. I've now switched singleton() to use the injector for retrieving values, which means these dud values are no longer passed through"
This reverts commit 5eaca340b4.
2012-05-23 09:52:57 +12:00
Marcus Nyeholt
5eaca340b4 BUGFIX Versioned's constructor doesn't provide suitable defaults. Previously a bug/feature in singleton, where it would pass null,true as params to strong_create, which would then get passed through as params to Versioned's constructor, meant that the code still executed fine (as was set to something that wasn't an array, so the null and true were instead taken as args). The fact that the usage of singleton(Versioned) never really used the classes code, purely for value lookup, meant that this never propagated errors. I've now switched singleton() to use the injector for retrieving values, which means these dud values are no longer passed through
CHANGE Given that Config::inst is an implementation of the singleton pattern itself, I've removed the extra call to singleton(). A side effect of this is that it gets around a possibly nasty circular reference with the dependency injector (which relies on the config object); in future, this dependency structure should really be structured from the DI directly.

MINOR Change singleton and strong_create to use dependency injector
2012-05-22 19:09:35 +10:00
Sean Harvey
e5e8f489a2 Merge branch (pull request #247) 'template-global-fixes' of https://github.com/sminnee/sapphire into sminnee-template-global-fixes 2012-05-19 15:39:59 +12:00
Yuki Awano
c04b01fc2a BUGFIX Changed Date.php and DateTime.php to use DateTime->Format instead of strtotime to handle extended dates on 32bit environment(fixes #7311) 2012-05-18 16:09:38 +09:00
Sam Minnee
7201f06476 API CHANGE: Added new config option Money.default_currency. 2012-05-18 16:15:13 +12:00
Ingo Schommer
8f2ede8fcf MINOR Fixed syntax errors from SQLQuery/DataQuery cleanup 2012-05-16 13:17:19 +02:00
Ingo Schommer
3a11c690ed MINOR Updated security documentation (phpdoc and markdown) around new DataList and SQLQuery APIs, additional automatic escaping on some stricter inputs like column names 2012-05-16 11:59:22 +02:00
Ingo Schommer
9326d9e60e BUGFIX Fixing SQLQuery->getFilter() usage of non-existent method (removed during refactoring of pull request), more accurate deprecation notice 2012-05-15 21:29:43 +02:00
Sean Harvey
b1104dac25 BUGFIX Don't try lazy loading fields when the record ID is set to something non-numeric, otherwise you'll get a SQL error. 2012-05-15 17:18:50 +12:00
Sean Harvey
a53cca8932 MINOR Renaming getFieldSet with getFieldList in FormScaffolder 2012-05-14 15:03:22 +12:00
Sean Harvey
0fe0d87d9f Merge pull request #434 from halkyon/using_non_deprecated_template_controls
Replacing use of deprecated <% control %> with <% with %> or <% loop %> as necessary
2012-05-11 15:08:16 -07:00
Ingo Schommer
13c9011082 Merge pull request #430 from halkyon/getallfields_fixes
MINOR Fixing use of deprecated getAllFields(), mark field as deprecated ...
2012-05-11 01:04:38 -07:00
Sean Harvey
6f672e5f36 MINOR Fixing use of <% control %> with <% with %> or <% loop %> as necessary. 2012-05-11 13:49:20 +12:00
Sean Harvey
46f51d5653 MINOR Fixing deprecated use of SQLQuery 2012-05-11 11:39:06 +12:00
Sean Harvey
1859070fa9 MINOR Fixing use of deprecated getAllFields(), mark field as deprecated properly. 2012-05-11 11:23:24 +12:00
Sean Harvey
56e75b4486 MINOR Revert changes for 5.4 2012-05-10 14:11:33 +12:00
Sean Harvey
f30a3bd760 BUGFIX Database::doesSchemaNeedUpdating() if schemaUpdateTransaction is NULL, then return FALSE. If schemaUpdateTransaction is an array, then return TRUE. This replaces the automatic casting which is not clear. 2012-05-10 13:58:29 +12:00
Ingo Schommer
8281678d4c BUGFIX Urlencode paths in URLSegmentFilter when $allowMultibyte=true to avoid creating invalid URLs (and breaking assumptions based on ascii-only URLs, such as static publishing filename creation) 2012-05-08 15:32:15 +02:00
Ingo Schommer
59d31c2fc2 MINOR Removed mbstring support checks, its an installation requirement 2012-05-08 15:32:15 +02:00
Sean Harvey
7c272d3139 MINOR SQLQuery doc cleanup 2012-05-07 17:11:10 +12:00
Sean Harvey
3bc1da0543 MINOR Tidy up of SQLQuery constructor docs and default args, limit is
stored internally as an array, not a string.
2012-05-07 17:07:30 +12:00
Sean Harvey
bb9ffd2eb1 ENHANCEMENT SQLQuery::selectField() returns a SQLQuery object to be
consistent with how the other add/set methods work.
MINOR Fixing DbDatetimeTest to use the correct selectField to select an
alias
2012-05-07 16:59:42 +12:00
Sean Harvey
e50f90bf8e BUGFIX Ensure end bracket for HAVING clause is put in the right place 2012-05-07 16:36:05 +12:00
Sean Harvey
051d9de482 API CHANGE Deprecated internal access to SQLQuery properties, update core code to reflect these changes.
Using set/add instead in accessor methods, and use Database::sql*ToString() to allow easier per-database adapter SQL overloading.
2012-05-07 14:21:44 +12:00
Ingo Schommer
68051fdb96 Merge pull request #371 from halkyon/sapphire
---

Dont start the session until its actually necessary, which is to say there is a cookie available with the current PHP session name (or a request variable with the session_name() - typically PHPSESSID.) The latter allows for passing session ID through as an alternative to cookies.
2012-05-03 14:58:09 +02:00
Sean Harvey
37369abf1d BUGFIX Fixing SortColumn alias to be recognised by MSSQL/PGSQL 2012-05-03 12:02:21 +12:00
Sean Harvey
151abde17d Merge pull request #388 from chillu/trac/7170-i18n-sprintf-injections
#7170 i18n sprintf injections
2012-05-02 16:18:30 -07:00
Sam Minnée
a004acfb59 Merge pull request #381 from AngryPHPNerd/patch-2
MINOR: Colliding field check runs twice
2012-05-02 14:14:40 -07:00
Ingo Schommer
7b18d9d0da MINOR Switching _t() calls from sprintf() to using injection parameters (#7170) 2012-05-01 22:17:00 +02:00
Ingo Schommer
2288d80c30 Merge pull request #387 from sminnee/sapphire
---

The primary goal of this branch was to fix the sort bugs in AssetAdmin, however, it started a bit of a yak shave in that the API around SQLQuery was poor.  The biggest change that this pull request makes is it changes the format of SQLQuery::$select to contain aliases as array keys (and consistently puts the "implicit alias" in there to assist with various query generation logic), but it also makes a bunch of changes to avoid direct access of that property.
2012-05-01 17:57:03 +02:00
Sam Minnee
2207e3d978 API CHANGE: Add SQLQuery::prepareSelect(), to further remove the need for direct property access.
API CHANGE: Change the format of SQLQuery::$select to use aliases as keys.
2012-05-01 18:15:11 +12:00
Sam Minnee
a8e8a6060a BUGFIX: Fixed errors caused by complex raw SQL sort() calls. (#7236) 2012-05-01 18:15:08 +12:00
Sam Minnee
5abf8cf0f3 BUGFIX: Don't select *any* column() in DataQuery::initialiseQuery(); leave that until finaliseQuery(). It shouldn't be necessary and just risks field collisions. 2012-05-01 17:57:44 +12:00
Sam Minnee
8661164c19 API CHANGE: Add SQLQuery::clearSelect(), SQLQuery::selectField() and SQLQuery::itemisedSelect() to make it easier for other subsystems to use SQLQuery without resorting to direct property access.
API CHANGE: Remove DataQuery::select() in place of DataQuery::selectField().
BUGFIX: Remove direct property access to SQLQuery::$select
2012-05-01 17:57:39 +12:00
Sean Harvey
0882741f54 API CHANGE Renamed setModel for DataModel instances to setDataModel for
semantics, and also to allow a field name called "Model"
2012-05-01 14:45:44 +12:00
Sean Harvey
c84254c5b1 API CHANGE Rename SQLQuery prepareSelect to prepareWhere 2012-05-01 12:04:11 +12:00
Dominik Beerbohm
fdd5e71ba9 ENHANCEMENT: Remove unnecessary NULL check. 2012-04-30 13:44:31 +03:00
Robert Curry
ff6909df97 ENHANCEMENT: Add lazy loading to DataQuery. 2012-04-30 16:12:15 +12:00
Sean Harvey
80575a0e5e MINOR Re-adding getFilter as a deprecated method instead of removing it 2012-04-27 16:56:07 +12:00
Sean Harvey
f63d137d49 ENHANCEMENT Session::start() now only called when there is changed
session data to be saved, and started on Director::direct() when there
is a cookie (or request var) containing the current PHP session name.
2012-04-27 16:28:46 +12:00
Will Rossiter
9938b64cf6 FEATURE: implement SS_Sortable->reverse()
API CHANGE: SQLQuery:: now an array object rather than string. Existing strings will continue to work
2012-04-27 15:54:14 +12:00
Mateusz Uzdowski
6469d83569 API CHANGE: add a remote relation class getter to DataObject 2012-04-23 15:01:55 +12:00
Sean Harvey
1683299d81 MINOR Ignore any values that come through as arrays in DataObject::cache_composite_fields() 2012-04-20 15:25:52 +12:00
Sam Minnee
8e48e6e231 API CHANGE: Allow <classname>::get(), eg, Member::get()->byID(5) 2012-04-20 14:58:24 +12:00
Will Rossiter
585417d141 Merge pull request #343 from halkyon/object_static_remove_deprecation
BUGFIX Remove calls to deprecated Object static methods, update ConfigTest
2012-04-19 14:41:45 -07:00
Ingo Schommer
a1327faae4 Merge pull request #344 from halkyon/remove_deprecated_extrastatics_usage
ENHANCEMENT Remove use of deprecated extraStatics in core files
2012-04-18 15:42:51 -07:00
Sean Harvey
4cf8db3ee4 ENHANCEMENT Remove use of deprecated extraStatics in core files 2012-04-19 08:37:51 +12:00
Ingo Schommer
7f62ad0f3e Merge branch 'master' into 7094-combine-tree-edit-view 2012-04-18 14:19:55 +02:00
Sean Harvey
4c6be2931b BUGFIX Removing use of deprecated Object static functions like
get_static(), set_static(), uninherited() etc. Replace with equivalent
Config system get(), update()
2012-04-18 23:10:57 +12:00
Sean Harvey
7d84aff01e Merge pull request #339 from ajoneil/remove-pre-53-support
Remove pre 5.3 support
2012-04-17 16:19:23 -07:00
Andrew O'Neil
fb3b03f38b MINOR: Remove support for PHP <5.3.2 2012-04-18 11:01:03 +12:00
Mateusz Uzdowski
be97535b1e ENHANCEMENT: add an infinite-loop check as validation in Hierarchy (os4399)
Check only when the parent has changed - hierarchy traversal is
expensive operation, so we do it only when it is needed.
2012-04-18 10:50:35 +12:00
Mateusz Uzdowski
42e6ae2cdf APICHANGE: add validation extension hook to DataExtension 2012-04-18 09:25:48 +12:00
Ingo Schommer
761bae3418 ENHANCEMENT Support for anonymous functions instead of eval() in Hierarchy->getSiteTreeAsUL() 2012-04-17 22:29:38 +02:00
Mateusz Uzdowski
59663f9289 BUGFIX: fix up some E_STRICT errors 2012-04-17 11:51:55 +12:00
Ingo Schommer
d44f6b3e1f MINOR Removed deprecated usage of $priority argument in _t() calls 2012-04-15 17:17:17 +02:00
Ingo Schommer
b81863cfd9 MINOR Caching DataObject->fieldLabels() in memory, to avoid _t() being called excessively through fieldLabel() 2012-04-15 17:17:17 +02:00
Simon Welsh
f07258f3cf MINOR Update @package values to match renaming sapphire 2012-04-15 10:50:19 +12:00
Simon Welsh
3a6341a251 API-CHANGE sapphire folder can now be renamed. 2012-04-15 10:50:19 +12:00
Simon Welsh
f8082e4814 MINOR Add newline to end of files without one 2012-04-15 10:50:19 +12:00
Ingo Schommer
8ba9c3ca6b API CHANGE Removed $params argument to DataObject->getCMSFields(), please use FormScaffolder directly (fixes #7135) 2012-04-13 15:46:47 +02:00
Ingo Schommer
c73b80049a MINOR Removed usage of deprecated Object::uninherited_static() in core, improves CMS loading speed in live mode by ~3.5% 2012-04-12 18:26:56 +02:00
Mateusz Uzdowski
ae5bd7d65e ENHANCEMENT: refer to cache statics explicitly via DataObject (os6175)
Unify the usage across the class. Since the intention is to have a
single site-wide cache, calling via DataObject seems to be a better
option - self could theoretically end up calling a redefined field from
a subclass.
2012-04-12 17:04:24 +12:00
Mateusz Uzdowski
aedadebae6 BUGFIX: adjust the cache flush and reset functions to cover all caches (os6175) 2012-04-12 17:04:22 +12:00
Mateusz Uzdowski
8ea2460e50 BUGFIX: make internal DataObject caches more consistent (os6175) 2012-04-12 17:03:18 +12:00
Mateusz Uzdowski
621b2e1888 APICHANGE: deprecate DataObject::setComponent, no longer does anything. 2012-04-12 17:02:09 +12:00
Mateusz Uzdowski
360e9df54e MINOR: fix typo 2012-04-12 16:22:36 +12:00
Sam Minnée
d766100335 Merge pull request #304 from halkyon/e_strict_fixes
Enable E_STRICT by default for development, fix all E_STRICT errors affected by tests.
2012-04-11 17:54:18 -07:00
Sam Minnee
aa659a2326 MINOR: Fixed classname displayed in Hierarchy::markChildren() error. (#4406) 2012-04-12 12:38:07 +12:00
Sean Harvey
6b40377a1c BUGFIX Time::setValue() now conforms to DBField::setValue() for E_STRICT compliance. 2012-04-12 12:08:22 +12:00
Sean Harvey
9a9cebb369 MINOR Versioned::add_to_class() now conforms to parent
DataExtension::add_to_class() with $args being optional (default to
null). This is for E_STRICT compliance.
2012-04-12 12:07:35 +12:00
Sean Harvey
41433f1211 BUGFIX Fixing FulltextSearchable and Hierarchy to conform to the parent DataExtension for E_STRICT compliance. 2012-04-12 12:06:02 +12:00
Sean Harvey
9bd7068394 MINOR Fixed class documentation for CompositeDBField 2012-04-12 12:04:58 +12:00
Ingo Schommer
ac45e5b9c0 Merge branch 'integration'
Conflicts:
	admin/css/ie8.css
	admin/css/screen.css
	admin/scss/_style.scss
	dev/install/config-form.html
	dev/install/install.css
	dev/install/php5-required.html
2012-04-11 16:31:12 +02:00
Andrew O'Neil
75c5134bc9 BUGFIX: Fix Money::setValue() using old api 2012-04-11 15:30:38 +12:00
Andrew O'Neil
bdb312c665 API CHANGE: DBField::hasValue() conflicts with ViewableData::hasValue(), use DBField::exists() instead. 2012-04-11 14:48:06 +12:00
Ingo Schommer
8c5e56fe31 Merge branch 'master' into integration
Conflicts:
	admin/css/screen.css
	dev/install/php5-required.html
2012-04-09 21:10:08 +02:00
Julian Seidenberg
e76913f811 API-CHANGE: adding a default option of null to the $args argument in DataExtension::add_to_class. The args argument isn't used anywhere in the class and adding a third argument to every call to this function is tedious. 2012-04-05 14:15:00 +12:00
Ingo Schommer
40d73127ae MINOR Using late static binding instead of Object::create() calls 2012-04-04 17:10:31 +02:00
Ingo Schommer
6517f4496b Merge pull request #273 from ajoneil/sapphire
---

This allows DataList::create(SiteTree) as equivalent to Object::create(DataList, SiteTree), without
having to have a create() function on DataList.

Required for E_STRICT compliance, as child classes cant override create() if they change the arguments.

DBField::create() is also renamed to DBField::create_field(), as this does not just call the constructor, which all other cases of create() do.

Conflicts:
	tests/model/DateTest.php
	tests/model/DatetimeTest.php
2012-04-04 16:48:16 +02:00
unclecheese
59706d5bf5 Using deprecated StringField::Upper() and StringField::Lower(). Calling $MyEnumField.Upper on the template returns an unresolvable deprecation error. 2012-04-03 15:58:17 -03:00
Sam Minnee
58433d38ce BUGFIX: Tidied up relObject() behaviour on DataLists to restore broken SearchContext functionality. 2012-03-30 15:59:57 +13:00
Sean Harvey
e097f6e1a8 MINOR Fixes to method arguments in core classes for E_STRICT support.
API CHANGE Remove abstract static function and just use static functions
in Authenticator (PHP 5.3+ doesn't support abstract static functions)
2012-03-28 22:41:42 +13:00
Normann Lou
9e60225064 MINOR : Update core docs to use DataList::create() rather than DataObject::get()/get_one()/get_by_id() where appropriate - Trac#6891 2012-03-27 17:02:18 +02:00
Andrew O'Neil
de2832e65f ENHANCEMENT: Allow Object::create() to be called with late static binding.
This allows DataList::create('SiteTree') as equivalent to Object::create('DataList', 'SiteTree'), without
having to have a create() function on DataList. Required for E_STRICT compliance.
2012-03-27 17:57:42 +13:00
Sam Minnee
2576944a45 API CHANGE: Added DataObject::relField(), which pushes the "relation dot syntax" code of TableListField/GridField back to the model.
BUGFIX: Made DataObject::relObject() more flexible; allowable thanks to new ORM.
2012-03-24 14:04:08 +13:00
Sean Harvey
02c8019bb8 ENHANCEMENT Introduce Database::prepStringForDB(), used by
DBField::prepValueForDB() and StringField::prepValueForDB() to ensure
the field value is escaped correctly for the database. This means
databases like MSSQL can introduce an "N" prefix (marking text as
unicode to be saved correctly) by overloading the
prepStringForDB method. MySQL, PostgreSQL and SQLite3
operate as usual.
2012-03-20 21:20:35 +13:00
Sam Minnee
8bbfa970d7 API CHANGE: Remove Controller::Now(), as it was only ever a template global provider, and use the new TemplateGlobalProvider interface on SS_Datetime instead. 2012-03-16 15:05:28 +13:00
Sean Harvey
f5a91cbbe8 ENHANCEMENT SS_Map_Iterator::rewind() SS_Map_Iterator::current() will
return the titleField if there's a method of the same name (same
behaviour as DataObjectSet::map() from SS 2.4)
2012-03-15 17:28:00 +13:00