Commit Graph

632 Commits

Author SHA1 Message Date
g4b0
c06a9095df REGRESSION: fixed background color for PaddedImage 2013-06-19 10:19:54 +02:00
Jeremy Thomerson
6f16034ac8 MINOR: fix a couple minor typos 2013-06-18 18:28:46 +00:00
Jeremy Thomerson
964b3f2d48 FIX: <% if Link %> wasn't working
Since ViewableData was returning a casting helper for Link, but DataObject was
only using $this->$fieldname to set values on that casting helper, you could
not use <% if Link %> (or <% if $Link %>) in your templates because Link is not
a field, and thus had no value to be set on the casting helper, causing
hasValue to think that there was no value.  Since DataObject->dbObject says that
"it only matches fields and not methods", it seems safe to have it call db(..)
to get the field spec, and not call ViewableData->castingHelper at all.
2013-06-15 13:44:03 +00:00
Will Rossiter
0129e185b8 Coding conventions, PHPDoc cleanup 2013-06-15 12:06:24 +12:00
Ingo Schommer
5a94e621c5 Replace DataObject->isNotNull() helper with closure
Now possible since we support PHP 5.3+ only.
2013-06-13 07:53:27 +02:00
Damian Mooyman
be986c6524 API Allow $summary_fields to support methods on DBFields 2013-06-13 09:41:24 +12:00
Ingo Schommer
25ba77d333 Merge pull request #2062 from jthomerson/enhancement_3.1_allow_disabling_prepopulate_version_number_cache
ENHANCEMENT: allow disabling of Versioned prepopulate_versionnumber_cache
2013-06-12 01:59:49 -07:00
Stig Lindqvist
dbc2b62c69 Merge pull request #2054 from chillu/pulls/dataobject-duplicate-hasone
BUG Correct relation saving in DataObject->duplicateRelations()
2013-06-07 22:54:36 -07:00
Andrew Short
92135acc14 Merge pull request #2063 from g4b0/mysqldatabase-extensible
Enhancement: replaced private with protected
2013-06-07 07:51:49 -07:00
Ingo Schommer
23e51b871b BUG Accept $limit=0 in SQLQuery->setLimit()
SQLQuery->setLimit(0, 99) should result in "SELECT ... LIMIT 0 OFFSET 1".
In fact it does "SELECT ..." without a LIMIT clause at all,
which is unexpected. This is regardless of the $offset value.
2013-06-06 15:27:14 +02:00
g4b0
6618507823 Enhancement: replaced privete with protected in order to have MySQLDatabase class extensible 2013-06-06 09:06:55 +02:00
Jeremy Thomerson
80808a1537 ENHANCEMENT: allow disabling of Versioned prepopulate_versionnumber_cache
In large sites this can take a very long time, drastically slowing down the CMS
admin.  Even though the versions will then need to be queried individually,
this is still significantly faster than loading hundreds of thousands of
version numbers in one query and populating the cache array.
2013-06-04 13:43:58 +00:00
Ingo Schommer
f61ab7305d BUG Correct relation saving in DataObject->duplicateRelations()
This caused problems when duplicate() was used in the CMS UI
to duplicate a SiteTree object. Since every object of this type
has a ParentID relation, it copied this empty relation into
new "ghost page".

See https://github.com/silverstripe/silverstripe-cms/issues/689
2013-06-03 15:57:20 +02:00
Sean Harvey
1cebfc5d51 Revert "FIX make augmentSQL API consistent for strict PHP"
This reverts commit ab40dcc0ca.
2013-06-01 11:51:01 +12:00
Jeremy Thomerson
ab40dcc0ca FIX make augmentSQL API consistent for strict PHP
This references silverstripe/silverstripe-translatable#113
For that issue, we needed to have the DataQuery as the second parameter to
DataQuery's augmentSQL call.  Fortunately, DataQuery was already passing this
argument.  However, where the function was defined in DataExtension, the
argument was not present.  Thus, subclasses of DataExtension could not add the
parameter to their function signature if they were running in PHP strict mode
because PHP will complain that the signatures don't match.
2013-05-31 19:24:12 +00:00
Loz Calver
4a158454d6 FIX: Convert newlines to <br /> tags in string fields (fixes #1942) 2013-05-30 09:26:58 +01:00
Ingo Schommer
1ffbbb5377 Merge pull request #2029 from nedmas/patch-2
FIX: Add missing 'groupby' method
2013-05-29 14:30:04 -07:00
Tom Densham
3290511141 FIX: Add missing 'groupby' and remove redundant conditional in 'having' 2013-05-29 22:19:39 +01:00
Damian Mooyman
0ee79d43db BUG Fixed major issue with testing dataobjects that implement TestOnly and extend non-TestOnly dataobjects. Database regeneration would incorrectly populate the ClassName column 2013-05-27 16:39:57 +12:00
Sam Minnée
c26ddee191 Merge pull request #1861 from raket/dataobject-update-orphan
Fix: Orphaned records when running DataObject::update
2013-05-24 19:48:48 -07:00
Will Rossiter
438066dc14 Merge pull request #1990 from JayDevlin/1971-text-contextsummary
FIX #1971: Text->ContextSummary
2013-05-24 15:19:48 -07:00
Will Rossiter
50936ee799 Merge pull request #1992 from jthomerson/fix_unsaved_relation_list_constructor
FIX: UnsavedRelationList did not call its constructor
2013-05-24 15:19:19 -07:00
Jeremy Thomerson
5512d7c0d0 FIX: UnsavedRelationList did not call its constructor
This resulted in Object extensions not working for it, and methods not existing
where they should have.  It also resulted in poor error messages appearing when
thrown from Object since $this->class was empty since the constructor was never
called in Object.
2013-05-24 21:14:45 +00:00
Devlin
edaf709783 FIX #1971: Check if the search term is set 2013-05-24 16:57:38 +02:00
Will Rossiter
651c968915 Remove redundant get_extra_config(). (Fixes #1973) 2013-05-23 18:40:52 +12:00
Damian Mooyman
734a5fb469 BUG Fixed declaration of Versioned::updateCMSFields to be compatible with DataExtension::updateCMSFields 2013-05-22 08:08:11 +12:00
Will Rossiter
5ec4f3146f Merge pull request #1869 from wilr/open6236
FIX: Remove version field from default scaffolded CMS fields.
2013-05-21 03:50:55 -07:00
Will Rossiter
f6cd582dd9 FIX: Remove version field from default scaffolded CMS fields. 2013-05-21 22:47:54 +12:00
Will Rossiter
90c274b640 Merge pull request #1852 from wilr/open-5117
FIX: Falling back to summaryFields() should skip non database fields.
2013-05-21 03:44:57 -07:00
Ingo Schommer
30906c8b31 Merge pull request #1962 from wilr/api-links
Update @package, @subpackage labels
2013-05-21 03:27:22 -07:00
Will Rossiter
ddcfcf7bed Update @package, @subpackage labels
Cleanup of framework's use of @package and @subpackage labels and additional of labels for classes missing packages.

Moved all GridField related components to the one name.

Countless spelling fixes, grammar for other comments.

Link ClassName references in file headers.
2013-05-21 22:24:41 +12:00
Sean Harvey
34b9952e9d Consistently instantiate HasManyList and ManyManyList using create() 2013-05-21 18:13:15 +12:00
Sean Harvey
13e632d053 Merge pull request #1867 from tractorcow/3.1-urlsegmentfilter-fixes
BUG Fixes issue with "+" characters in url.
2013-05-20 00:36:18 -07:00
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
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
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
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
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
Andrew Short
5ec85d06f6 API: Don't allow dots in URL segments 2013-03-30 19:47:17 +11:00
Ingo Schommer
373da53826 Removed unused DataExtension::$extendable_statics
Oversight from cleanup in 876f4c5
2013-03-27 16:09:17 +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
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
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
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
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