Remove root option from Google Drive storage, because it is only used for testing and we have our own empty Google account for testing

This commit is contained in:
Michael Gapczynski 2013-07-23 10:50:14 -04:00
parent 00e2b46017
commit c904504365
2 changed files with 8 additions and 10 deletions

View File

@ -53,7 +53,6 @@ class Google extends \OC\Files\Storage\Common {
$client->setUseObjects(true); $client->setUseObjects(true);
$client->setAccessToken($params['token']); $client->setAccessToken($params['token']);
$this->service = new \Google_DriveService($client); $this->service = new \Google_DriveService($client);
$this->root = isset($params['root']) ? $params['root'] : '';
$token = json_decode($params['token'], true); $token = json_decode($params['token'], true);
$this->id = 'google::'.substr($params['client_id'], 0, 30).$token['created']; $this->id = 'google::'.substr($params['client_id'], 0, 30).$token['created'];
} else { } else {
@ -72,7 +71,7 @@ class Google extends \OC\Files\Storage\Common {
*/ */
private function getDriveFile($path) { private function getDriveFile($path) {
// Remove leading and trailing slashes // Remove leading and trailing slashes
$path = trim($this->root.$path, '/'); $path = trim($path, '/');
if (isset($this->driveFiles[$path])) { if (isset($this->driveFiles[$path])) {
return $this->driveFiles[$path]; return $this->driveFiles[$path];
} else if ($path === '') { } else if ($path === '') {
@ -138,7 +137,7 @@ class Google extends \OC\Files\Storage\Common {
* @param Google_DriveFile|false $file * @param Google_DriveFile|false $file
*/ */
private function setDriveFile($path, $file) { private function setDriveFile($path, $file) {
$path = trim($this->root.$path, '/'); $path = trim($path, '/');
$this->driveFiles[$path] = $file; $this->driveFiles[$path] = $file;
if ($file === false) { if ($file === false) {
// Set all child paths as false // Set all child paths as false
@ -205,7 +204,7 @@ class Google extends \OC\Files\Storage\Common {
} }
public function rmdir($path) { public function rmdir($path) {
if (trim($this->root.$path, '/') === '') { if (trim($path, '/') === '') {
$dir = $this->opendir($path); $dir = $this->opendir($path);
while ($file = readdir($dir)) { while ($file = readdir($dir)) {
if (!\OC\Files\Filesystem::isIgnoredDir($file)) { if (!\OC\Files\Filesystem::isIgnoredDir($file)) {

View File

@ -24,12 +24,11 @@ return array(
'root'=>'/owncloud/files/webdav.php', 'root'=>'/owncloud/files/webdav.php',
), ),
'google'=>array( 'google'=>array(
'run'=>false, 'run'=> false,
'consumer_key'=>'anonymous', 'configured' => 'true',
'consumer_secret'=>'anonymous', 'client_id' => '',
'token'=>'test', 'client_secret' => '',
'token_secret'=>'test', 'token' => '',
'root'=>'/google',
), ),
'swift'=>array( 'swift'=>array(
'run'=>false, 'run'=>false,