Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Contao News Sync

Contao extension to automatically synchronize news entries between different installations.

Configuration

Install the extension on all Contao installations involved in the news synchronisation. After installation, you will see additional options in your Contao news archives under Synchronisation. In order to enable a news archive to be a source for the synchronisation, simply activate the Source for synchronisation option.

Then, on the target news archive, enable the Target for synchronisation option. You will then see additional options. Under Source URL fill in the URL to the Contao installation, from which you want to fetch news entries. Then save the news archive. After saving you will see the available news archives from the remote Contao installation under News archives. Enable the remote news archives from which you want to fetch news entries, then save again.

Synchronization

There are three different ways for news entries to be fetched from the remote server.

Command

On the console you can run the following command:

vendor/bin/contao-console contao_news_sync:import

Note: by default this will only fetch news that have been created after the last news entry you already imported. If you want to fetch all news from the remote server again you can use the additional option --fetch-all. This will not create duplicate entries.

Back end

In the news archive section of the Contao back end you will find a new Fetch news button. This will also trigger the import of news from the remote server. Note: by default this will also only fetch news that have been created after the last news entry you already imported. There is no way to override this.

Cronjob

The import of news is triggered hourly via Contao's own cronjob mechanic.

Troubleshooting

Look for any messages in the system log as well as the logs in var/logs.

Security note

When a news archive is enabled as the source for synchronisation, it exposes its news entries, categories and content elements to the public. Be sure to not enable this feature for any content that would be otherwise protected and only accessible for frontend members when logged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.