From 4bd66b9d3693492806bb4e9a512f8ae623c6a306 Mon Sep 17 00:00:00 2001 From: Patrick Nelson Date: Fri, 22 Jan 2016 13:29:44 -0500 Subject: [PATCH 1/5] FIX for #4909: Ensure RSSFeed_Entry is instantiated using the injector. --- api/RSSFeed.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api/RSSFeed.php b/api/RSSFeed.php index 22d6d704e..8aa774320 100644 --- a/api/RSSFeed.php +++ b/api/RSSFeed.php @@ -149,7 +149,7 @@ class RSSFeed extends ViewableData { if(isset($this->entries)) { foreach($this->entries as $entry) { $output->push( - new RSSFeed_Entry($entry, $this->titleField, $this->descriptionField, $this->authorField)); + RSSFeed_Entry::create($entry, $this->titleField, $this->descriptionField, $this->authorField)); } } return $output; @@ -184,7 +184,11 @@ class RSSFeed extends ViewableData { } /** - * Output the feed to the browser + * Output the feed to the browser. + * + * TODO: Pass $response object to ->outputToBrowser() to loosen dependence on global state for easier testing/prototyping so dev can inject custom SS_HTTPResponse instance. + * + * @return HTMLText */ public function outputToBrowser() { $prevState = Config::inst()->get('SSViewer', 'source_file_comments'); From f12258427afa6a0a20ea21278d9a02d9d5675567 Mon Sep 17 00:00:00 2001 From: Antony Thorpe Date: Wed, 18 May 2016 08:30:29 +1200 Subject: [PATCH 2/5] Updated 01_Data_Model_and_ORM.md for byID According to the framework's API documentation 'byID' is a method of DataList not 'byId'. Both are used in the documentation. --- docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md b/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md index 105f19879..21acfce88 100644 --- a/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md +++ b/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md @@ -150,7 +150,7 @@ shortcuts and methods for fetching, sorting and filtering data from our database $players = Player::get(); // returns a `DataList` containing all the `Player` objects. - $player = Player::get()->byId(2); + $player = Player::get()->byID(2); // returns a single `Player` object instance that has the ID of 2. echo $player->ID; From 3870c499d69811ef65fb23e708d31a9c531c413d Mon Sep 17 00:00:00 2001 From: Michael James Date: Wed, 18 May 2016 15:07:45 +0100 Subject: [PATCH 3/5] DOCS Adding comma to array declaration (#5558) --- docs/en/02_Developer_Guides/00_Model/06_SearchFilters.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en/02_Developer_Guides/00_Model/06_SearchFilters.md b/docs/en/02_Developer_Guides/00_Model/06_SearchFilters.md index e0b1f9b4c..bb7f5784f 100644 --- a/docs/en/02_Developer_Guides/00_Model/06_SearchFilters.md +++ b/docs/en/02_Developer_Guides/00_Model/06_SearchFilters.md @@ -19,13 +19,13 @@ An example of a `SearchFilter` in use: :::php // fetch any player that starts with a S $players = Player::get()->filter(array( - 'FirstName:StartsWith' => 'S' + 'FirstName:StartsWith' => 'S', 'PlayerNumber:GreaterThan' => '10' )); // to fetch any player that's name contains the letter 'z' $players = Player::get()->filterAny(array( - 'FirstName:PartialMatch' => 'z' + 'FirstName:PartialMatch' => 'z', 'LastName:PartialMatch' => 'z' )); @@ -50,4 +50,4 @@ The following is a query which will return everyone whose first name starts with ## API Documentation -* [api:SearchFilter] \ No newline at end of file +* [api:SearchFilter] From de13e107876e857784fe43a419fc59b51716c6af Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 19 May 2016 20:54:30 +1200 Subject: [PATCH 4/5] Removed branch alias which should only apply to latest release branch (#5561) See https://github.com/silverstripe/silverstripe-framework/commit/070ae2555b4b6beddec71cd2b9e54057a03e872d for similar commit when going from 3.1 to 3.2. --- composer.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/composer.json b/composer.json index 15735a7a6..fe44342ee 100644 --- a/composer.json +++ b/composer.json @@ -22,11 +22,6 @@ "require-dev": { "phpunit/PHPUnit": "~3.7" }, - "extra": { - "branch-alias": { - "3.x-dev": "3.3.x-dev" - } - }, "autoload": { "classmap": ["tests/behat/features/bootstrap"] } From 118af06c3fbe5653d9e4be359c3db34a34867d4d Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Thu, 19 May 2016 12:47:29 +0100 Subject: [PATCH 5/5] Efficiency improvement to class manifest --- core/manifest/ClassManifest.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/manifest/ClassManifest.php b/core/manifest/ClassManifest.php index 071d0aae3..b67bf501d 100644 --- a/core/manifest/ClassManifest.php +++ b/core/manifest/ClassManifest.php @@ -249,14 +249,14 @@ class SS_ClassManifest { /** * Returns an array of module names mapped to their paths. * - * "Modules" in SilverStripe are simply directories with a _config.php + * "Modules" in SilverStripe are simply directories with a _config.php * file. * * @return array */ public function getModules() { $modules = array(); - + if($this->configs) { foreach($this->configs as $configPath) { $modules[basename(dirname($configPath))] = dirname($configPath); @@ -347,8 +347,7 @@ class SS_ClassManifest { // files will have changed and TokenisedRegularExpression is quite // slow. A combination of the file name and file contents hash are used, // since just using the datetime lead to problems with upgrading. - $file = file_get_contents($pathname); - $key = preg_replace('/[^a-zA-Z0-9_]/', '_', $basename) . '_' . md5($file); + $key = preg_replace('/[^a-zA-Z0-9_]/', '_', $basename) . '_' . md5_file($pathname); if ($data = $this->cache->load($key)) { $valid = ( @@ -364,8 +363,8 @@ class SS_ClassManifest { } if (!$classes) { - $tokens = token_get_all($file); - + $tokens = token_get_all(file_get_contents($pathname)); + $classes = self::get_namespaced_class_parser()->findAll($tokens); $namespace = self::get_namespace_parser()->findAll($tokens); if($namespace) {