/** * * @param string $mountPoint Mount point * @param string $mountType MOUNT_TYPE_GROUP | MOUNT_TYPE_USER * @param string $applicable User or group to remove mount from * @param bool $isPersonal Personal or system mount point * @return bool */ public static function removeMountPoint($mountPoint, $mountType, $applicable, $isPersonal = false) { // Verify that the mount point applies for the current user $relMountPoints = $mountPoint; if ($isPersonal) { if ($applicable != OCP\User::getUser()) { return false; } $mountPoint = '/' . $applicable . '/files/' . ltrim($mountPoint, '/'); } else { $mountPoint = '/$user/files/' . ltrim($mountPoint, '/'); } $mountPoint = \OC\Files\Filesystem::normalizePath($mountPoint); //从mount数据库删除数据 $mountdatabase = new \OC\Files\Mount\MountDatabase(); $res = $mountdatabase->getMountPointByUserAndStorage($applicable, $mountPoint); if (empty($res)) { return false; } else { $result = $mountdatabase->deleteMountPoint($applicable, $mountPoint); /*$mountPoints = self::readData($isPersonal ? OCP\User::getUser() : null); // Remove mount point unset($mountPoints[$mountType][$applicable][$mountPoint]); // Unset parent arrays if empty if (empty($mountPoints[$mountType][$applicable])) { unset($mountPoints[$mountType][$applicable]); if (empty($mountPoints[$mountType])) { unset($mountPoints[$mountType]); } } self::writeData($isPersonal ? OCP\User::getUser() : null, $mountPoints);*/ \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_delete_mount, array(\OC\Files\Filesystem::signal_param_path => $relMountPoints, \OC\Files\Filesystem::signal_param_mount_type => $mountType, \OC\Files\Filesystem::signal_param_users => $applicable)); //return true; return $result; } }