diff --git a/assets/cacheabledatasource.blueprintsdatasources.js b/assets/cacheabledatasource.blueprintsdatasources.js index 9cb0617..e9ee466 100644 --- a/assets/cacheabledatasource.blueprintsdatasources.js +++ b/assets/cacheabledatasource.blueprintsdatasources.js @@ -43,9 +43,9 @@ type: 'text', value: datasource.cache }).appendTo(label); - + // Append fieldset - Symphony.Elements.contents.find('div.actions').before(fieldset); + $('#contents div.actions').before(fieldset); }); })(window.jQuery, window.Symphony); diff --git a/extension.driver.php b/extension.driver.php index 70b3095..e781a45 100644 --- a/extension.driver.php +++ b/extension.driver.php @@ -131,12 +131,16 @@ private function __fetchSectionsFromContext($context) } // Find any associated sections for the affected section - $associatedSections = Symphony::Database()->fetch(sprintf(' - SELECT DISTINCT `child_section_id`, `parent_section_id` - FROM `tbl_sections_association` - WHERE `parent_section_id` = %1$d OR `child_section_id` = %1$d', - $affectedSection - )); + $associatedSections = Symphony::Database() + ->select(['child_section_id', 'parent_section_id']) + ->distinct() + ->from('tbl_sections_association') + ->where(['or' => [ + ['parent_section_id' => $affectedSection], + ['child_section_id' => $affectedSection], + ]]) + ->execute() + ->rows(); General::flattenArray($associatedSections); $associatedSections = array_values($associatedSections); @@ -265,7 +269,7 @@ public function dataSourcePreExecute($context) // Add an attribute to preg_replace later $xml->setAttribute("cache-age", "fresh"); - + // Add an attribute cache-expiration $xml->setAttribute("cache-expiration", $ds->dsParamCACHE); @@ -293,7 +297,7 @@ private function __buildCacheFilename($datasource, &$filename, &$file_age) { $filename = null; - + // Checks if cacheabledatasource directory exists. If not, try to restore. if (!file_exists(CACHE . '/cacheabledatasource')) { @@ -326,7 +330,7 @@ private function __buildCacheFilename($datasource, &$filename, &$file_age) if (!file_exists($filename)) { return false; } - + // Check if cache is infinite if ($datasource->dsParamCACHE === -1) { return true; @@ -455,7 +459,7 @@ public function initaliseAdminPageHead($context) } $url_context = $page->getContext(); - if (!in_array($url_context[0], array('new', 'edit'))) { + if (!in_array($url_context['action'], array('new', 'edit'))) { return; } @@ -463,8 +467,8 @@ public function initaliseAdminPageHead($context) // if editing an existing data source, instantiate the DS object // to retrieve the dsParamCACHE property if it exists - if ($url_context[0] == 'edit') { - $ds = $url_context[1]; + if ($url_context['action'] == 'edit') { + $ds = $url_context['handle']; $dsm = new DatasourceManager(Symphony::Engine()); $datasource = $dsm->create($ds, null, false); $cache = $datasource->dsParamCACHE; diff --git a/extension.meta.xml b/extension.meta.xml index 115ad36..f8b53ee 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -19,6 +19,10 @@ + + - Update for Symphony 4.x + - Code refactoring for Database and EQFA + - Code fix: Use CACHE for consistentcy (#28) @@ -31,6 +35,12 @@ - Add cache-expiration attribute in Data Source (#24) + + - Fix regression with ignored data sources (#22) + + + - PHP7 Compatibility + - Fix regression with ignored data sources (#22)