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
60d2f8de
Commit
60d2f8de
authored
14 years ago
by
Thibaut GRIDEL
Browse files
Options
Downloads
Patches
Plain Diff
webdav: fix icewind's new Filesystem.php version
parent
45af5d78
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/owncloud.sql
+2
-0
2 additions, 0 deletions
docs/owncloud.sql
inc/HTTP/WebDAV/Server/Filesystem.php
+37
-58
37 additions, 58 deletions
inc/HTTP/WebDAV/Server/Filesystem.php
inc/lib_config.php
+4
-0
4 additions, 0 deletions
inc/lib_config.php
with
43 additions
and
58 deletions
docs/owncloud.sql
+
2
−
0
View file @
60d2f8de
CREATE
TABLE
'locks'
(
'token'
VARCHAR
(
255
)
NOT
NULL
DEFAULT
''
,
'path'
varchar
(
200
)
NOT
NULL
DEFAULT
''
,
'created'
int
(
11
)
NOT
NULL
DEFAULT
'0'
,
'modified'
int
(
11
)
NOT
NULL
DEFAULT
'0'
,
'expires'
int
(
11
)
NOT
NULL
DEFAULT
'0'
,
'owner'
varchar
(
200
)
DEFAULT
NULL
,
'recursive'
int
(
11
)
DEFAULT
'0'
,
...
...
This diff is collapsed.
Click to expand it.
inc/HTTP/WebDAV/Server/Filesystem.php
+
37
−
58
View file @
60d2f8de
...
...
@@ -78,11 +78,6 @@
$this
->
base
=
$this
->
_SERVER
[
'DOCUMENT_ROOT'
];
}
// establish connection to property/locking db
// mysql_connect($this->db_host, $this->db_user, $this->db_passwd) or die(mysql_error());
// mysql_select_db($this->db_name) or die(mysql_error());
// TODO throw on connection problems
// let the base class do all the work
parent
::
ServeRequest
();
}
...
...
@@ -132,7 +127,7 @@
$options
[
"path"
]
=
$this
->
_slashify
(
$options
[
"path"
]);
// try to open directory
$handle
=
opendir
(
$fspath
);
$handle
=
@
opendir
(
$fspath
);
if
(
$handle
)
{
// ok, now get all its contents
...
...
@@ -194,14 +189,12 @@
}
// get additional properties from database
$query
=
"SELECT ns, name, value
FROM
{
$this
->
db_prefix
}
properties
WHERE path = '
$path
'"
;
$res
=
mysql_query
(
$query
);
while
(
$row
=
mysql_fetch_assoc
(
$res
))
{
$query
=
"SELECT ns, name, value FROM properties WHERE path = '
$path
'"
;
$res
=
OC_DB
::
query
(
$query
);
while
(
$row
=
OC_DB
::
fetch_assoc
(
$res
))
{
$info
[
"props"
][]
=
$this
->
mkprop
(
$row
[
"ns"
],
$row
[
"name"
],
$row
[
"value"
]);
}
mysql_
free_result
(
$res
);
OC_DB
::
free_result
(
$res
);
return
$info
;
}
...
...
@@ -258,7 +251,7 @@
*/
function
_mimetype
(
$fspath
)
{
if
(
is_dir
(
$fspath
))
{
if
(
@
is_dir
(
$fspath
))
{
// directories are easy
return
"httpd/unix-directory"
;
}
else
if
(
function_exists
(
"mime_content_type"
))
{
...
...
@@ -516,16 +509,14 @@
}
if
(
is_dir
(
$path
))
{
$query
=
"DELETE FROM
{
$this
->
db_prefix
}
properties
WHERE path LIKE '"
.
$this
->
_slashify
(
$options
[
"path"
])
.
"%'"
;
mysql_query
(
$query
);
System
::
rm
(
array
(
"-rf"
,
$path
));
$query
=
"DELETE FROM properties WHERE path LIKE '"
.
$this
->
_slashify
(
$options
[
"path"
])
.
"%'"
;
OC_DB
::
query
(
$query
);
System
::
rm
(
array
(
"-rf,
$path
"
));
}
else
{
unlink
(
$path
);
}
$query
=
"DELETE FROM
{
$this
->
db_prefix
}
properties
WHERE path = '
$options[path]
'"
;
mysql_query
(
$query
);
$query
=
"DELETE FROM properties WHERE path = '
$options[path]
'"
;
OC_DB
::
query
(
$query
);
return
"204 No Content"
;
}
...
...
@@ -624,16 +615,16 @@
}
$destpath
=
$this
->
_unslashify
(
$options
[
"dest"
]);
if
(
is_dir
(
$source
))
{
$query
=
"UPDATE
{
$this
->
db_prefix
}
properties
$query
=
"UPDATE properties
SET path = REPLACE(path, '"
.
$options
[
"path"
]
.
"', '"
.
$destpath
.
"')
WHERE path LIKE '"
.
$this
->
_slashify
(
$options
[
"path"
])
.
"%'"
;
mysql_
query
(
$query
);
OC_DB
::
query
(
$query
);
}
$query
=
"UPDATE
{
$this
->
db_prefix
}
properties
$query
=
"UPDATE properties
SET path = '"
.
$destpath
.
"'
WHERE path = '"
.
$options
[
"path"
]
.
"'"
;
mysql_
query
(
$query
);
OC_DB
::
query
(
$query
);
}
else
{
if
(
is_dir
(
$source
))
{
$files
=
System
::
find
(
$source
);
...
...
@@ -673,10 +664,7 @@
}
}
$query
=
"INSERT INTO
{
$this
->
db_prefix
}
properties
SELECT *
FROM
{
$this
->
db_prefix
}
properties
WHERE path = '"
.
$options
[
'path'
]
.
"'"
;
$query
=
"INSERT INTO properties SELECT * FROM properties WHERE path = '"
.
$options
[
'path'
]
.
"'"
;
}
return
(
$new
&&
!
$existing_col
)
?
"201 Created"
:
"204 No Content"
;
...
...
@@ -702,18 +690,12 @@
$options
[
"props"
][
$key
][
'status'
]
=
"403 Forbidden"
;
}
else
{
if
(
isset
(
$prop
[
"val"
]))
{
$query
=
"REPLACE INTO
{
$this
->
db_prefix
}
properties
SET path = '
$options[path]
'
, name = '
$prop[name]
'
, ns= '
$prop[ns]
'
, value = '
$prop[val]
'"
;
$query
=
"REPLACE INTO properties SET path = '
$options[path]
', name = '
$prop[name]
', ns= '
$prop[ns]
', value = '
$prop[val]
'"
;
error_log
(
$query
);
}
else
{
$query
=
"DELETE FROM
{
$this
->
db_prefix
}
properties
WHERE path = '
$options[path]
'
AND name = '
$prop[name]
'
AND ns = '
$prop[ns]
'"
;
$query
=
"DELETE FROM properties WHERE path = '
$options[path]
' AND name = '
$prop[name]
' AND ns = '
$prop[ns]
'"
;
}
mysql_
query
(
$query
);
OC_DB
::
query
(
$query
);
}
}
...
...
@@ -743,18 +725,15 @@
if
(
isset
(
$options
[
"update"
]))
{
// Lock Update
$where
=
"WHERE path = '
$options[path]
' AND token = '
$options[update]
'"
;
$query
=
"SELECT owner, exclusivelock FROM
{
$this
->
db_prefix
}
locks
$where
"
;
$res
=
mysql_
query
(
$query
);
$row
=
mysql_
fetch_assoc
(
$res
);
mysql_
free_result
(
$res
);
$query
=
"SELECT owner, exclusivelock FROM locks
$where
"
;
$res
=
OC_DB
:
query
(
$query
);
$row
=
OC_DB
:
fetch_assoc
(
$res
);
OC_DB
:
free_result
(
$res
);
if
(
is_array
(
$row
))
{
$query
=
"UPDATE
{
$this
->
db_prefix
}
locks
SET expires = '
$options[timeout]
'
, modified = "
.
time
()
.
"
$where
"
;
mysql_query
(
$query
);
$query
=
"UPDATE locks SET expires = '
$options[timeout]
', modified = "
.
time
()
.
"
$where
"
;
OC_DB
:
query
(
$query
);
$options
[
'owner'
]
=
$row
[
'owner'
];
$options
[
'scope'
]
=
$row
[
"exclusivelock"
]
?
"exclusive"
:
"shared"
;
$options
[
'type'
]
=
$row
[
"exclusivelock"
]
?
"write"
:
"read"
;
...
...
@@ -765,7 +744,7 @@
}
}
$query
=
"INSERT INTO
{
$this
->
db_prefix
}
locks
$query
=
"INSERT INTO locks
SET token = '
$options[locktoken]
'
, path = '
$options[path]
'
, created = "
.
time
()
.
"
...
...
@@ -774,9 +753,9 @@
, expires = '
$options[timeout]
'
, exclusivelock = "
.
(
$options
[
'scope'
]
===
"exclusive"
?
"1"
:
"0"
)
;
mysql_
query
(
$query
);
OC_DB
::
query
(
$query
);
return
mysql_
affected_rows
()
?
"200 OK"
:
"409 Conflict"
;
return
OC_DB
::
affected_rows
()
?
"200 OK"
:
"409 Conflict"
;
}
/**
...
...
@@ -787,12 +766,12 @@
*/
function
UNLOCK
(
&
$options
)
{
$query
=
"DELETE FROM
{
$this
->
db_prefix
}
locks
$query
=
"DELETE FROM locks
WHERE path = '
$options[path]
'
AND token = '
$options[token]
'"
;
mysql_
query
(
$query
);
OC_DB
::
query
(
$query
);
return
mysql_
affected_rows
()
?
"204 No Content"
:
"409 Conflict"
;
return
OC_DB
::
affected_rows
()
?
"204 No Content"
:
"409 Conflict"
;
}
/**
...
...
@@ -806,14 +785,14 @@
$result
=
false
;
$query
=
"SELECT owner, token, created, modified, expires, exclusivelock
FROM
{
$this
->
db_prefix
}
locks
FROM locks
WHERE path = '
$path
'
"
;
$res
=
mysql_
query
(
$query
);
$res
=
OC_DB
::
query
(
$query
);
if
(
$res
)
{
$row
=
mysql_
fetch_a
rray
(
$res
);
mysql_
free_result
(
$res
);
$row
=
OC_DB
::
fetch_a
ssoc
(
$res
);
OC_DB
::
free_result
(
$res
);
if
(
$row
)
{
$result
=
array
(
"type"
=>
"write"
,
...
...
This diff is collapsed.
Click to expand it.
inc/lib_config.php
+
4
−
0
View file @
60d2f8de
...
...
@@ -268,6 +268,8 @@ class OC_CONFIG{
$query
=
"CREATE TABLE 'locks' (
'token' VARCHAR(255) NOT NULL DEFAULT '',
'path' varchar(200) NOT NULL DEFAULT '',
'created' int(11) NOT NULL DEFAULT '0',
'modified' int(11) NOT NULL DEFAULT '0',
'expires' int(11) NOT NULL DEFAULT '0',
'owner' varchar(200) DEFAULT NULL,
'recursive' int(11) DEFAULT '0',
...
...
@@ -308,6 +310,8 @@ CREATE TABLE 'users' (
CREATE TABLE IF NOT EXISTS `locks` (
`token` varchar(255) NOT NULL DEFAULT '',
`path` varchar(200) NOT NULL DEFAULT '',
`created` int(11) NOT NULL DEFAULT '0',
`modified` int(11) NOT NULL DEFAULT '0',
`expires` int(11) NOT NULL DEFAULT '0',
`owner` varchar(200) DEFAULT NULL,
`recursive` int(11) DEFAULT '0',
...
...
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