]> source.dussan.org Git - nextcloud-server.git/commitdiff
Update old storage classes names to the new namespace during mounting
authorMichael Gapczynski <mtgap@owncloud.com>
Thu, 3 Jan 2013 17:07:04 +0000 (12:07 -0500)
committerMichael Gapczynski <mtgap@owncloud.com>
Thu, 3 Jan 2013 17:07:04 +0000 (12:07 -0500)
apps/files_external/lib/config.php
lib/files/filesystem.php

index 323e4060a43fd7e2706968d6813425edd8490af3..d7286c52c02cbc7d161b75a4177a116ccb485eb3 100755 (executable)
@@ -120,6 +120,10 @@ class OC_Mount_Config {
                if (isset($mountPoints[self::MOUNT_TYPE_GROUP])) {
                        foreach ($mountPoints[self::MOUNT_TYPE_GROUP] as $group => $mounts) {
                                foreach ($mounts as $mountPoint => $mount) {
+                                       // Update old classes to new namespace
+                                       if (strpos($mount['class'], 'OC_Filestorage_') !== false) {
+                                               $mount['class'] = '\OC\Files\Storage\\'.substr($mount['class'], 15, strlen($mount['class']) - 15);
+                                       }
                                        // Remove '/$user/files/' from mount point
                                        $mountPoint = substr($mountPoint, 13);
                                        // Merge the mount point into the current mount points
@@ -139,6 +143,10 @@ class OC_Mount_Config {
                if (isset($mountPoints[self::MOUNT_TYPE_USER])) {
                        foreach ($mountPoints[self::MOUNT_TYPE_USER] as $user => $mounts) {
                                foreach ($mounts as $mountPoint => $mount) {
+                                       // Update old classes to new namespace
+                                       if (strpos($mount['class'], 'OC_Filestorage_') !== false) {
+                                               $mount['class'] = '\OC\Files\Storage\\'.substr($mount['class'], 15, strlen($mount['class']) - 15);
+                                       }
                                        // Remove '/$user/files/' from mount point
                                        $mountPoint = substr($mountPoint, 13);
                                        // Merge the mount point into the current mount points
@@ -169,6 +177,10 @@ class OC_Mount_Config {
                $personal = array();
                if (isset($mountPoints[self::MOUNT_TYPE_USER][$uid])) {
                        foreach ($mountPoints[self::MOUNT_TYPE_USER][$uid] as $mountPoint => $mount) {
+                               // Update old classes to new namespace
+                               if (strpos($mount['class'], 'OC_Filestorage_') !== false) {
+                                       $mount['class'] = '\OC\Files\Storage\\'.substr($mount['class'], 15, strlen($mount['class']) - 15);
+                               }
                                // Remove '/uid/files/' from mount point
                                $personal[substr($mountPoint, strlen($uid) + 8)] = array('class' => $mount['class'],
                                                                                                                                'backend' => $backends[$mount['class']]['backend'],
index 8183b8ff99cbcad506a1b2f1b37696c137d0832a..b9fd6a03762eadb4bfb1cfdf2f25444964947367 100644 (file)
@@ -364,7 +364,10 @@ class Filesystem {
                if (strlen($mountpoint) > 1) {
                        $mountpoint .= '/';
                }
-
+               // Update old classes to new namespace
+               if (strpos($class, 'OC_Filestorage_') !== false) {
+                       $class = '\OC\Files\Storage\\'.substr($class, 15, strlen($class) - 15);
+               }
                if ($class instanceof \OC\Files\Storage\Storage) {
                        self::$mounts[$mountpoint] = array('class' => get_class($class), 'arguments' => $arguments);
                        self::$storages[$mountpoint] = $class;