From 8b3d74ed0f3a9c5572656666e4611d2e05f18c1e Mon Sep 17 00:00:00 2001 From: Tom Densham Date: Fri, 14 Feb 2014 13:29:54 +0000 Subject: [PATCH 1/7] FIX Requirement documentation of MySQL driver Currently the documentation states that the `mysql` module for PHP is required, however as of #84 (over 2 years ago) this is no longer the case and the required module is now `mysqli`. --- docs/en/installation/server-requirements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/installation/server-requirements.md b/docs/en/installation/server-requirements.md index 2a900f7ec..daf6f492a 100644 --- a/docs/en/installation/server-requirements.md +++ b/docs/en/installation/server-requirements.md @@ -11,7 +11,7 @@ Our web-based [PHP installer](/installation) can check if you meet the requireme * PHP 5.3.2+ * We recommend using a PHP accelerator or opcode cache, such as [xcache](http://xcache.lighttpd.net/) or [WinCache](http://www.iis.net/download/wincacheforphp). * Allocate at least 48MB of memory to each PHP process. (SilverStripe can be resource hungry for some intensive operations.) - * Required modules: dom, gd2, fileinfo, hash, iconv, mbstring, mysql (or other database driver), session, simplexml, tokenizer, xml. + * Required modules: dom, gd2, fileinfo, hash, iconv, mbstring, mysqli (or other database driver), session, simplexml, tokenizer, xml. * Recommended configuration safe_mode = Off From a91a4bbdc245bdf4435a56b62ac83d45a4799fd4 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Wed, 12 Feb 2014 15:37:59 +0000 Subject: [PATCH 2/7] FIX: Searchable fields with dot notation can be inherited from summary_fields (fixes #1429) --- model/DataObject.php | 17 ++++++++--- tests/model/DataObjectTest.php | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 4 deletions(-) diff --git a/model/DataObject.php b/model/DataObject.php index 9cbabbf02..0fd1281c0 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -3179,16 +3179,25 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity $fields = $this->stat('searchable_fields'); $labels = $this->fieldLabels(); - // fallback to summary fields - if(!$fields) { + // fallback to summary fields (unless empty array is explicitly specified) + if( ! $fields && ! is_array($fields)) { $summaryFields = array_keys($this->summaryFields()); $fields = array(); - // remove the custom getters as the search should not include. + // remove the custom getters as the search should not include them if($summaryFields) { foreach($summaryFields as $key => $name) { - if($this->hasDatabaseField($name) || $this->relObject($name)) { + $spec = $name; + + // Extract field name in case this is a method called on a field (e.g. "Date.Nice") + if(($fieldPos = strpos($name, '.')) !== false) { + $name = substr($name, 0, $fieldPos); + } + + if($this->hasDatabaseField($name)) { $fields[] = $name; + } elseif($this->relObject($spec)) { + $fields[] = $spec; } } } diff --git a/tests/model/DataObjectTest.php b/tests/model/DataObjectTest.php index 7f5688a40..bbd76436b 100644 --- a/tests/model/DataObjectTest.php +++ b/tests/model/DataObjectTest.php @@ -645,6 +645,43 @@ class DataObjectTest extends SapphireTest { 'databaseFields() on subclass contains only fields defined on instance' ); } + + public function testSearchableFields() { + $player = $this->objFromFixture('DataObjectTest_Player', 'captain1'); + $fields = $player->searchableFields(); + $this->assertArrayHasKey( + 'IsRetired', + $fields, + 'Fields defined by $searchable_fields static are correctly detected' + ); + $this->assertArrayHasKey( + 'ShirtNumber', + $fields, + 'Fields defined by $searchable_fields static are correctly detected' + ); + + $team = $this->objFromFixture('DataObjectTest_Team', 'team1'); + $fields = $team->searchableFields(); + $this->assertArrayHasKey( + 'Title', + $fields, + 'Fields can be inherited from the $summary_fields static, including methods called on fields' + ); + $this->assertArrayHasKey( + 'Captain.ShirtNumber', + $fields, + 'Fields on related objects can be inherited from the $summary_fields static' + ); + $this->assertArrayHasKey( + 'Captain.FavouriteTeam.Title', + $fields, + 'Fields on related objects can be inherited from the $summary_fields static' + ); + + $testObj = new DataObjectTest_Fixture(); + $fields = $testObj->searchableFields(); + $this->assertEmpty($fields); + } public function testDataObjectUpdate() { /* update() calls can use the dot syntax to reference has_one relations and other methods that return @@ -1191,6 +1228,11 @@ class DataObjectTest_Player extends Member implements TestOnly { private static $belongs_many_many = array( 'Teams' => 'DataObjectTest_Team' ); + + private static $searchable_fields = array( + 'IsRetired', + 'ShirtNumber' + ); } class DataObjectTest_Team extends DataObject implements TestOnly { @@ -1220,6 +1262,12 @@ class DataObjectTest_Team extends DataObject implements TestOnly { ) ); + private static $summary_fields = array( + 'Title.UpperCase' => 'Title', + 'Captain.ShirtNumber' => 'Captain\'s shirt number', + 'Captain.FavouriteTeam.Title' => 'Captain\'s favourite team' + ); + private static $default_sort = '"Title"'; public function MyTitle() { @@ -1251,6 +1299,13 @@ class DataObjectTest_Fixture extends DataObject implements TestOnly { 'MyFieldWithDefault' => 'Default Value', ); + private static $summary_fields = array( + 'Data' => 'Data', + 'DateField.Nice' => 'Date' + ); + + private static $searchable_fields = array(); + public function populateDefaults() { parent::populateDefaults(); From 0077e2535207bb66f6f6af2be399b23bf81284d6 Mon Sep 17 00:00:00 2001 From: Stig Lindqvist Date: Mon, 17 Feb 2014 11:09:29 +1300 Subject: [PATCH 3/7] BUG: Director::test() don't respect port settings in $_FILE_TO_URL_MAPPING Director::test() don't set the HTTP_HOST with the port number if that has been set. Later call to Director::makeRelative() will return wrong value because of the strict string matching (http://localhost/ != http://localhost:8000) This bug affects all modules that are using Director::test in CLI where the $_FILE_TO_URL_MAPPING have been set to use a domain with a port in it, i.e. static publishers. --- control/Director.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/control/Director.php b/control/Director.php index 6a2beb744..3ea35b395 100644 --- a/control/Director.php +++ b/control/Director.php @@ -247,7 +247,13 @@ class Director implements TemplateGlobalProvider { // Handle absolute URLs if (@parse_url($url, PHP_URL_HOST) != '') { $bits = parse_url($url); - $_SERVER['HTTP_HOST'] = $bits['host']; + // If a port is mentioned in the absolute URL, be sure to add that into the + // HTTP host + if(isset($bits['port'])) { + $_SERVER['HTTP_HOST'] = $bits['host'].':'.$bits['port']; + } else { + $_SERVER['HTTP_HOST'] = $bits['host']; + } $url = Director::makeRelative($url); } From 53a699527ed852674cff794e2b8ef93707029e7a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 18 Feb 2014 11:44:08 +1300 Subject: [PATCH 4/7] Preliminary 3.1.3 changelog --- docs/en/changelogs/3.1.3.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docs/en/changelogs/3.1.3.md diff --git a/docs/en/changelogs/3.1.3.md b/docs/en/changelogs/3.1.3.md new file mode 100644 index 000000000..7cb25627a --- /dev/null +++ b/docs/en/changelogs/3.1.3.md @@ -0,0 +1,16 @@ +# 3.1.3 + +## Overview + + * Better loading performance when using multiple `UploadField` instances + * Option for `force_js_to_bottom` on `Requirements` class (ignoring inline `