mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-03-14 08:10:13 +00:00
With readonly_webdav_collections set we should write nothing!
We were writing collection records to the database when the configuration setting readonly_webdav_collections was set, even though the actual events would not be written.
This commit is contained in:
parent
31f8c6b17f
commit
03ff39fa33
@ -126,6 +126,7 @@ class Tools {
|
||||
if ( check_string($ics) ) {
|
||||
$path = "/".substr($file,0,-4).$path_ics;
|
||||
dbg_error_log( "importFromDirectory", "importing to $path");
|
||||
$c->readonly_webdav_collections = false; // Override this setting so we can create collections/events on import.
|
||||
require_once("caldav-PUT-functions.php");
|
||||
if ( $user = getUserByName(substr($file,0,-4),'importFromDirectory',__LINE__,__FILE__)) {
|
||||
$user_no = $user->user_no;
|
||||
|
||||
@ -56,6 +56,7 @@ function rollback_on_error( $caldav_context, $user_no, $path, $message='', $erro
|
||||
* @param boolean $public Whether the collection will be public, should we need to create it
|
||||
*/
|
||||
function controlRequestContainer( $username, $user_no, $path, $caldav_context, $public = null ) {
|
||||
global $c;
|
||||
|
||||
// Check to see if the path is like /foo /foo/bar or /foo/bar/baz etc. (not ending with a '/', but contains at least one)
|
||||
if ( preg_match( '#^(.*/)([^/]+)$#', $path, $matches ) ) {//(
|
||||
@ -81,6 +82,12 @@ function controlRequestContainer( $username, $user_no, $path, $caldav_context, $
|
||||
if ( ! $qry->Exec('PUT') ) {
|
||||
rollback_on_error( $caldav_context, $user_no, $path );
|
||||
}
|
||||
if ( !isset($c->readonly_webdav_collections) || $c->readonly_webdav_collections == true ) {
|
||||
if ( $qry->rows == 0 ) {
|
||||
$request->DoResponse( 405 ); // Method not allowed
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( $qry->rows == 0 ) {
|
||||
if ( $public == null ) $public = false;
|
||||
if ( preg_match( '#^(.*/)([^/]+)/$#', $request_container, $matches ) ) {//(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user