Fixed Delete Type missing

TickTackk

Well-known member
In XenGallery_Model_InlineMod_Media
PHP:
    public function undeleteMedia(array $mediaIds, array $options = array(), &$errorKey = '', array $viewingUser = null)
    {
        $media = $this->getMediaData($mediaIds);

        if (empty($options['skipPermissions']) && !$this->canDeleteMediaData($media, $errorKey, $viewingUser))
        {
            return false;
        }

        $this->_updateMediaMediaState($media, 'visible', 'deleted');

        return true;
    }
should be
PHP:
    public function undeleteMedia(array $mediaIds, array $options = array(), &$errorKey = '', array $viewingUser = null)
    {
        $media = $this->getMediaData($mediaIds);

        if (empty($options['skipPermissions']) && !$this->canDeleteMediaData($media, $options['delete_type'], $errorKey, $viewingUser))
        {
            return false;
        }

        $this->_updateMediaMediaState($media, 'visible', 'deleted');

        return true;
    }
 
The fix is to replace $options['delete_type'] in your fix with simply 'soft'. We don't actually need to consider hard delete permissions here. If you can soft delete the media, then you should be able to undelete it.
 
Back
Top Bottom