+
+ /**
+ * @brief Create dirctory tree to store file, with .htaccess and index.html files
+ * @param string $file Path and filename
+ */
+ private static function createFoldersForFile($file)
+ {
+ $path = dirname($file);
+
+ if (!is_dir($path)) {
+ if (!mkdir($path, 0770, true)) {
+ Logger::log("Failed to create dirs {$path}");
+ echo L10n::t("Filesystem storage failed to create '%s'. Check you write permissions.", $path);
+ killme();
+ }
+ }
+
+ $base = self::getBasePath();
+
+ while ($path !== $base) {
+ if (!is_file($path . "/index.html")) {
+ file_put_contents($path . "/index.html", "");
+ }
+ $path = dirname($path);
+ }
+ if (!is_file($path . "/index.html")) {
+ file_put_contents($path . "/index.html", "");
+ }
+ }
+