From f41375e608f88fff24fbfcdd3ad5b34f682478c4 Mon Sep 17 00:00:00 2001 From: Florian Thoma Date: Mon, 31 Jul 2017 18:14:04 +1000 Subject: [PATCH 1/3] add dmsassets folder to file system sync exclusion, fixes #190 --- _config.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_config.php b/_config.php index b7e7c67..a85bb98 100644 --- a/_config.php +++ b/_config.php @@ -19,3 +19,9 @@ if ($config->get('DMSDocument_versions', 'enable_versions')) { //using the same db relations for the versioned documents, as for the actual documents $config->update('DMSDocument_versions', 'db', $config->get('DMSDocument', 'db')); } + +// add dmsassets folder to file system sync exclusion +if (strpos($config->get('DMS', 'folder_name'), 'assets/') === 0) { + $folderName = str_replace('assets/', '', $config->get('DMS', 'folder_name')); + $config->update('Filesystem', 'sync_blacklisted_patterns', array("/^" . $folderName . "$/i",)); +} From 9b31a7071fd1710a4a9e4f8bac7c0689bfaad9e7 Mon Sep 17 00:00:00 2001 From: Florian Thoma Date: Mon, 31 Jul 2017 19:22:19 +1000 Subject: [PATCH 2/3] change folder extraction --- _config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.php b/_config.php index a85bb98..6d7e5db 100644 --- a/_config.php +++ b/_config.php @@ -22,6 +22,6 @@ if ($config->get('DMSDocument_versions', 'enable_versions')) { // add dmsassets folder to file system sync exclusion if (strpos($config->get('DMS', 'folder_name'), 'assets/') === 0) { - $folderName = str_replace('assets/', '', $config->get('DMS', 'folder_name')); + $folderName = substr($config->get('DMS', 'folder_name'), 7); $config->update('Filesystem', 'sync_blacklisted_patterns', array("/^" . $folderName . "$/i",)); } From b9b7be04173ea337bba26b8b6660c37062b01275 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Mon, 31 Jul 2017 21:35:46 +1200 Subject: [PATCH 3/3] Add test for exclusion of DMS folder name from Filesystem sync --- tests/DMSTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/DMSTest.php b/tests/DMSTest.php index d95b008..74c5ec8 100644 --- a/tests/DMSTest.php +++ b/tests/DMSTest.php @@ -166,4 +166,18 @@ class DMSTest extends FunctionalTest $this->assertCount(2, $sets); $this->assertContainsOnlyInstancesOf('DMSDocumentSet', $sets); } + + /** + * Ensure that assets/* folders are not included in filesystem sync operations + */ + public function testFolderExcludedFromFilesystemSync() + { + // Undo setup config changes + Config::unnest(); + Config::nest(); + + $result = Filesystem::config()->get('sync_blacklisted_patterns'); + $folderName = substr(DMS::config()->get('folder_name'), 7); + $this->assertContains('/^' . $folderName . '$/i', $result); + } }