Allow non-interactive running of bookstack:cleanup-images command #4203

Closed
opened 2026-02-05 08:13:49 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @tipuraneo on GitHub (Sep 13, 2023).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

Hello, I am trying to to automate cleanup of unused images. According to the documentation
https://www.bookstackapp.com/docs/admin/commands/#cleanup-unused-images
and the help command

root@bookstack:/var/www/bookstack# php artisan bookstack:cleanup-images --help
Description:
  Cleanup images and drawings

Usage:
  bookstack:cleanup-images [options]

Options:
  -a, --all             Also delete images that are only used in old revisions
  -f, --force           Actually run the deletions, Defaults to a dry-run
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug`

this should be

root@bookstack:/var/www/bookstack# php artisan bookstack:cleanup-images --all --force --no-interaction

But it endet up without any useful output no with cleaned up unused images:

root@bookstack:/var/www/bookstack# php artisan bookstack:cleanup-images --all --force --no-interaction
This operation is destructive and is not guaranteed to be fully accurate.
Ensure you have a backup of your images.

root@bookstack:/var/www/bookstack#

How can I automate it?
Kind Regards

Exact BookStack Version

23.08.02

Log Content

No response

Hosting Environment

root@bookstack:/var/www/bookstack# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy
Originally created by @tipuraneo on GitHub (Sep 13, 2023). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario Hello, I am trying to to automate cleanup of unused images. According to the documentation https://www.bookstackapp.com/docs/admin/commands/#cleanup-unused-images and the help command ``` root@bookstack:/var/www/bookstack# php artisan bookstack:cleanup-images --help Description: Cleanup images and drawings Usage: bookstack:cleanup-images [options] Options: -a, --all Also delete images that are only used in old revisions -f, --force Actually run the deletions, Defaults to a dry-run -h, --help Display help for the given command. When no command is given display help for the list command -q, --quiet Do not output any message -V, --version Display this application version --ansi|--no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question --env[=ENV] The environment the command should run under -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug` ``` this should be ``` root@bookstack:/var/www/bookstack# php artisan bookstack:cleanup-images --all --force --no-interaction ``` But it endet up without any useful output no with cleaned up unused images: ``` root@bookstack:/var/www/bookstack# php artisan bookstack:cleanup-images --all --force --no-interaction This operation is destructive and is not guaranteed to be fully accurate. Ensure you have a backup of your images. root@bookstack:/var/www/bookstack# ``` How can I automate it? Kind Regards ### Exact BookStack Version 23.08.02 ### Log Content _No response_ ### Hosting Environment ``` root@bookstack:/var/www/bookstack# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.2 LTS Release: 22.04 Codename: jammy ```
OVERLORD added the 🐛 Bug🏭 Back-End labels 2026-02-05 08:13:49 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Sep 14, 2023):

Hi @tipuraneo,
Looks like we're not properly supporting --no-interaction along with the --force option.
I'll recategorize this as a bug to be fixed for the next feature release.

@ssddanbrown commented on GitHub (Sep 14, 2023): Hi @tipuraneo, Looks like we're not properly supporting `--no-interaction` along with the `--force` option. I'll recategorize this as a bug to be fixed for the next feature release.
Author
Owner

@ssddanbrown commented on GitHub (Sep 14, 2023):

I've now addressed this within dfaf6f7c13, including a test to cover, which will be part of the next feature release.

@ssddanbrown commented on GitHub (Sep 14, 2023): I've now addressed this within dfaf6f7c13e5cee904a43f9e8ad3777ca512fac0, including a test to cover, which will be part of the next feature release.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4203