make nextcloud create external storage

This commit is contained in:
ibizaman 2025-01-15 23:45:31 +01:00 committed by Pierre Penninckx
parent 7ebea7c5b2
commit af123bc52d
3 changed files with 32 additions and 1 deletions

View file

@ -685,7 +685,11 @@ in
# not loading to realize those scripts are inserted by extensions. Doh.
services.nextcloud = {
enable = true;
package = nextcloudPkg;
package = nextcloudPkg.overrideAttrs (old: {
patches = [
../../patches/nextcloudexternalstorage.patch
];
});
datadir = cfg.dataDir;

View file

@ -457,6 +457,12 @@ which is well suited for randomly accessing small files like thumbnails.
On the other side, a spinning hard drive can store more data
which is well suited for storing user data.
This Nextcloud module includes a patch that allows the external storage
to actually create the local path. Normally, when login in for the first time,
the user will be greeted with an error saying the external storage path does
not exist. One must then create it manually. With this patch, Nextcloud
creates the path.
### Enable OnlyOffice App {#services-nextcloudserver-usage-onlyoffice}
The following snippet installs and enables the [Only

View file

@ -0,0 +1,21 @@
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php
index 8fec24996891f..57b2980f1a43f 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -101,9 +101,13 @@ public function __construct($arguments) {
$this->unlinkOnTruncate = $this->config->getSystemValueBool('localstorage.unlink_on_truncate', false);
if (isset($arguments['isExternal']) && $arguments['isExternal'] && !$this->stat('')) {
- // data dir not accessible or available, can happen when using an external storage of type Local
- // on an unmounted system mount point
- throw new StorageNotAvailableException('Local storage path does not exist "' . $this->getSourcePath('') . '"');
+
+ if (!$this->mkdir('')) {
+ // data dir not accessible or available, can happen when using an external storage of type Local
+ // on an unmounted system mount point
+ throw new StorageNotAvailableException('Local storage path does not exist and could not create it "' . $this->getSourcePath('') . '"');
+ }
+ \OC::$server->get(LoggerInterface::class)->warning('created local storage path ' . $this->getSourcePath(''), ['app' => 'core']);
}
}