Occ files:scan --all and occ files:cleanup doesn't seems to check ldap user's data

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 20.0.6
Operating system and version (eg, Ubuntu 20.04): Linux 5.4.80-gentoo-r1
Apache or nginx version (eg, Apache 2.4.25): nginx-1.18.0-r2
PHP version (eg, 7.4): php-7.4.14

The issue you are facing:
I use the ldap backend for authentication. When i try to run:
sudo -u nginx php occ files:scan --all
it only apply to the users registered in the nextcloud db, not for the ldap users.
The result is:

Starting scan for user 1 out of 1 (admin)
| Folders | Files | Elapsed time |
| 8       | 19    | 00:00:02     |

and (the total number of users)

sudo -u nginx php ./occ user:list | wc -l

The funny thing is that:
sudo -u nginx php occ files:scan myldap_user_id
works like a charm.
I suspect the same behaviour for:

sudo -u nginx php occ files:cleanup

The trouble is that my oc_filecache contains a lot of outdated entries that i wish to get rid of…
Any idea ? Is this a bug or am i missing something ?

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. sudo -u nginx php occ files:scan --all

The output of your Nextcloud log in Admin > Logging:

Nothing special
My config file
$CONFIG = array (
  'instanceid' => 'XXXXXXXX',
  'passwordsalt' => 'XXXXXXXXXX',
  'trusted_domains' =>
  array (
  'datadirectory' => '/ROOT/nextcloud/data',
  'overwrite.cli.url' => 'URL',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'XXXXXXXXXX',
  'dbpassword' => 'XXXXXXXXXXXXXXxx',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'ldapUserCleanupInterval' => 60,
  'mail_from_address' => 'admin_cloud',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => 'XXXXXXXXXXXx',
  'maintenance' => false,
  'theme' => '',
  'debug' => false,
  'loglevel' => 2,
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud.log',
  'logfilemode' => 416,
  'log_query' => false,
  'logtimezone' => 'Europe/Paris',
  'updater.release.channel' => 'stable',
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'password' => 'XXXXXXXXXXXXXXXXXXX',
    'dbindex' => 0,
    'timeout' => 1.5,
  'mail_sendmailmode' => 'pipe',
  'app.mail.imap.timeout' => 30,
  'app.mail.smtp.timeout' => 5,
  'mysql.utf8mb4' => true,
  'app_install_overwrite' =>
  array (
    0 => 'social',
    1 => 'ransomware_detection',
  'encryption.legacy_format_support' => false,

The output of your Apache/nginx/system log in /var/log/____:

Nothing special in the logs