1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-31 20:52:17 +01:00

apparently it works -ish

This commit is contained in:
babelouest 2014-02-10 15:16:43 -05:00
parent a4e45c435e
commit f412d41a9b
2 changed files with 29 additions and 2 deletions

View File

@ -496,6 +496,7 @@ class Database extends AbstractBackend {
* @return string|bool The identifier for the new contact or false on error. * @return string|bool The identifier for the new contact or false on error.
*/ */
public function createContact($addressbookid, $contact, array $options = array()) { public function createContact($addressbookid, $contact, array $options = array()) {
error_log("db create power ! $addressbookid - " . $contact->serialize());
$qname = 'createcontact'; $qname = 'createcontact';
$uri = isset($options['uri']) ? $options['uri'] : null; $uri = isset($options['uri']) ? $options['uri'] : null;
@ -570,6 +571,7 @@ class Database extends AbstractBackend {
* @return bool * @return bool
*/ */
public function updateContact($addressbookid, $id, $contact, array $options = array()) { public function updateContact($addressbookid, $id, $contact, array $options = array()) {
error_log("db update power ! $addressbookid, $id - " . $contact->serialize());
$noCollection = isset($options['noCollection']) ? $options['noCollection'] : false; $noCollection = isset($options['noCollection']) ? $options['noCollection'] : false;
$isBatch = isset($options['isBatch']) ? $options['isBatch'] : false; $isBatch = isset($options['isBatch']) ? $options['isBatch'] : false;
$qname = 'updatecontact'; $qname = 'updatecontact';

View File

@ -533,6 +533,7 @@ class Ldap extends AbstractBackend {
* @return string|bool The identifier for the new contact or false on error. * @return string|bool The identifier for the new contact or false on error.
*/ */
public function createContact($addressbookid, $contact, array $options = array()) { public function createContact($addressbookid, $contact, array $options = array()) {
error_log("access create"+$this->debug_string_backtrace());
$uri = isset($options['uri']) ? $options['uri'] : null; $uri = isset($options['uri']) ? $options['uri'] : null;
@ -584,8 +585,16 @@ class Ldap extends AbstractBackend {
* @return bool * @return bool
*/ */
public function updateContact($addressbookid, $id, $carddata, array $options = array()) { public function updateContact($addressbookid, $id, $carddata, array $options = array()) {
error_log("goat power ! $addressbookid, $id, $carddata"); if(!$carddata instanceof VCard) {
$vcard = \Sabre\VObject\Reader::read($carddata); try {
$vcard = \Sabre\VObject\Reader::read($carddata->serialize());
} catch(\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR);
return false;
}
} else {
$vcard = $carddata;
}
if (!is_array($id)) { if (!is_array($id)) {
$a_ids = array($id); $a_ids = array($id);
@ -651,4 +660,20 @@ class Ldap extends AbstractBackend {
} }
} }
// Please remove this
public function debug_string_backtrace() {
ob_start();
debug_print_backtrace();
$trace = ob_get_contents();
ob_end_clean();
// Remove first item from backtrace as it's this function which
// is redundant.
$trace = preg_replace ('/^#0\s+' . __FUNCTION__ . "[^\n]*\n/", '', $trace, 1);
// Renumber backtrace items.
$trace = preg_replace ('/^#(\d+)/me', '\'#\' . ($1 - 1)', $trace);
return $trace;
}
} }