1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Delete Type missing

Discussion in 'Media Gallery Resolved Bugs' started by batpool52!, Nov 18, 2015.

  1. batpool52!

    batpool52! 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;
        }
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    That wouldn't be the exact fix, but it is fixed now, thanks :)
     
    batpool52! likes this.
  3. batpool52!

    batpool52! Well-Known Member

    What would be the exact fix then? Using array_merge with default values? Or something else? :p
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
    Liam W and batpool52! like this.

Share This Page