Commit Graph

17780 Commits

Author SHA1 Message Date
Ingo Schommer
3b50506aa0 Fail manipulateImage() without image resource
Sometimes a manipulation can’t be carried out, either because the backend isn’t available,
or because there isn’t enough PHP memory available. In these cases, $backend->getImageResource()
will be set to NULL. This should be picked up by manipulateImage(), to avoid passing an invalid
backend into the $callback provided.

The specific case this solves is calling Image->FitMax() on large images:
$resizedImage = $originalImage->FitMax(<width>, <height>)
This will have $resizedImage==$originalImage if the image is smaller than the targeted dimensions,
but with this fix $resizedImage==NULL if the image is too large to be resized.
Which gives custom code the ability to determine which of the two should be used,
for example choosing not to pass the original large image URL to the client
since it wouldn’t be considered a “thumbnail” size.
2017-01-06 18:45:56 +13:00
Ingo Schommer
fcb511b1c0 Reinstated GDBackend->checkAvailableMemory()
This was removed as part of the SS4 assets refactor:
be239896d3
Presumably @tractorcow didn’t feel it’s possible to retain this,
because we don’t have local file handles required for getimagesize().
Since there’s getimagesizefromstring() as well (added in PHP 5.4),
we just needed a different logic branch.

Also makes the logic more resilient against missing GD resources on a backend.
Lack of available memory for a resize is only one (new) reason,
other edge cases were already causing these missing resources (e.g. an invalid file string).

Original discussion: https://groups.google.com/forum/m/#!topic/silverstripe-dev/B57a3KYeAVQ
Pull request for 3.x: https://github.com/silverstripe/silverstripe-framework/pull/2859
More context: https://github.com/silverstripe/silverstripe-framework/pull/2569
2017-01-06 18:45:56 +13:00
Ingo Schommer
6e561f00bd Force GC in GDBackend
This has been discussed previously, and was assumed to be handled by PHP automatically:
https://github.com/silverstripe/silverstripe-framework/issues/2739#issuecomment-32603005
It’s unclear if its a regression in SS4.

Tested with PHP 5.6.29, by setting xdebug breakpoints
and inspecting memory_get_usage() before and after GDBackend->manipulateImage().
Even a single 7MB JPEG straight from my DSLR (6000x300) can chomp bring the system from 30MB to >128MB memory use.
That’s in addition to the 7MB of PHP memory required for the $content variable.
Note that the image manipulations likely happen on the raw bitmap, which is much larger than the 7MB compressed JPEG.

Checked ImagickBackend, which doesn’t have this issue (and only uses about half the memory for the same set of images).
2017-01-06 18:45:56 +13:00
Robbie Averill
47ab244f0a DOCS Change "Injector" to "SilverStripe\Core\Injector\Injector" in Logger examples 2017-01-06 14:37:27 +13:00
Damian Mooyman
3e32b18c6b Merge pull request #6263 from dhensby/pulls/3/allow-unltd-grid-row-count
NEW Allow setting of unlimited row counts on GridFieldPaginator
2017-01-05 09:12:02 +13:00
Daniel Hensby
9ee3be9337 Merge pull request #6449 from mikenz/show-query-number
ENHANCEMENT: Show the query count/query number when using showqueries
2017-01-03 12:04:47 +00:00
Daniel Hensby
6ce4cc0ba1 Merge pull request #6448 from mikenz/fix-showqueries-inline
FIX: Add mising use statements for ?showqueries=inline to work
2017-01-03 10:48:46 +00:00
Mike Cochrane
0cf477d36e Use SiteTree instead of Page class in more places 2017-01-03 20:37:17 +13:00
Mike Cochrane
90fec4b8e7 Show the query count/query number when using showqueries 2017-01-03 18:13:44 +13:00
Mike Cochrane
b43f2d57c2 Add mising use statements for showqueries=inline to work 2017-01-03 18:04:11 +13:00
Daniel Hensby
6d8defcc1e Merge pull request #6445 from robbieaverill/bugfix/upgrader-mappings
FIX Correct namespaes for test classes in upgrade.yml
2016-12-29 23:42:50 +00:00
Daniel Hensby
faccdef532 Merge pull request #6444 from robbieaverill/feature/add-group-tests
TEST Add Group tests for collating family IDs and getting all children
2016-12-29 23:41:31 +00:00
Robbie Averill
b4e183aba5
TEST Add Group tests for collating family IDs and getting all children 2016-12-30 11:27:52 +13:00
Robbie Averill
d41ebbaaff FIX Correct namespaes for test classes in upgrade.yml 2016-12-30 11:25:34 +13:00
Daniel Hensby
776d2fbc66
NEW Allow setting of unlimited row counts on GridFieldPaginator 2016-12-29 14:10:13 +00:00
Daniel Hensby
fe3f9ddf51 Merge pull request #6443 from robbieaverill/feature/historical-password-count-test
TEST Add historical password count test
2016-12-29 13:00:49 +00:00
Robbie Averill
e8b959864e TEST Add historical password count test 2016-12-30 00:43:14 +13:00
Daniel Hensby
8bc7cae1e2 Merge pull request #6442 from robbieaverill/bugfix/php-7.1-tweaks
PHP 7.1 compatibility tweaks
2016-12-29 11:39:24 +00:00
Robbie Averill
6f4162ed74 FIX PHP 7.x should use random_bytes for entropy ahead of deprecated mcrypt lib 2016-12-29 23:46:08 +13:00
Robbie Averill
088d4ff222 Add PHP 7.1 to Travis configuration. Switch 7.0 to test only, 7.1 to coverage 2016-12-29 22:59:16 +13:00
Robbie Averill
37a009289c Consolidate temporary file creation and deletion logic. 2016-12-29 22:32:04 +13:00
Robbie Averill
7448622a1a FIX Replace ini casting to int with explicit split and cast for PHP 7.1. Add tests. 2016-12-29 21:55:52 +13:00
Daniel Hensby
664c0eafbe
Merge branch '3' 2016-12-28 14:30:54 +00:00
Daniel Hensby
c8a40605ec Merge pull request #6413 from volkerloew/1400-text-contextsummary
search term highlighting without altering case (fixes #1400)
2016-12-28 13:36:08 +00:00
Volker Löw
5e581eace7
search term highlighting without altering case (fixes #1400) 2016-12-28 13:03:35 +00:00
Daniel Hensby
1b1f8ed731
Merge branch '3.5' into 3 2016-12-28 11:37:10 +00:00
Daniel Hensby
054cbaa219 Merge pull request #6437 from open-sausages/pulls/4.0/update-apollo-client
Updated apollo-client
2016-12-28 11:32:13 +00:00
Damian Mooyman
a9b7a489d1 Merge 3.5 into 3 2016-12-22 13:19:08 +13:00
Damian Mooyman
b1b3a6ee13 Merge 3.4 into 3.5 2016-12-22 13:18:37 +13:00
Damian Mooyman
0bcd40545d Merge 3.5.1 into 3.5 2016-12-22 13:17:18 +13:00
Damian Mooyman
94c3bc9fa1 Merge 3.4.3 into 3.4 2016-12-22 13:16:12 +13:00
Damian Mooyman
28d065c587 Added 3.4.3 changelog 2016-12-22 12:02:45 +13:00
Ingo Schommer
120bcee4f8 Updated apollo-client 2016-12-22 11:26:44 +13:00
Damian Mooyman
9de539fdab Added 3.5.1 changelog 2016-12-22 10:43:34 +13:00
Damian Mooyman
f314b86ad8 BUG Temp disable shortcode SPLIT behaviour due to crash (#6436)
Fixes #5987
2016-12-22 10:08:46 +13:00
Will Rossiter
f4bf0cad3b Merge pull request #6420 from open-sausages/pulls/4.0/graphql
Gallery View & Create Folder uses GraphQL (fixes #316)
2016-12-22 09:24:15 +13:00
Damian Mooyman
ffdb99e78d BUG Temp disable shortcode SPLIT behaviour due to crash (#6436)
Fixes #5987
2016-12-21 18:55:00 +13:00
Ingo Schommer
b0e0e99026 Merge pull request #6435 from silverstripe/revert-6424-patch-9
Revert "Optimised keyedColumn() and map() for MySQLQuery"
2016-12-21 18:23:55 +13:00
Damian Mooyman
5aa52f1343 Revert "Optimised keyedColumn() and map() for MySQLQuery" 2016-12-21 14:48:26 +13:00
Damian Mooyman
9be5142fc1 API ChangeSet::publish() / canPublish() no longer treats hasChanges() = false as a permission error
BUG fix issues with doArchive() in live mode
2016-12-21 14:28:20 +13:00
Damian Mooyman
fd9b872cb5 Merge pull request #6425 from andrewandante/bugfix/duplicating-copies-created-dbfield
remove Created field on duplicate
2016-12-21 09:43:53 +13:00
Daniel Hensby
8b8ea1aab0 Merge pull request #6426 from robbieaverill/bugfix/gridfield-filter-panel-selector
FIX Make GridField filter button selector more specific
2016-12-20 10:58:37 +00:00
Mike Cochrane
4c6936834e Optimised keyedColumn() and map() for MySQLQuery (#6424)
* Optimised keyedColumn() and map() for MySQL

* WS

* Add unit tests for map() and keyedColumn()
2016-12-20 10:57:37 +00:00
Ingo Schommer
603b64c871 GraphQL 2016-12-20 17:20:06 +13:00
Damian Mooyman
1c76148b1c Merge pull request #6428 from open-sausages/pulls/4.0/replace-file
File replacement action
2016-12-20 15:06:38 +13:00
Robbie Averill
8ad030baba FIX Make GridField filter button selector more specific 2016-12-20 09:03:14 +13:00
Dan Hensby
26cd99de22 Added 3.5.1-rc2 changelog 2016-12-19 16:28:18 +00:00
Daniel Hensby
c794c29ddb
Merge branch '3.4' into 3.4.3 2016-12-19 16:17:44 +00:00
Daniel Hensby
2d8ac831ad
Merge branch '3.5' into 3.5.1 2016-12-19 16:16:26 +00:00
Daniel Hensby
8dc250455e
Merge branch '3.4' into 3.5 2016-12-19 16:15:46 +00:00