Upgrading to 12.0.4 has uninstalled NextCloud?!

Nextcloud version (eg, 12.0.2): 12.0.4.3
Operating system and version (eg, Ubuntu 17.04): Raspbian GNU/Linux 9.3
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.25 (Raspbian)
PHP version (eg, 7.1): 7.0.19-1

The issue you are facing:

Have just run the web updater app like I have done many times. The process seemed to have gone well with green ticks next to every step, and when presented with the “keep maintenance mode active” options, I selected “no”. The final “done” step then appeared with a red cross next to it. It didn’t do anything else so I refreshed the page, which then took me straight to the initial setup page (create an admin account, data folder, configure the database, etc), and that’s what I see whenever I browse to nextcloud. This is obviously not what I should be seeing so something has clearly gone wrong with the update process.

On the server command line, if I run sudo -u www-data php occ status, I get:

  - installed: false
  - version: 12.0.4.3
  - versionstring: 12.0.4
  - edition:

I’m now worried that I’ve lost all of my data! Is this problem easily rectifiable or can I somehow restore the backup that the web updater takes? Please help!

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

Steps to replicate it:

  1. Run web updater for 12.0.4

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'ocmi4h192j8j',
);

The output of nextcloud error.log (only entry on the same day):

[Tue Jan 23 22:58:49.070085 2018] [proxy_fcgi:error] [pid 19423:tid 1985094704] [client 192.168.1.7:51659] AH01071: Got error 'PHP message: PHP Notice:  Undefined index: datadirectory in /var/www/nextcloud/updater/index.php on line 283\n'