Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-18543

Files uploaded with ezoe to media library are assigned to Standard section

    XMLWordPrintable

    Details

      Description

      I just noticed this strange behaviour in a site I am developing on the 2011.6 version.

      When using OE to upload an image, selecting the Images folder inside the media library as location, the image is uploaded without problems. BUT - checking in the admin interface I see that all images are assigned to the Standard section.

      This is repeated all the time, as long as I upload from OE. When uploading images from the admin interface, the Images are assigned to the Media section, just as they should.

      I have been looking into the code for a while now, and believe I have found the source to the problem.

      In 2011.6, kernel/classes/ezcontentupload.php, row 633, we find this:

       $object = $class->instantiateIn( $localeCode );
      

      The above is used when the uploaded file needs a new object to attach to.
      Checking further into /kernel/classes/ezcontentclass.php, row 260 we find the reason to the problem:

      function instantiateIn( $lang, $userID = false, $sectionID = 1, $versionNumber = false, $versionStatus = eZContentObjectVersion::STATUS_INTERNAL_DRAFT )
      

      Please note that the param sectionID is set to 1 by default. 1 means Standard, so thats why the images get assigned to the wrong section, I assume.

      In comparision with eZ 430, the method called to create the object from ezcontentupload.php was :

      $object = $class->instantiate();
      

      Then, in ezcontentclass.php:

      function instantiate( $userID = false, $sectionID = 0, $versionNumber = false, $languageCode = false, $versionStatus =eZContentObjectVersion::STATUS_INTERNAL_DRAFT )
      
      

      So, someone has obviously changed the default value of SectionID. Maybe there is a good reason for that, but from what I can see it creates a quite severe problem.

      Steps to reproduce

      In 2011.6, use OE to upload images to the media library. Check which section they get assigned to.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dp@ez.no Damien Pobel (eZ)
              Reporter:
              nilu Nicklas Lundgren
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: