Merge branch '4.0' into 4

This commit is contained in:
Daniel Hensby 2017-11-25 17:19:31 +00:00
commit 6d5cbe0a0e
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
11 changed files with 30 additions and 7 deletions

View File

@ -12,6 +12,7 @@ Our web-based [PHP installer](installation/) can check if you meet the requireme
* Once PHP versions become [unsupported by the PHP Project](http://php.net/supported-versions.php),
we drop support for those versions in the [next minor release](/contributing/release-process). This means that PHP 5.6 support may be dropped in a 4.x minor release after December 2018.
* We recommend using a PHP accelerator or opcode cache, such as [xcache](http://xcache.lighttpd.net/) or [WinCache](http://www.iis.net/download/wincacheforphp).
* Note: Some PHP 5.5+ packages already have [Zend OpCache](http://php.net/manual/en/book.opcache.php) installed by default. If this is the case on your system, do not try and run additional opcaches alongside Zend OpCache without first disabling it, as it will likely have unexpected consequences.
* Allocate at least 48MB of memory to each PHP process. (SilverStripe can be resource hungry for some intensive operations.)
* PHP requires a suitable CSPRNG (random number generator) source for generating random tokens, password salts etc. This can be any of the following, and most operating systems will have at least one source available:
* PHP 7 `random_bytes()`:

View File

@ -1813,6 +1813,8 @@ If left unset, this will raise an error.
to see if there is a url to redirect back to.
* Renamed `LeftAndMain_TreeNode` to `CMSMain_TreeNode`
* Removed `LeftAndMain::SiteTreeAsUL()` (override left in `CMSMain`)
* Removed `LeftAndMain::setApplicationLink()` (Deprecated from 3.x)
* Removed `LeftAndMain::setApplicationName()` (Deprecated from 3.x)
* Moved `LeftAndMain::getSiteTreeFor()` to `CMSMain`
* Moved `LeftAndMain::getsubtree()` to `CMSMain`
* Moved `LeftAndMain::updatetreenodes()` to `CMSMain`

View File

@ -308,7 +308,7 @@ class HTTP
// Fallback to use the list from the HTTP.yml configuration and rely on the file extension
// to get the file mime-type
$ext = File::get_file_extension($filename);
$ext = strtolower(File::get_file_extension($filename));
// Get the mime-types
$mimeTypes = HTTP::config()->uninherited('MimeTypes');

View File

@ -5,6 +5,7 @@ namespace SilverStripe\Core\Cache;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Psr\SimpleCache\CacheInterface;
use SilverStripe\Control\Director;
use SilverStripe\Core\Injector\Injector;
use Symfony\Component\Cache\Simple\FilesystemCache;
use Symfony\Component\Cache\Simple\ApcuCache;
@ -85,7 +86,8 @@ class DefaultCacheFactory implements CacheFactory
{
static $apcuSupported = null;
if (null === $apcuSupported) {
$apcuSupported = ApcuAdapter::isSupported();
// Need to check for CLI because Symfony won't: https://github.com/symfony/symfony/pull/25080
$apcuSupported = Director::is_cli() ? ini_get('apc.enable_cli') && ApcuAdapter::isSupported() : ApcuAdapter::isSupported();
}
return $apcuSupported;
}

View File

@ -218,6 +218,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase implements TestOnly
*/
protected function setUp()
{
if (!defined('FRAMEWORK_PATH')) {
trigger_error(
'Missing constants, did you remember to include the test bootstrap in your phpunit.xml file?',
E_USER_WARNING
);
}
// Call state helpers
static::$state->setUp($this);

View File

@ -2862,7 +2862,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
$SNG = singleton($callerClass);
$cacheComponents = array($filter, $orderby, $SNG->extend('cacheKeyComponent'));
$cacheKey = md5(var_export($cacheComponents, true));
$cacheKey = md5(serialize($cacheComponents));
$item = null;
if (!$cache || !isset(self::$_cache_get_one[$callerClass][$cacheKey])) {

View File

@ -205,6 +205,7 @@ class HTTPTest extends FunctionalTest
$this->assertEquals('image/gif', HTTP::get_mime_type('file.gif'));
$this->assertEquals('text/html', HTTP::get_mime_type('file.html'));
$this->assertEquals('image/jpeg', HTTP::get_mime_type('file.jpg'));
$this->assertEquals('image/jpeg', HTTP::get_mime_type('upperfile.JPG'));
$this->assertEquals('image/png', HTTP::get_mime_type('file.png'));
$this->assertEquals(
'image/vnd.adobe.photoshop',

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

View File

@ -137,7 +137,7 @@ class HTMLEditorFieldTest extends FunctionalTest
$this->assertEquals(20, (int)$xml[0]['height'], 'Height tag of resized image is set.');
$neededFilename
= '/assets/HTMLEditorFieldTest/f5c7c2f814/example__ResizedImageWyIxMCIsIjIwIl0.jpg';
= '/assets/HTMLEditorFieldTest/f5c7c2f814/example__ResizedImageWzEwLDIwXQ.jpg';
$this->assertEquals($neededFilename, (string)$xml[0]['src'], 'Correct URL of resized image is set.');
$this->assertTrue(file_exists(BASE_PATH.DIRECTORY_SEPARATOR.$neededFilename), 'File for resized image exists');
@ -186,7 +186,7 @@ class HTMLEditorFieldTest extends FunctionalTest
$this->assertEquals(
<<<EOS
<span class="readonly typography" id="Content">
<img src="/assets/HTMLEditorFieldTest/f5c7c2f814/example__ResizedImageWyIxMCIsIjIwIl0.jpg" alt="example" width="10" height="20">
<img src="/assets/HTMLEditorFieldTest/f5c7c2f814/example__ResizedImageWzEwLDIwXQ.jpg" alt="example" width="10" height="20">
</span>
@ -203,7 +203,7 @@ EOS
$this->assertEquals(
<<<EOS
<span class="readonly typography" id="Content">
<img src="/assets/HTMLEditorFieldTest/f5c7c2f814/example__ResizedImageWyIxMCIsIjIwIl0.jpg" alt="example" width="10" height="20">
<img src="/assets/HTMLEditorFieldTest/f5c7c2f814/example__ResizedImageWzEwLDIwXQ.jpg" alt="example" width="10" height="20">
</span>
<input type="hidden" name="Content" value="[image src=&quot;/assets/HTMLEditorFieldTest/f5c7c2f814/example.jpg&quot; width=&quot;10&quot; height=&quot;20&quot; id=&quot;{$fileID}&quot;]" />

View File

@ -930,6 +930,16 @@ class DataListTest extends SapphireTest
$this->assertEquals(1, $list->count());
}
public function testFilterAnyWithRelation()
{
$list = Player::get();
$list = $list->filterAny(array(
'Teams.Title:StartsWith' => 'Team',
'ID:GreaterThan' => 0,
));
$this->assertCount(4, $list);
}
public function testFilterAnyMultipleArray()
{
$list = TeamComment::get();

View File

@ -84,7 +84,7 @@ class DataQueryTest extends SapphireTest
$this->assertContains('"testctwo_DataQueryTest_C"."ID" = "DataQueryTest_B"."TestCTwoID"', $dq->sql());
}
public function testApplyReplationDeepInheretence()
public function testApplyRelationDeepInheritance()
{
//test has_one relation
$newDQ = new DataQuery(DataQueryTest\ObjectE::class);