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
f3627a75
Commit
f3627a75
authored
14 years ago
by
Aldo "xoen" Giambelluca
Browse files
Options
Downloads
Patches
Plain Diff
Using DB table prefix in 'inc/HTTP/WebDAV/Server/Filesyste.php'
parent
78cc98e4
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
inc/HTTP/WebDAV/Server/Filesystem.php
+29
-13
29 additions, 13 deletions
inc/HTTP/WebDAV/Server/Filesystem.php
with
29 additions
and
13 deletions
inc/HTTP/WebDAV/Server/Filesystem.php
+
29
−
13
View file @
f3627a75
...
...
@@ -150,6 +150,9 @@
*/
function
fileinfo
(
$path
)
{
global
$CONFIG_DBTABLEPREFIX
;
$dbTableProperties
=
$CONFIG_DBTABLEPREFIX
.
'properties'
;
// map URI path to filesystem path
$fspath
=
$path
;
...
...
@@ -183,7 +186,7 @@
$info
[
"props"
][]
=
$this
->
mkprop
(
"getcontentlength"
,
OC_FILESYSTEM
::
filesize
(
$fspath
));
}
// get additional properties from database
$query
=
"SELECT ns, name, value FROM
p
roperties WHERE path = '
$path
'"
;
$query
=
"SELECT ns, name, value FROM
$dbTableP
roperties
WHERE path = '
$path
'"
;
$res
=
OC_DB
::
select
(
$query
);
while
(
$row
=
$res
[
0
])
{
$info
[
"props"
][]
=
$this
->
mkprop
(
$row
[
"ns"
],
$row
[
"name"
],
$row
[
"value"
]);
...
...
@@ -392,6 +395,8 @@
*/
function
DELETE
(
$options
)
{
global
$CONFIG_DBTABLEPREFIX
;
$dbTableProperties
=
$CONFIG_DBTABLEPREFIX
.
'properties'
;
$path
=
$options
[
"path"
];
if
(
!
OC_FILESYSTEM
::
file_exists
(
$path
))
{
...
...
@@ -399,13 +404,13 @@
}
if
(
OC_FILESYSTEM
::
is_dir
(
$path
))
{
$query
=
"DELETE FROM
p
roperties WHERE path LIKE '"
.
$this
->
_slashify
(
$options
[
"path"
])
.
"%'"
;
$query
=
"DELETE FROM
$dbTableP
roperties
WHERE path LIKE '"
.
$this
->
_slashify
(
$options
[
"path"
])
.
"%'"
;
OC_DB
::
query
(
$query
);
OC_FILESYSTEM
::
delTree
(
$path
);
}
else
{
OC_FILESYSTEM
::
unlink
(
$path
);
}
$query
=
"DELETE FROM
p
roperties WHERE path = '
$options[path]
'"
;
$query
=
"DELETE FROM
$dbTableP
roperties
WHERE path = '
$options[path]
'"
;
OC_DB
::
query
(
$query
);
return
"204 No Content"
;
...
...
@@ -432,6 +437,8 @@
function
COPY
(
$options
,
$del
=
false
)
{
// TODO Property updates still broken (Litmus should detect this?)
global
$CONFIG_DBTABLEPREFIX
;
$dbTableProperties
=
$CONFIG_DBTABLEPREFIX
.
'properties'
;
if
(
!
empty
(
$this
->
_SERVER
[
"CONTENT_LENGTH"
]))
{
// no body parsing yet
return
"415 Unsupported media type"
;
...
...
@@ -507,13 +514,13 @@
}
$destpath
=
$this
->
_unslashify
(
$options
[
"dest"
]);
if
(
is_dir
(
$source
))
{
$query
=
"UPDATE
p
roperties
$query
=
"UPDATE
$dbTableP
roperties
SET path = REPLACE(path, '"
.
$options
[
"path"
]
.
"', '"
.
$destpath
.
"')
WHERE path LIKE '"
.
$this
->
_slashify
(
$options
[
"path"
])
.
"%'"
;
OC_DB
::
query
(
$query
);
}
$query
=
"UPDATE
p
roperties
$query
=
"UPDATE
$dbTableP
roperties
SET path = '"
.
$destpath
.
"'
WHERE path = '"
.
$options
[
"path"
]
.
"'"
;
OC_DB
::
query
(
$query
);
...
...
@@ -554,7 +561,7 @@
}
}
$query
=
"INSERT INTO
p
roperties SELECT * FROM properties WHERE path = '"
.
$options
[
'path'
]
.
"'"
;
$query
=
"INSERT INTO
$dbTableP
roperties
SELECT * FROM properties WHERE path = '"
.
$options
[
'path'
]
.
"'"
;
}
return
(
$new
&&
!
$existing_col
)
?
"201 Created"
:
"204 No Content"
;
...
...
@@ -569,6 +576,9 @@
function
PROPPATCH
(
&
$options
)
{
global
$prefs
,
$tab
;
global
$CONFIG_DBTABLEPREFIX
;
$dbTableProperties
=
$CONFIG_DBTABLEPREFIX
.
'properties'
;
$msg
=
""
;
$path
=
$options
[
"path"
];
...
...
@@ -580,10 +590,10 @@
$options
[
"props"
][
$key
][
'status'
]
=
"403 Forbidden"
;
}
else
{
if
(
isset
(
$prop
[
"val"
]))
{
$query
=
"REPLACE INTO
p
roperties SET path = '
$options[path]
', name = '
$prop[name]
', ns= '
$prop[ns]
', value = '
$prop[val]
'"
;
$query
=
"REPLACE INTO
$dbTableP
roperties
SET path = '
$options[path]
', name = '
$prop[name]
', ns= '
$prop[ns]
', value = '
$prop[val]
'"
;
error_log
(
$query
);
}
else
{
$query
=
"DELETE FROM
p
roperties WHERE path = '
$options[path]
' AND name = '
$prop[name]
' AND ns = '
$prop[ns]
'"
;
$query
=
"DELETE FROM
$dbTableP
roperties
WHERE path = '
$options[path]
' AND name = '
$prop[name]
' AND ns = '
$prop[ns]
'"
;
}
OC_DB
::
query
(
$query
);
}
...
...
@@ -601,6 +611,8 @@
*/
function
LOCK
(
&
$options
)
{
global
$CONFIG_DBTABLEPREFIX
;
$dbTableLocks
=
$CONFIG_DBTABLEPREFIX
.
'locks'
;
// get absolute fs path to requested resource
$fspath
=
$options
[
"path"
];
...
...
@@ -615,13 +627,13 @@
if
(
isset
(
$options
[
"update"
]))
{
// Lock Update
$where
=
"WHERE path = '
$options[path]
' AND token = '
$options[update]
'"
;
$query
=
"SELECT owner, exclusivelock FROM
l
ocks
$where
"
;
$query
=
"SELECT owner, exclusivelock FROM
$dbTableL
ocks
$where
"
;
$res
=
OC_DB
::
query
(
$query
);
$row
=
OC_DB
::
fetch_assoc
(
$res
);
OC_DB
::
free_result
(
$res
);
if
(
is_array
(
$row
))
{
$query
=
"UPDATE `
l
ocks` SET `expires` = '
$options[timeout]
', `modified` = "
.
time
()
.
"
$where
"
;
$query
=
"UPDATE `
$dbTableL
ocks
` SET `expires` = '
$options[timeout]
', `modified` = "
.
time
()
.
"
$where
"
;
OC_DB
::
query
(
$query
);
$options
[
'owner'
]
=
$row
[
'owner'
];
...
...
@@ -634,7 +646,7 @@
}
}
$query
=
"INSERT INTO `
l
ocks`
$query
=
"INSERT INTO `
$dbTableL
ocks
`
SET `token` = '
$options[locktoken]
'
, `path` = '
$options[path]
'
, `created` = "
.
time
()
.
"
...
...
@@ -656,7 +668,9 @@
*/
function
UNLOCK
(
&
$options
)
{
$query
=
"DELETE FROM locks
global
$CONFIG_DBTABLEPREFIX
;
$dbTableLocks
=
$CONFIG_DBTABLEPREFIX
.
'locks'
;
$query
=
"DELETE FROM
$dbTableLocks
WHERE path = '
$options[path]
'
AND token = '
$options[token]
'"
;
OC_DB
::
query
(
$query
);
...
...
@@ -672,9 +686,11 @@
*/
function
checkLock
(
$path
)
{
global
$CONFIG_DBTABLEPREFIX
;
$dbTableLocks
=
$CONFIG_DBTABLEPREFIX
.
'locks'
;
$result
=
false
;
$query
=
"SELECT *
FROM
l
ocks
FROM
$dbTableL
ocks
WHERE path = '
$path
'
"
;
$res
=
OC_DB
::
select
(
$query
);
...
...
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