mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-04-26 15:20:16 +00:00
updates for bulk addressbook import
This commit is contained in:
parent
e245b8d1fb
commit
202542dc1b
@ -42,7 +42,7 @@ $c->pg_connect[] = "dbname=davical user=davical_app";
|
||||
* will be read-only. Any changes to them must be applied via CalDAV.
|
||||
*
|
||||
* You may want to set this to false during your initial setup to make it
|
||||
* easier for people to PUT whole calendars as part of the conversion of
|
||||
* easier for people to PUT whole calendars or addressbooks as part of migrating
|
||||
* their data. After this, it is recommended to turn it off so that clients
|
||||
* which have been misconfigured are readily identifiable.
|
||||
* Default: true
|
||||
|
||||
@ -666,9 +666,9 @@ function import_collection( $import_content, $user_no, $path, $caldav_context, $
|
||||
}
|
||||
|
||||
if ( preg_match( '{^begin:(vcard|vcalendar)}i', $import_content, $matches) ) {
|
||||
if ( $matches[1] == 'VCARD' )
|
||||
if ( strtoupper($matches[1]) == 'VCARD' )
|
||||
import_addressbook_collection( $import_content, $user_no, $path, $caldav_context, $appending );
|
||||
elseif ( $matches[1] == 'VCALENDAR' )
|
||||
elseif ( strtoupper($matches[1]) == 'VCALENDAR' )
|
||||
import_calendar_collection( $import_content, $user_no, $path, $caldav_context, $appending );
|
||||
|
||||
// Uncache anything to do with the collection
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
HTTP/1.1 403 Forbidden
|
||||
HTTP/1.1 409 Conflict
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
|
||||
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
|
||||
Content-Length: 92
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Length: 137
|
||||
Content-Type: text/xml; charset="utf-8"
|
||||
|
||||
PUT on a collection is only allowed for text/vcard content against an addressbook collection
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<error xmlns="DAV:">
|
||||
<collection-must-exist/>The destination collection does not exist
|
||||
</error>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#
|
||||
# PUT a VCARD record into an addressbook
|
||||
# PUT a VCARD record into a non-existing addressbook
|
||||
#
|
||||
TYPE=PUT
|
||||
URL=http://regression.host/caldav.php/user1/addressbook/
|
||||
URL=http://regression.host/caldav.php/user1/addressbook1/kelly.vcf
|
||||
|
||||
HEADER=User-Agent: DAViCalTester/public
|
||||
HEADER=Content-Type: text/vcard; charset=utf-8
|
||||
@ -27,7 +27,7 @@ ENDDATA
|
||||
QUERY
|
||||
SELECT caldav_data.dav_name, caldav_data.dav_etag, fn, n
|
||||
FROM caldav_data JOIN addressbook_resource USING(dav_id)
|
||||
WHERE caldav_data.dav_name ~ '/user1/addressbook/'
|
||||
WHERE caldav_data.dav_name ~ '/user1/addressbook1/'
|
||||
ENDQUERY
|
||||
|
||||
|
||||
|
||||
16
testing/tests/carddav/2040-PUT-addressbook.result
Normal file
16
testing/tests/carddav/2040-PUT-addressbook.result
Normal file
@ -0,0 +1,16 @@
|
||||
HTTP/1.1 200 OK
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
|
||||
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
|
||||
Content-Length: 0
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
|
||||
|
||||
count: >3<
|
||||
|
||||
fn: >Fred Weasley<
|
||||
|
||||
fn: >Donald Kelly<
|
||||
|
||||
fn: >George Weasley<
|
||||
|
||||
53
testing/tests/carddav/2040-PUT-addressbook.test
Normal file
53
testing/tests/carddav/2040-PUT-addressbook.test
Normal file
@ -0,0 +1,53 @@
|
||||
#
|
||||
# PUT three VCARD records into an addressbook
|
||||
#
|
||||
TYPE=PUT
|
||||
URL=http://regression.host/caldav.php/user1/addresses/
|
||||
|
||||
HEADER=User-Agent: DAViCalTester/public
|
||||
HEADER=Content-Type: text/vcard; charset=utf-8
|
||||
HEAD
|
||||
|
||||
BEGINDATA
|
||||
begin:vcard
|
||||
fn:Donald Kelly
|
||||
n:Kelly;Donald
|
||||
org:Esposo Designs Ltd
|
||||
adr:Newtown;;25 Rintoul St;Wellington;;;New Zealand
|
||||
email;internet:donald@example.co.nz
|
||||
title:Proprietor
|
||||
tel;work:+64 4 347 4747
|
||||
tel;cell:+64 2 1234-4321
|
||||
x-mozilla-html:TRUE
|
||||
url:www.example.co.nz
|
||||
version:2.1
|
||||
end:vcard
|
||||
BEGIN:VCARD
|
||||
VERSION:2.1
|
||||
N:Weasley;George
|
||||
FN:George Weasley
|
||||
EMAIL;PREF;INTERNET:gweasley@example.org
|
||||
REV:20030909T234634Z
|
||||
END:VCARD
|
||||
BEGIN:VCARD
|
||||
VERSION:2.1
|
||||
N:Weasley;Fred
|
||||
FN:Fred Weasley
|
||||
EMAIL;PREF;INTERNET:fweasley@example.org
|
||||
REV:20030909T234507Z
|
||||
END:VCARD
|
||||
ENDDATA
|
||||
|
||||
QUERY
|
||||
SELECT COUNT(caldav_data.dav_name)
|
||||
FROM caldav_data
|
||||
WHERE caldav_data.dav_name ~ '/user1/addresses/'
|
||||
ENDQUERY
|
||||
|
||||
QUERY
|
||||
SELECT fn
|
||||
FROM caldav_data JOIN addressbook_resource USING(dav_id)
|
||||
WHERE caldav_data.dav_name ~ '/user1/addresses/'
|
||||
ENDQUERY
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user