Changeset 17869

Show
Ignore:
Timestamp:
10/02/08 14:36:24 (2 months ago)
Author:
bergie
Message:

Try to catch photo deletions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.core/midcom/baseclasses/core/dbobject.php

    r17803 r17869  
    10441044    { 
    10451045        $object->id = 0; 
     1046 
    10461047        if (is_object($id)) 
    10471048        { 
  • trunk/midcom/midcom.core/midcom/services/dbclassloader.php

    r17558 r17869  
    617617            parent::__construct(\$_id); 
    618618        } 
    619         catch(midgard_error_exception \$e) 
     619        catch (midgard_error_exception \$e) 
    620620        { 
    621621            \$x =& \$this;  
  • trunk/midcom/org.routamc.photostream/handler/admin.php

    r17723 r17869  
    194194    { 
    195195        $this->_photo = new org_routamc_photostream_photo_dba($args[0]); 
    196         if (! $this->_photo) 
     196        if (   !$this->_photo 
     197            || empty($this->_photo->guid)) 
    197198        { 
    198199            $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND, "The photo {$args[0]} was not found."); 
     
    254255    { 
    255256        $this->_photo = new org_routamc_photostream_photo_dba($args[0]); 
    256         if (! $this->_photo) 
     257        if (   !$this->_photo 
     258            || empty($this->_photo->guid)) 
    257259        { 
    258260            $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND, "The photo {$args[0]} was not found."); 
     
    266268        { 
    267269            // Deletion confirmed. 
    268             if (! $this->_photo->delete()) 
    269             { 
    270                 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Failed to delete photo {$args[0]}, last Midgard error was: " . mgd_errstr()); 
     270            try 
     271            { 
     272                $this->_photo->delete(); 
     273            } 
     274            catch (midgard_error_exception $e) 
     275            { 
     276                $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Failed to delete photo {$args[0]}, last Midgard error was: " . $e->getMessage()); 
    271277                // This will exit. 
    272278            } 
  • trunk/midcom/org.routamc.photostream/handler/view.php

    r17555 r17869  
    5050        $data =& $this->_request_data; 
    5151        $photo = new org_routamc_photostream_photo_dba($id); 
    52         if (!is_object($photo)) 
    53         { 
    54             $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Could not load photo {$id}"); 
     52        if (   !is_object($photo) 
     53            || empty($photo->guid)) 
     54        { 
     55            $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND, "Could not load photo {$id}"); 
    5556            // This will exit 
    5657        }