***
Wartungsfenster jeden ersten Mittwoch vormittag im Monat
***
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Invenio Utilities TUW
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Center for Research Data Management
Invenio Utilities TUW
Commits
81a73693
Commit
81a73693
authored
4 years ago
by
Moser, Maximilian
Browse files
Options
Downloads
Patches
Plain Diff
Update docs and command names for some files commands
parent
423d5ca0
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!2
Modernization
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
invenio_utilities_tuw/cli/files.py
+9
-5
9 additions, 5 deletions
invenio_utilities_tuw/cli/files.py
with
9 additions
and
5 deletions
invenio_utilities_tuw/cli/files.py
+
9
−
5
View file @
81a73693
...
...
@@ -73,7 +73,7 @@ def deleted():
@option_pid_type
@with_appcontext
def
list_deleted_files
(
pid
,
pid_type
):
"""
Hard-delete
files that have already been soft-deleted.
"""
List
files that have already been soft-deleted.
Optionally, this operation can be restricted to the bucket associated with a draft
(via its PID).
...
...
@@ -103,7 +103,7 @@ def list_deleted_files(pid, pid_type):
db
.
session
.
commit
()
@deleted.command
(
"
rm
"
)
@deleted.command
(
"
clean
"
)
@click.confirmation_option
(
prompt
=
"
are you sure you want to permanently remove soft-deleted files?
"
)
...
...
@@ -150,13 +150,17 @@ def hard_delete_files(pid, pid_type):
@files.group
(
"
orphans
"
)
def
orphans
():
"""
Management commands for orphaned files.
"""
"""
Management commands for unreferenced files.
Orphaned files are those that are still present in the storage, but are not
referenced by any Location
'
s buckets anymore.
"""
@orphans.command
(
"
list
"
)
@with_appcontext
def
list_orphan_files
():
"""
List
files from location
s that aren
'
t referenced in
any DB models
anymore.
"""
"""
List
existing file
s that aren
'
t referenced in
Invenio
anymore.
"""
for
loc
in
Location
.
query
.
all
():
# we only know how to handle directories on the file system for now
if
os
.
path
.
isdir
(
loc
.
uri
):
...
...
@@ -177,7 +181,7 @@ def list_orphan_files():
)
@with_appcontext
def
clean_files
():
"""
List files from location
s that aren
'
t referenced in
any DB models
anymore.
"""
"""
Delete existing file
s that aren
'
t referenced in
Invenio
anymore.
"""
for
loc
in
Location
.
query
.
all
():
# we only know how to handle directories on the file system for now
if
not
os
.
path
.
isdir
(
loc
.
uri
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment