Skip to content

Commit 4c50139

Browse files
authored
Merge pull request #26 from opendata-swiss/ckan-210-resolve-merge-conflicts
Latest changes from ogdch-commands back into CKAN 2.10 compatible version
2 parents 819c211 + 7753346 commit 4c50139

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,17 @@ It also comes with a dryrun option.
4141
ckan -c /var/www/ckan/development.ini ogdch cleanup_resources
4242
```
4343

44-
## Command to clean up the package extra table.
44+
### Command to cleanup resource-files from the filestore.
45+
When a resource gets deleted will be marked as deleted in the database and also its associated file in the CKAN-FileStore won't be deleted.
46+
This command finds these orphaned files by checking whether their corresponding resource still exists.
47+
It is meant to be run regularly by a cronjob.
48+
It also comes with a dryrun option.
49+
50+
```bash
51+
paster --plugin=ckanext-ogdchcommands ogdch cleanup_filestore -c /var/www/ckan/development.ini
52+
```
53+
54+
## Command to cleanup the package extra table.
4555
When a key is no longer needed in the package_extra table, since it is no longer part of the dataset,
4656
then after the data have been migrated that old key can be removed from the package_extra table
4757
and from the dependent table package_extra_revision.

ckanext/ogdchcommands/logic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ def ogdch_cleanup_filestore(context, data_dict):
233233
filepaths = []
234234
errors = []
235235

236-
for subdir, dirs, files in os.walk(storage_path):
236+
for subdir, dirs, files in os.walk(resource_path):
237237
for file in files:
238238
fullpath = os.path.join(subdir, file)
239-
relpath = os.path.relpath(fullpath, storage_path)
239+
relpath = os.path.relpath(fullpath, resource_path)
240240
resource_id = get_resource_id(relpath)
241241

242242
tk.check_access("resource_show", context, {"id": resource_id})

0 commit comments

Comments
 (0)