Nextcloud 17.0.5 Upgrade to 18.0.3 Shares dissappearing

Hey guys,

im updated our Nextcloud 17.0.5 instance on Cent Os 7 with Apache and PHP 7.1 to Nextcloud 18.0.3 on 03. April 2020.

Since this update all our shared folders in the Nextcloud are inaccessiable and lost.
I found this article:

But wondering about:
The error apperas on Updating to NC 18.0.0 and not 18.0.3.

So I just followed up with this post:
we merged oc_share , oc_mounts and oc_storages from our backup (with INSERT IGNORE ) and then scanned the files with .../occ files:scan --all

I took my backup.sql.gz from 02. April 2020, uncompressed it and copied the following SQL statements:

LOCK TABLES oc_share WRITE;
/*!40000 ALTER TABLE oc_share DISABLE KEYS /;
INSERT IGNORE oc_share VALUES …;
/
!40000 ALTER TABLE oc_share ENABLE KEYS */;
UNLOCK TABLES;

LOCK TABLES oc_mounts WRITE;
/*!40000 ALTER TABLE oc_mounts DISABLE KEYS /;
INSERT IGNORE oc_mounts VALUES …;
/
!40000 ALTER TABLE oc_mounts ENABLE KEYS */;
UNLOCK TABLES;

LOCK TABLES oc_storages WRITE;
/*!40000 ALTER TABLE oc_storages DISABLE KEYS /;
INSERT IGNORE oc_storages VALUES…;
/
!40000 ALTER TABLE oc_storages ENABLE KEYS */;
UNLOCK TABLES;

The MySQL Import is running fine wihtout any errors.
If im running the following command on Nextcloud OCC
cd /var/www/html/nextcloud
sudo -u apache occ files:scan --all
The imported mysql entries from the backup are getting deleted in my mysql database.

Is there any chance to get the shared folders back?

Next problem I found:
If we are sharing now folders on the Nextcloud 18.0.3 release we just can add 10 users to the share…not more.
Any ideas?

How did you upgrade with PHP 7.1 to 18.0.x. You should have seen an error, like “This version of Nextcloud requires at least PHP 7.2
You are currently running 7.1…”, no? But nonetheless this is probably not the cause of the issue.

Also since those steps in the linked issue worked for those guys and not for you perhaps it is something else?

Looking at the code base, the only thing I can see that would account for these rows being deleted in an upgrade to 18.0.3 is DeleteOrphanedSharesJob which will delete rows without a corresponding fileid in oc_filecache. If the cache was truncated and rebuilt from data directory at some point during or after upgrade for whatever reason then maybe this could happen? What about including oc_filecache in the process you are trying above?

To confirm if maybe this is the issue, you can also look at the oc_filecache.fileid vs imported oc_share.file_source in the DB and/or turn debugging on config ('loglevel' => 0) then look in log for anything around DeleteOrphanedSharesJob.

If this isn’t issue the debugging may give more of a hint? I’m not sure. Hopefully this helps otherwise maybe someone else will have an idea.