Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
8336b328
Commit
8336b328
authored
12 years ago
by
Benjamin Liles
Browse files
Options
Downloads
Patches
Plain Diff
Various bug fixes for swift
parent
77d91d5a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_external/lib/swift.php
+27
-11
27 additions, 11 deletions
apps/files_external/lib/swift.php
with
27 additions
and
11 deletions
apps/files_external/lib/swift.php
+
27
−
11
View file @
8336b328
...
...
@@ -39,7 +39,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
* @return string
*/
private
function
getContainerName
(
$path
)
{
$path
=
trim
(
$this
->
root
.
$path
,
'/'
);
$path
=
trim
(
trim
(
$this
->
root
,
'/'
)
.
"/"
.
$path
,
'/
.
'
);
return
str_replace
(
'/'
,
'\\'
,
$path
);
}
...
...
@@ -70,11 +70,11 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
* @return CF_Container
*/
private
function
createContainer
(
$path
)
{
if
(
$path
==
''
or
$path
==
'/'
)
{
if
(
$path
==
''
or
$path
==
'/'
or
$path
==
'.'
)
{
return
$this
->
conn
->
create_container
(
$this
->
getContainerName
(
$path
));
}
$parent
=
dirname
(
$path
);
if
(
$parent
==
''
or
$parent
==
'/'
)
{
if
(
$parent
==
''
or
$parent
==
'/'
or
$parent
==
'.'
)
{
$parentContainer
=
$this
->
rootContainer
;
}
else
{
if
(
!
$this
->
containerExists
(
$parent
))
{
...
...
@@ -100,6 +100,9 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
if
(
is_null
(
$container
))
{
return
null
;
}
else
{
if
(
$path
==
"/"
or
$path
==
''
)
{
return
null
;
}
try
{
$obj
=
$container
->
get_object
(
basename
(
$path
));
$this
->
objects
[
$path
]
=
$obj
;
...
...
@@ -135,7 +138,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
private
function
createObject
(
$path
)
{
$container
=
$this
->
getContainer
(
dirname
(
$path
));
if
(
!
is_null
(
$container
))
{
$container
=
$this
->
createContainer
(
$path
);
$container
=
$this
->
createContainer
(
dirname
(
$path
)
)
;
}
return
$container
->
create_object
(
basename
(
$path
));
}
...
...
@@ -277,7 +280,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
$this
->
conn
=
new
CF_Connection
(
$this
->
auth
);
if
(
!
$this
->
containerExists
(
$this
->
root
))
{
if
(
!
$this
->
containerExists
(
'/'
))
{
$this
->
rootContainer
=
$this
->
createContainer
(
'/'
);
}
else
{
$this
->
rootContainer
=
$this
->
getContainer
(
'/'
);
...
...
@@ -391,6 +394,9 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
}
public
function
unlink
(
$path
)
{
if
(
$this
->
containerExists
(
$path
))
{
return
$this
->
rmdir
(
$path
);
}
if
(
$this
->
objectExists
(
$path
))
{
$container
=
$this
->
getContainer
(
dirname
(
$path
));
$container
->
delete_object
(
basename
(
$path
));
...
...
@@ -401,13 +407,13 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
}
public
function
fopen
(
$path
,
$mode
)
{
$obj
=
$this
->
getObject
(
$path
);
if
(
is_null
(
$obj
))
{
return
false
;
}
switch
(
$mode
)
{
case
'r'
:
case
'rb'
:
$obj
=
$this
->
getObject
(
$path
);
if
(
is_null
(
$obj
))
{
return
false
;
}
$fp
=
fopen
(
'php://temp'
,
'r+'
);
$obj
->
stream
(
$fp
);
...
...
@@ -440,7 +446,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
}
public
function
free_space
(
$path
)
{
return
0
;
return
1024
*
1024
*
1024
*
8
;
}
public
function
touch
(
$path
,
$mtime
=
null
)
{
...
...
@@ -481,7 +487,17 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
}
public
function
stat
(
$path
)
{
$container
=
$this
->
getContainer
(
$path
);
if
(
!
is_null
(
$container
))
{
return
array
(
'mtime'
=>-
1
,
'size'
=>
$container
->
bytes_used
,
'ctime'
=>-
1
);
}
$obj
=
$this
->
getObject
(
$path
);
if
(
is_null
(
$obj
))
{
return
false
;
}
...
...
@@ -505,7 +521,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
$obj
->
save_to_filename
(
$tmpFile
);
return
$tmpFile
;
}
else
{
return
false
;
return
OCP\Files
::
tmpFile
()
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment