diff --git a/_config.php b/_config.php index b7e7c67..6d7e5db 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 = substr($config->get('DMS', 'folder_name'), 7); + $config->update('Filesystem', 'sync_blacklisted_patterns', array("/^" . $folderName . "$/i",)); +} 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); + } }