Ejemplo n.º 1
0
 public static function init($root)
 {
     if (self::$defaultInstance) {
         return false;
     }
     self::$defaultInstance = new OC_FilesystemView($root);
     //load custom mount config
     if (is_file(OC::$SERVERROOT . '/config/mount.php')) {
         $mountConfig = (include OC::$SERVERROOT . '/config/mount.php');
         if (isset($mountConfig['global'])) {
             foreach ($mountConfig['global'] as $mountPoint => $options) {
                 self::mount($options['class'], $options['options'], $mountPoint);
             }
         }
         if (isset($mountConfig['group'])) {
             foreach ($mountConfig['group'] as $group => $mounts) {
                 if (OC_Group::inGroup(OC_User::getUser(), $group)) {
                     foreach ($mounts as $mountPoint => $options) {
                         $mountPoint = self::setUserVars($mountPoint);
                         foreach ($options as &$option) {
                             $option = self::setUserVars($option);
                         }
                         self::mount($options['class'], $options['options'], $mountPoint);
                     }
                 }
             }
         }
         if (isset($mountConfig['user'])) {
             foreach ($mountConfig['user'] as $user => $mounts) {
                 if ($user === 'all' or strtolower($user) === strtolower(OC_User::getUser())) {
                     foreach ($mounts as $mountPoint => $options) {
                         $mountPoint = self::setUserVars($mountPoint);
                         foreach ($options as &$option) {
                             $option = self::setUserVars($option);
                         }
                         self::mount($options['class'], $options['options'], $mountPoint);
                     }
                 }
             }
         }
         $mtime = filemtime(OC::$SERVERROOT . '/config/mount.php');
         $previousMTime = OC_Appconfig::getValue('files', 'mountconfigmtime', 0);
         if ($mtime > $previousMTime) {
             //mount config has changed, filecache needs to be updated
             OC_FileCache::triggerUpdate();
             OC_Appconfig::setValue('files', 'mountconfigmtime', $mtime);
         }
     }
     self::$loaded = true;
 }
Ejemplo n.º 2
0
 public static function init($root)
 {
     if (self::$defaultInstance) {
         return false;
     }
     self::$defaultInstance = new OC_FilesystemView($root);
     //load custom mount config
     if (is_file(OC::$SERVERROOT . '/config/mount.php')) {
         $mountConfig = (include OC::$SERVERROOT . '/config/mount.php');
         if (isset($mountConfig['global'])) {
             foreach ($mountConfig['global'] as $mountPoint => $options) {
                 self::mount($options['class'], $options['options'], $mountPoint);
             }
         }
         if (isset($mountConfig['group'])) {
             foreach ($mountConfig['group'] as $group => $mounts) {
                 if (OC_Group::inGroup(OC_User::getUser(), $group)) {
                     foreach ($mounts as $mountPoint => $options) {
                         $mountPoint = self::setUserVars($mountPoint);
                         foreach ($options as &$option) {
                             $option = self::setUserVars($option);
                         }
                         self::mount($options['class'], $options['options'], $mountPoint);
                     }
                 }
             }
         }
         if (isset($mountConfig['user'])) {
             foreach ($mountConfig['user'] as $user => $mounts) {
                 if ($user === 'all' or strtolower($user) === strtolower(OC_User::getUser())) {
                     foreach ($mounts as $mountPoint => $options) {
                         $mountPoint = self::setUserVars($mountPoint);
                         foreach ($options as &$option) {
                             $option = self::setUserVars($option);
                         }
                         self::mount($options['class'], $options['options'], $mountPoint);
                     }
                 }
             }
         }
     }
     self::$loaded = true;
 }
Ejemplo n.º 3
0
 public static function init($root, $user = '')
 {
     if (self::$defaultInstance) {
         return false;
     }
     self::$defaultInstance = new OC_FilesystemView($root);
     //load custom mount config
     if (!isset($user)) {
         $user = OC_User::getUser();
     }
     self::loadSystemMountPoints($user);
     self::$loaded = true;
 }