Can we create new branch for testing?
Switching to major as Drupal 10 is out now.

Happy to help maintain the module if required.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

VladimirAus created an issue. See original summary.

vladimiraus’s picture

Status: Active » Needs review

MR is open, but I would recommend to start 4.0.x for testing.
MR also includes phpcbf fixes.

luke_nuke’s picture

If you guys can't wait for D10 support, you may also look into another module that covers most of the similar use cases: https://www.drupal.org/project/content_snapshot . It just had a D10 compatible release.

Disclaimer: I'm its author and maintainer.

tobias märz’s picture

StatusFileSize
new12.72 KB

I've got some errors with this fork on Drupal 10 and PHP8.1 and created attached patch.

Matroskeen made their first commit to this issue’s fork.

matroskeen’s picture

I created a new MR because the first one has some out-of-scope changes and doesn't cover all issues.
It also includes path #5, where PHP 8.1 compatibility issues are resolved. Since Drupal 10 requires 8.1, this is required to be committed.

matroskeen’s picture

StatusFileSize
new20.95 KB

Here is a patch that contains MR changes.

ericvl’s picture

@Matroskeen,

First of all, thanks for the patch in #9 but I've checked the patch and find that the function "denormalize" in the file "src/Normalizer/FileEntityNormalizer.php" should also have a returnvalue of "mixed" in stead of "array|string|int|float|bool|\ArrayObject|NULL".
Just like in all other denormalize functions in the other files.
Can you confirm this and eventually create a new patch, please?
Thanks

izus’s picture

Hi,
preparing for D10 migration, i needed to be compatible d10 while still in D9
Applying #9 patch for Drupal9 and running drush updb caused the following errors

PHP Fatal error: Declaration of Drupal\content_sync\Normalizer\ContentEntityNormalizer::supportsNormalization($data, ?string $format = null, array $context = []): bool must be compatible with Drupal\serialization\Normalizer\NormalizerBase::supportsNormalization($data, $format = null) inweb\modules\contrib\content_sync\src\Normalizer\ContentEntityNormalizer.php on line 105

Fatal error: Declaration of Drupal\content_sync\Normalizer\ContentEntityNormalizer::supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool must be compatible with Drupal\serialization\Normalizer\NormalizerBase::supportsDenormalization($data, $type, $format = null) in web\modules\contrib\content_sync\src\Normalizer\ContentEntityNormalizer.php on line 113

Fatal error: Declaration of Drupal\content_sync\Encoder\YamlEncoder::encode(mixed $data, string $format, array $context = []): string must be compatible with Symfony\Component\Serializer\Encoder\EncoderInterface::encode($data, $format, array $context = []) inweb\modules\contrib\content_sync\src\Encoder\YamlEncoder.php on line 42
[warning] Drush command terminated abnormally.

I managed to fix them in the following patch so that i can still in drupal 9 while using the patch in #9
this is useless for people that are using D10 but i share it for people in my case (need to prepare D10 compatibility and still on D9)

Hopefully it helps

izus’s picture

StatusFileSize
new6.85 KB

hi,
here is a d10 compatible patch from last dev branch

izus’s picture

StatusFileSize
new6.85 KB

had a double syncContent declaration, now corrected

izus’s picture

StatusFileSize
new6.37 KB

missed with syncContent
now ok

izus’s picture

StatusFileSize
new8.1 KB

had some php deprecation warning corrected

izus’s picture

StatusFileSize
new7.5 KB

drush command had php warnings
corrected too.

izus’s picture

StatusFileSize
new17.18 KB

some methods signatures should be fixed, otherwise drush complains about it

blanca.esqueda’s picture

I'll be doing some testing today, thanks for the patch!

qzmenko’s picture

Status: Needs review » Needs work

Fatal error during enabling module using patch #17:

PHP Fatal error: Could not check compatibility between Drupal\content_sync\Logger\ContentSyncLog::log($level, Drupal\content_sync\Logger\Stringable|string $message, array $context = []): void and Drupal\Core\Logger\RfcLoggerTrait::log($level, Stringable|string $message, array $context = []): void, because class Drupal\content_sync\Logger\Stringable is not available in /app/web/modules/contrib/content_sync/src/Logger/ContentSyncLog.php on line 56

sylvain lavielle’s picture

StatusFileSize
new20.89 KB

I had the same problem described in #17.

It looks to me the last reliable patch is the #9 one.

The #10 point is to be fixed too. I had an exception syncing files that is related to this point :

[error]  TypeError: Drupal\content_sync\Normalizer\FileEntityNormalizer::denormalize(): Return value must be of type ArrayObject|array|string|int|float|bool|null, Drupal\file\Entity\File returned in Drupal\content_sync\Normalizer\FileEntityNormalizer->denormalize() (line 141 of /var/www/public/modules/contrib/content_sync/src/Normalizer/FileEntityNormalizer.php) #0 /var/www/vendor/symfony/serializer/Serializer.php(227): Drupal\content_sync\Normalizer\FileEntityNormalizer->denormalize()
> #1 /var/www/public/modules/contrib/content_sync/src/Importer/ContentImporter.php(64): Symfony\Component\Serializer\Serializer->denormalize()
> #2 /var/www/public/modules/contrib/content_sync/src/Form/ContentImportTrait.php(62): Drupal\content_sync\Importer\ContentImporter->importEntity()
> #3 /var/www/vendor/drush/drush/includes/batch.inc(256): Drupal\content_sync\Commands\ContentSyncCommands->syncContent()
> #4 /var/www/vendor/drush/drush/includes/batch.inc(201): _drush_batch_worker()
> #5 /var/www/vendor/drush/drush/includes/batch.inc(95): _drush_batch_command()
> #6 /var/www/vendor/drush/drush/src/Drupal/Commands/core/BatchCommands.php(20): drush_batch_command()
> #7 [internal function]: Drush\Drupal\Commands\core\BatchCommands->process()
> #8 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array()
> #9 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
> #10 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
> #11 /var/www/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(386): Consolidation\AnnotatedCommand\CommandProcessor->process()
> #12 /var/www/vendor/symfony/console/Command/Command.php(312): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
> #13 /var/www/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
> #14 /var/www/vendor/symfony/console/Application.php(314): Symfony\Component\Console\Application->doRunCommand()
> #15 /var/www/vendor/symfony/console/Application.php(168): Symfony\Component\Console\Application->doRun()
> #16 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run()
> #17 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun()
> #18 /var/www/vendor/drush/drush/drush.php(77): Drush\Runtime\Runtime->run()
> #19 /var/www/vendor/drush/drush/drush(4): require('...')
> #20 /var/www/vendor/bin/drush(120): include('...')
> #21 {main}. 

The error stands in the ./src/Normalizer/FileEntityNormalizer.php class al L.74 where you have to add a return type this way in order to be working :
public function denormalize($data, $class, $format = NULL, array $serializer_context = array()): array|string|int|float|bool|\ArrayObject|\Drupal\file\Entity\File|NULL

... Or define return type as "mixed"

I guess whether a function return a so mixed and incredible bunch of types we should be entitled to use "mixed" as a return type (no, no, this isn't a sarcasm :) ) as suggested in #10

nikolaat’s picture

StatusFileSize
new16.62 KB

I am migrating to D10 and I have to handle multiple modules, before the actual upgrade of the core.
Here is a patch based on status_upgrade checks and previous patches here.
It is for 3.0.0-beta1 version.
It is possible to have additional work when the upgrade to D10 is done.

nikolaat’s picture

StatusFileSize
new16.62 KB
supriyak’s picture

I am migrating some sites from D9 to D10 for that I need to make content_sync compatible with D10.
I tried to apply #9, #20 and #22 patches in my code, but can not make it success. So, creating another one.
Here is a patch based on status_upgrade checks and previous patches here.
It is for 3.0.0-beta1 version.

java008’s picture

StatusFileSize
new17.04 KB

Changing the return type of normalize() method from the previous patch to make it D10 compatible.

java008’s picture

StatusFileSize
new17.88 KB

Updated the previous patch with arguments.

sahal_va made their first commit to this issue’s fork.

zarexogre’s picture

How far off is a drupal 10 version of this module, happy to contribute if more work needed. Thanks

orkutmuratyilmaz’s picture

Any updates on this?

alexbaron77’s picture

Version: 3.0.x-dev » 3.0.0-beta1
Issue tags: +Drupal 10 compatibility update

one up , do someone can merge the patch ?

zarexogre’s picture

I tried the fork 3330173-drupal-10-compatibility-new and on content import via ui got this error so we are not there yet.

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /batch?id=1&op=do_nojs&op=do
StatusText: Internal Server Error
ResponseText: The website encountered an unexpected error. Try again later.TypeError: Drupal\content_sync\Normalizer\FileEntityNormalizer::denormalize(): Return value must be of type ArrayObject|array|string|int|float|bool|null, Drupal\file\Entity\File returned in Drupal\content_sync\Normalizer\FileEntityNormalizer->denormalize() (line 141 of modules/custom/content_sync/src/Normalizer/FileEntityNormalizer.php). Symfony\Component\Serializer\Serializer->denormalize(Array, 'Drupal\file\Entity\File', 'yaml', Array) (Line: 64)
Drupal\content_sync\Importer\ContentImporter->importEntity(Array, Array) (Line: 62)
Drupal\content_sync\Form\ContentSync->syncContent(Array, Array, Array) (Line: 296)

Can we get drupal 10 version working and I will test to confirm, thanks.

ericvl’s picture

@zarexogre
See also comments #10 and #20 (returnvalue must be mixed)
Function denormalize of FileEntityNormalizer calls denormalize of parent ContentEntityNormalizer and there the retunvalue is mixed too.

tobias märz’s picture

StatusFileSize
new135.48 KB

New patch for D10 compatibility.
Based on 3.0.0-beta1 version.

Hopefully i integrated everything required, to get a D10 version out.

orkutmuratyilmaz’s picture

@Tobias März, your patch fails, when try to apply it.

patch -p1 < content_sync_d10_compatiblity.patch
The next patch would create the file LICENSE.txt,
which already exists!  Assume -R? [n] ^C

rm LICENSE.txt

patch -p1 < content_sync_d10_compatiblity.patch
patching file LICENSE.txt
patching file composer.json
patching file content_sync.info.yml
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file content_sync.info.yml.rej
patching file content_sync.libraries.yml
Hunk #1 FAILED at 10.
Hunk #2 succeeded at 23 (offset 1 line).
1 out of 2 hunks FAILED -- saving rejects to file content_sync.libraries.yml.rej
patching file content_sync.module
Reversed (or previously applied) patch detected!  Assume -R? [n] ^C
tobias märz’s picture

StatusFileSize
new56.27 KB

Here is a new patch. Now it is applied correctly.

izus’s picture

patch #35 worked fine for me
Thanks

orkutmuratyilmaz’s picture

Status: Needs work » Reviewed & tested by the community

Patch #35 works. The module works with D10 now. Thank you @Tobias März:)

ericvl’s picture

@Tobias März

Thank you for your great work to make this patch but I have only one remark: this patch is based on an old beta version of Drupal 9. In the mean time, a lot of bugs were solved and modifications were done on the development branch that are not included in your version.
Is it possible to make a patch with your modifications so that the result is Drupal 10 compatible but based on the development branch?
Thank you.
Eric

ericvl’s picture

@Tobias März

I found that merge reauest !10 is ready and have all modification to be compatible to Drupal 10 and PHP 8.1 AND have the latest bug fixes.
If somebody that is capable to merge, merge this in the 3.0 branch, we could have a 3.0 development branch that is D10 compatible.
The problem is here probably that no one is capable of making a fix. What a pitty...
Anyone out there???

blanca.esqueda’s picture

I’ll do the merge to branch 3.0

Regards,
Blanca

ericvl’s picture

@Blanca.Esqueda

Glad you're back.

Be carefull to merge the correct branch. There are a lot of try-outs and you need the correct one. It is merge request !10 in branch 3330173-drupal-10-compatibility-new.

The only 2 thinks that are still to be done before you can make a new release is, I think:
- look at this issue and check the patch in comment #7. With this modification, i'm using it for months now and it fixes the bug.
- changing the module's composer.json file so that it depends on a specific core version. The modifications should be:

"require": {
"drupal/core": "^9.4 || ^10.0"
)

It is not good to having no restrictions on the core version.

Both modifications are tested.

Regards,
Eric

tobias märz’s picture

@Blanca.Esqueda

It would be great to get a new version.

ericvl’s picture

@Blanca.Esqueda

Hello Blanca,

If you don't find the time to make a new D10 compatible version of this great module, could you delegate this work to someone else that can do it. Version 9 of Drupal core doesn't get any security updates anymore now for some months now. So, it is adviced that we upgrade to D10.
Thank you in advance.
Greetings
Eric

zarexogre’s picture

There seems like a D10 version of this module but I have tried the patches and the branches to no joy. Could someone possibly cut a new release for the D10 version please. Epic module appreciate all your work. Or explain how to get the version that works with D10 as had some issues with the patches. Thanks

socieboy’s picture

Any update on this thread?

avpaderno’s picture

Version: 3.0.0-beta1 » 3.0.x-dev

apaderno changed the visibility of the branch 3330173-D10-compatibility-beta to hidden.

apaderno changed the visibility of the branch 3330173-drupal-10-compatibility to hidden.

mjgruta’s picture

Status: Reviewed & tested by the community » Needs work

The latest MR breaks. We have been using this URL as patch: https://git.drupalcode.org/project/content_sync/-/merge_requests/10.diff

[Drupal\Core\Extension\InfoParserException]
Unable to parse modules/contrib/content_sync/content_sync.info.yml yaml_par
se(): scanning error encountered during parsing: could not find expected ':
' (line 8, column 1), context while scanning a simple key (line 7, column 1
)

orkutmuratyilmaz’s picture

Status: Needs work » Reviewed & tested by the community

I've downloaded the 3.0.x-dev release, applied @mjgruta's latest MR (as a patch) and changed the content_sync.info.yml file like below:

name: 'Content Sync'
type: module
description: 'Allows users to import/export content using YAML files.'
package: Custom
core_version_requirement: ^9.4 || ^10.0
configure: content.sync
dependencies:
  - drupal:serialization 

# Information added by Drupal.org packaging script on 2022-12-23
version: '3.0.0-beta1+27-dev'
project: 'content_sync'
datestamp: 1671838601

And activated the module.

It works nice with Drupal 10.3.0-rc1, PHP 8.3.8 and PostgreSQL 16.1 :

Thank you for everything.

orkutmuratyilmaz’s picture

Title: Drupal 10 compatibility update » Drupal 10 & 11 compatibility update

If I change the content_sync.info.yml as below, upgrade status report says that, it is compatible with D11 too.

name: 'Content Sync'
type: module
description: 'Allows users to import/export content using YAML files.'
package: Custom
core_version_requirement: ^9.4 || ^10.0 || ^11
configure: content.sync
dependencies:
  - drupal:serialization 

# Information added by Drupal.org packaging script on 2022-12-23
version: '3.0.0-beta1+27-dev'
project: 'content_sync'
datestamp: 1671838601

Please publish the dev release with this changes:) I'm excited to put this in to my CI/CD flows:)

avpaderno’s picture

Title: Drupal 10 & 11 compatibility update » Drupal 10 compatibility update

Truly, this issue aims to add compatibility only with Drupal 10.

orkutmuratyilmaz’s picture

@apaderno, you're right. Thanks for correcting.

leeksoup’s picture

I'm also hoping for this functionality with D10 compatibility and wondered about the status. Is it planned soon, or should I try as #50?

leeksoup’s picture

Update. I tried the method described by @orkut-murat-yılmaz in #50 but it does not work for me. I get error messages on both cli and GUI attempts to install or uninstall, and nothing for the module appears in my admin/config page under Development (or anywhere).

@orkut-murat-yılmaz - when you said "@mjgruta's latest MR (as a patch)" did you mean e0ef7263 - Update content_sync.info.yml, invalid indentation? That is the one I applied...

I am using Drupal 10.3.2, PHP 8.2.18, MySQL 5.7.23.

Error messages:

# drush pm-install content_sync
 [warning] Drush command terminated abnormally.

GUI install from admin/modules page gives a "This website encountered an unexpected error."

But if I try drush again, then it says it was already installed...

# drush -vv pm-install content_sync
 [info] Drush bootstrap phase: bootstrapDrupalRoot()
 [info] Change working directory to /home2/suchimyj/SUCHIM.stage/web
 [info] Initialized Drupal 10.3.2 root directory at /home2/suchimyj/SUCHIM.stage/web
 [info] Drush bootstrap phase: bootstrapDrupalSite()
 [info] Initialized Drupal site default at sites/default
 [info] Drush bootstrap phase: bootstrapDrupalConfiguration()
 [info] Drush bootstrap phase: bootstrapDrupalDatabase()
 [info] Successfully connected to the Drupal database.
 [info] Drush bootstrap phase: bootstrapDrupalFull()
 [info] Starting bootstrap to none
 [info] Drush bootstrap phase 0
 [info] Try to validate bootstrap phase 0
 [notice] Already enabled: content_sync

Yet, nothing is added to admin pages.

And if I try to uninstall, I get this error:

# drush pmu content_sync

In PmCommands.php line 175:
                                                                                     
  The following module(s) are not installed: content_sync. No modules to uninstall.  

Yet, GUI shows it in Uninstall page. Though trying to uninstall again gets "The website encountered an unexpected error. Try again later." error.
Trying again did work though, contrary to what drush reports.

Help?

This module looks like just what I need right now ... if only I could get it to work. Thanks.

guido_s’s picture

The last information I have from @Blanca.Esqueda is that she already wanted to do a d10 release about a month ago and that she is waiting for some features some other developers are currently working on.
As I didn't get any replies on new messages, I don't know what the current status is.

But my colleague informed me about another module single_content_sync which already has a d10 release and provided everything we needed for our use case.
Maybe this might help some of you which are in need of content sync features for d10. It doesn't support commerce products out of the box though and some other more special field types. But it can be extended.

leeksoup’s picture

@guido_s - Thank you for the update. I hope it will happen soon! Meanwhile, also thanks for the info on single_content_sync. I will give it a try.

vladimiraus’s picture

Seems to me that maintainers are not interested in doing the release.
I contacted them more that a year a ago and the response was exactly the same. 🤖
I'd recommend to people still using it creating a fork for D10 and D11+ support.

leeksoup’s picture

@guido_s = Thank you for the alternative suggestion. The Single Content Sync module works great for my use case!

@vladimiraus - Noted, thanks.

blanca.esqueda’s picture

Status: Reviewed & tested by the community » Fixed

Closing this task as the code has been merged to 3.0.x-dev

Thanks: izus, vladimiraus, NikolaAt, tobias märz, matroskeen, avpaderno, java008, sylvain lavielle, supriyak, sahal_va, mjgruta, orkut murat yılmaz, ericvl, leeksoup, zarexogre, Luke_Nuke, guido_s, socieboy, qzmenko, alexandre.baron@symetris.com

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.