]> source.dussan.org Git - nextcloud-server.git/commitdiff
Improve logging in OC_Contacts_App
authorBart Visscher <bartv@thisnet.nl>
Sat, 11 Feb 2012 20:52:39 +0000 (21:52 +0100)
committerBart Visscher <bartv@thisnet.nl>
Sun, 12 Feb 2012 14:14:23 +0000 (15:14 +0100)
Add logging to errors paths in getAddressbook and getContactObject.

apps/contacts/lib/app.php

index f62bd311479920cd3807401bf1ebbe066aedcfe3..944bd6e83af0db25939cb59c8e8d7ec90fa5080f 100644 (file)
@@ -49,6 +49,12 @@ class OC_Contacts_App{
        public static function getAddressbook($id){
                $addressbook = OC_Contacts_Addressbook::find( $id );
                if( $addressbook === false || $addressbook['userid'] != OC_User::getUser()){
+                       if ($addressbook === false) {
+                               OC_Log::write('contacts', 'Addressbook not found: '. $id, OC_Log::ERROR);
+                       }
+                       else {
+                               OC_Log::write('contacts', 'Addressbook('.$id.') is not from '.$OC_User::getUser(), OC_Log::ERROR);
+                       }
                        OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.')))); // Same here (as with the contact error). Could this error be improved?
                        exit();
                }
@@ -58,11 +64,12 @@ class OC_Contacts_App{
        public static function getContactObject($id){
                $card = OC_Contacts_VCard::find( $id );
                if( $card === false ){
+                       OC_Log::write('contacts', 'Contact could not be found: '.$id, OC_Log::ERROR);
                        OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('Contact could not be found.').' '.$id)));
                        exit();
                }
 
-               self::getAddressbook( $card['addressbookid'] );
+               self::getAddressbook( $card['addressbookid'] );//access check
                return $card;
        }