Strange Error: Class OCA ThemingController does not exist

Still having this issues every now and then (3 time in a row now). Probably after Watchtower updated the Container. At least, last time, 3 Minutes after Watchtower updated Nextcloud…

Date: Fri, 06 Sep 2024 04:31:23 +0000
Found new nextcloud:latest image (d87b10170d75)
Stopping /nextcloud (a6d05baf07f1) with SIGTERM
Creating /nextcloud

… Uptime Kuma got an error:

(GMT vs. CEST)

Im fixing this issue (because even occ doesn’t work), with this little workaround script:

#!/bin/bash

# define directories
SOURCE_DIR="/usr/src/nextcloud"
TARGET_DIR="/var/www/html"

# search for corrupted php files...
find "$TARGET_DIR" -type f -name "*.php" -exec file {} \; | grep "data$" | while read -r line; do
  # extract path from corrupted files
  corrupted_file=$(echo "$line" | cut -d: -f1)
  
  # path to correct files
  correct_file="$SOURCE_DIR${corrupted_file#$TARGET_DIR}"

  # check if correct file exists...
  if [ -f "$correct_file" ]; then
    echo "replace $corrupted_file with $correct_file"
    cp "$correct_file" "$corrupted_file"
  else
    echo "Error: couldn't find $corrupted_file ."
  fi
done

Just pasting it into the shell (without #!/bin/bash). Maybe someone else has the same problem and maybe this script helps.

Update: After running php ./occ integrity:check-core it seems like there are still some other corrupted files. Most of them are .js files. I just ran the same script as above but with ".js" files in find.*