naboo / craft-siteduplicate

Site Duplicate let's you duplicate entries across Sites in Craft CMS. It even works when section entries aren't set to propagate across site sections making it easy to duplicate entry data between Sites.
MIT License
4 stars 1 forks source link

Craft 3.4.30 #5

Closed i-just closed 4 years ago

i-just commented 4 years ago

Site Duplicate 1.0.3 no longer works with Craft CMS 3.4.30. Last used it with Craft CMS 3.4.23 and all worked as expected, now with the same sites on Craft CMS 3.4.30 it throws 500 error "An error occurred when duplicating the entry.".

Logs repored it as: "Attempting to duplicate an unsaved element. in vendor/craftcms/cms/src/services/Elements.php:736".

I think the reason for this error is: If you compare bodyParams from request at the beginning of private function _getEntryModel() in craft-siteduplicate/src/controllers/DuplicateController.php:

In Craft 3.4.23; Site Duplicate 1.0.3:

private '_bodyParams' (yii\web\Request) => 
    array (size=16)
      'CRAFT_CSRF_TOKEN' => string '[clipped]'... (length=556)
      'action' => string 'siteduplicate/duplicate' (length=23)
      'redirect' => string '[clipped]' (length=79)
      'siteId' => string '1' (length=1)
      'sectionId' => string '2' (length=1)
      'entryId' => string '188341' (length=6)
      'title' => string '[clipped]' (length=35)
      'slug' => string '[clipped]' (length=37)
      'author' => 
        array (size=1)
          0 => string '1105' (length=4)
      'postDate' => 
        array (size=3)
          'date' => string '06/03/2020' (length=10)
          'timezone' => string 'Europe/London' (length=13)
          'time' => string '11:11' (length=5)
      'expiryDate' => 
        array (size=3)
          'date' => string '' (length=0)
          'timezone' => string 'Europe/London' (length=13)
          'time' => string '' (length=0)
      'enabled' => string '1' (length=1)
      'siteduplicate-siteId' => string '14' (length=2)
      'duplicateSiteId' => string '14' (length=2)

in Craft 3.4.30; Site Duplicate 1.0.3:

private '_bodyParams' (yii\web\Request) => 
    array (size=16)
      'CRAFT_CSRF_TOKEN' => string '[clipped]'... (length=556)
      'action' => string 'siteduplicate/duplicate' (length=23)
      'redirect' => string '[clipped]' (length=79)
      'siteId' => string '1' (length=1)
      'sectionId' => string '2' (length=1)
      'sourceId' => string '188341' (length=6)
      'title' => string '[clipped]' (length=35)
      'slug' => string '[clipped]' (length=37)
      'author' => 
        array (size=1)
          0 => string '1105' (length=4)
      'postDate' => 
        array (size=3)
          'date' => string '06/03/2020' (length=10)
          'timezone' => string 'Europe/London' (length=13)
          'time' => string '11:11' (length=5)
      'expiryDate' => 
        array (size=3)
          'date' => string '' (length=0)
          'timezone' => string 'Europe/London' (length=13)
          'time' => string '' (length=0)
      'enabled' => string '1' (length=1)
      'siteduplicate-siteId' => string '14' (length=2)
      'duplicateSiteId' => string '14' (length=2)

As you can see, in Craft 3.4.30 there's no longer entryId param. It looks like it's been replaced with sourceId.

Can you please push a fix for this?

naboo commented 4 years ago

Hello everyone

Sorry for not getting back to you. I've been on vacation for the summer but I've been back since monday. I'll fix this for an early next week release. You have my word!

I also need to look into so there's no issues with the newly released 3.5 version.

JOHAN STRÖMQVIST INTERACTIVE DIRECTOR

Naboovalley AB Palmaers gata 28 584 37 Linköping

PHONE +46 (0)70 377 13 80 EMAIL johan@naboovalley.com WWW www.naboovalley.com

On Fri, Aug 7, 2020 at 10:20 AM Iwona Just notifications@github.com wrote:

Site Duplicate 1.0.3 no longer works with Craft CMS 3.4.30. Last used it with Craft CMS 3.4.23 and all worked as expected, now with the same sites on Craft CMS 3.4.30 it throws 500 error "An error occurred when duplicating the entry.".

Logs repored it as: "Attempting to duplicate an unsaved element. in vendor/craftcms/cms/src/services/Elements.php:736".

I think the reason for this error is: If you compare bodyParams from request at the beginning of private function _getEntryModel() in craft-siteduplicate/src/controllers/DuplicateController.php:

In Craft 3.4.23; Site Duplicate 1.0.3:

private '_bodyParams' (yii\web\Request) => array (size=16) 'CRAFT_CSRF_TOKEN' => string '[clipped]'... (length=556) 'action' => string 'siteduplicate/duplicate' (length=23) 'redirect' => string '[clipped]' (length=79) 'siteId' => string '1' (length=1) 'sectionId' => string '2' (length=1) 'entryId' => string '188341' (length=6) 'title' => string '[clipped]' (length=35) 'slug' => string '[clipped]' (length=37) 'author' => array (size=1) 0 => string '1105' (length=4) 'postDate' => array (size=3) 'date' => string '06/03/2020' (length=10) 'timezone' => string 'Europe/London' (length=13) 'time' => string '11:11' (length=5) 'expiryDate' => array (size=3) 'date' => string '' (length=0) 'timezone' => string 'Europe/London' (length=13) 'time' => string '' (length=0) 'enabled' => string '1' (length=1) 'siteduplicate-siteId' => string '14' (length=2) 'duplicateSiteId' => string '14' (length=2)

in Craft 3.4.30; Site Duplicate 1.0.3:

private '_bodyParams' (yii\web\Request) => array (size=16) 'CRAFT_CSRF_TOKEN' => string '[clipped]'... (length=556) 'action' => string 'siteduplicate/duplicate' (length=23) 'redirect' => string '[clipped]' (length=79) 'siteId' => string '1' (length=1) 'sectionId' => string '2' (length=1) 'sourceId' => string '188341' (length=6) 'title' => string '[clipped]' (length=35) 'slug' => string '[clipped]' (length=37) 'author' => array (size=1) 0 => string '1105' (length=4) 'postDate' => array (size=3) 'date' => string '06/03/2020' (length=10) 'timezone' => string 'Europe/London' (length=13) 'time' => string '11:11' (length=5) 'expiryDate' => array (size=3) 'date' => string '' (length=0) 'timezone' => string 'Europe/London' (length=13) 'time' => string '' (length=0) 'enabled' => string '1' (length=1) 'siteduplicate-siteId' => string '14' (length=2) 'duplicateSiteId' => string '14' (length=2)

As you can see, in Craft 3.4.30 there's no longer entryId param. It looks like it's been replaced with sourceId.

Can you please push a fix for this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/naboo/craft-siteduplicate/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJJ3TNBYYWMQMTH4K3NSJ3R7O2MJANCNFSM4PXMOHVQ .

naboo commented 4 years ago

Fixed in v1.1.0

i-just commented 4 years ago

Hi,

Thanks for this. Can you please change it to require Craft 3.4 or higher? At the moment you've set it to be locked to Craft CMS 3.4.0 and the latest version of 3.4 is 3.4.30 (and that's also the version mentioned in the original issue).

naboo commented 4 years ago

Sorry about that. Fixed https://github.com/naboo/craft-siteduplicate/releases/tag/v1.1.1

i-just commented 4 years ago

Thanks for a quick update.

Now that I was able to test it against Craft CMS 3.4.30 I have found another series of problems in craft-siteduplicate/src/controllers/DuplicateController.php:

Any chance you can have a look at this?

naboo commented 4 years ago

Hmm, I see. I tested it against Craft 3.5 to make it compatible upwards. I'm guessing 3.5 has these functions declared on the BaseController now days.

So I'll need to bump the requirements to 3.5 I'm afraid, I'll not make it compatible with an older version.

Can you make these edits yourself? If not I can send you an edited file you can just replace until you update to 3.5.

Den tors 13 aug. 2020 15:37Iwona Just notifications@github.com skrev:

Thanks for a quick update.

Now that I was able to test it against Craft CMS 3.4.30 I have found another series of problems in craft-siteduplicate/src/controllers/DuplicateController.php:

  • $this->request => doesn't work (first error thrown in _getEntryModel() function), it's not declared anywhere
  • $this->setSuccessFlash => no such method declared anywhere but called on line: 199
  • $this->enforceSitePermission => no such method declared anywhere but called on line: 76
  • $this->setFailFlash => no such method declared anywhere but called on lines: 114, 166

Any chance you can have a look at this?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/naboo/craft-siteduplicate/issues/5#issuecomment-673483287, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJJ3TKLW2IL2WLG4XHGC5LSAPUAZANCNFSM4PXMOHVQ .

i-just commented 4 years ago

Ok, thanks; Yes, I can edit myself for now. I'll be updating websites that use siteduplicate plugin to C3.5 in the next 2 weeks anyway.