nextcloud / nextcloud/previewgenerator

disabling the background job does not disable the preview generation in `cron.php`

Open
#676 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
520
Forks
55
PR merge metrics
No merged PRs in 30d

Description

The README.md recommends to disable the default background job in case a custom system cron entry with occ preview:pre-generate is configured. I have a systemd-service which runs every 10 minutes occ preview:pre-generate - so I disabled the default background job with:

occ config:app:set --value=true --type=boolean previewgenerator job_disabled

Despite that, when I upload a picture to my Nextcloud 33.0.9 the background job from cron.php still creates a preview (if it runs before the occ preview:pre-generate systemd-service).

Steps to reproduce
  1. make sure the background job is disabled
  2. verify the preview-queue is empty
  3. upload a picture right after a run of the systemd-service occ preview:pre-generate
  4. verify that there is now a picture in the preview-queue
  5. run cron.php
  6. the background job of cron.php sends the picture to imaginary and creates a preview

The terminal output below reflects these steps.

Expected behaviour

the background job to create previews in cron.php should be disabled

Actual behaviour

the background job to create previews in cron.php should be disabled

Server configuration

Nextcloud 33.0.9 with previewgenerator app enabled and configured
Imaginary set up

I don't think that more details are needed, but I'll happily provide the configs if needed.

**Webserver:** nginx

Database: MariaDB

PHP version: 8.4

Nextcloud version: 33.0.9

Operating system: Debian Trixie

Terminal for the steps described before:
user@host:~# mysql -e "SELECT * FROM nextcloud.oc_appconfig WHERE appid = 'previewgenerator' AND configkey = 'job_disabled';"
+------------------+--------------+-------------+------+------+
| appid            | configkey    | configvalue | type | lazy |
+------------------+--------------+-------------+------+------+
| previewgenerator | job_disabled | 1           |   32 |    0 |
+------------------+--------------+-------------+------+------+
user@host:~# occ preview:queue-stats
+-----------------------+-----------------+
| Age                   | Queued previews |
+-----------------------+-----------------+
| Less than 10 minutes  | 0               |
| Less than 30 minutes  | 0               |
| Less than one hour    | 0               |
| Less than three hours | 0               |
| Less than a day       | 0               |
| Less than a week      | 0               |
| All                   | 0               |
+-----------------------+-----------------+
user@host:~# occ preview:queue-stats
+-----------------------+-----------------+
| Age                   | Queued previews |
+-----------------------+-----------------+
| Less than 10 minutes  | 1               |
| Less than 30 minutes  | 1               |
| Less than one hour    | 1               |
| Less than three hours | 1               |
| Less than a day       | 1               |
| Less than a week      | 1               |
| All                   | 1               |
+-----------------------+-----------------+
user@host:~# date; sudo -u www-data php -f /media/ssd/nginx/bc.dedyn.io/cron.php
Sat Sep 12 08:58:11 PM CEST 2026

user@host:~# journalctl -n 10
Sep 12 20:57:19 host sudo[3197]:     root : TTY=pts/0 ; PWD=/root ; USER=www-data ; COMMAND=/usr/bin/php /nextcloud/occ preview:queue-stats
Sep 12 20:57:19 host sudo[3197]: pam_unix(sudo:session): session opened for user www-data(uid=33) by root(uid=0)
Sep 12 20:57:19 host sudo[3197]: pam_unix(sudo:session): session closed for user www-data
Sep 12 20:57:34 host sudo[3215]:     root : TTY=pts/0 ; PWD=/root ; USER=www-data ; COMMAND=/usr/bin/php /nextcloud/occ preview:queue-stats
Sep 12 20:57:34 host sudo[3215]: pam_unix(sudo:session): session opened for user www-data(uid=33) by root(uid=0)
Sep 12 20:57:35 host sudo[3215]: pam_unix(sudo:session): session closed for user www-data
Sep 12 20:58:11 host sudo[3226]:     root : TTY=pts/0 ; PWD=/root ; USER=www-data ; COMMAND=/usr/bin/php -f /nextcloud/cron.php
Sep 12 20:58:11 host sudo[3226]: pam_unix(sudo:session): session opened for user www-data(uid=33) by root(uid=0)
Sep 12 20:58:11 host imaginary[868]: 127.0.0.1 - - [12/Sep/2026 18:58:11] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22[...]
Sep 12 20:58:11 host sudo[3226]: pam_unix(sudo:session): session closed for user www-data
user@host:~# 

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with cron.php and the README.md section describing previewgenerator job_disabled, then trace how the cron background job reads that setting. Reproduce with preview:queue-stats, an uploaded picture, and cron.php while the setting is enabled. Done means cron.php no longer creates or processes a preview when the default job is disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.