Skip to main content

Documentation: ContentSync plugin

Removed articles and incremental sync

Copying new and changed articles is half the job. A mirror also has to deal with articles that disappear, and on a large site it should not ask for everything every time. The options in this article are part of the PRO edition. Force Resync and Maximum Run Time are in both editions.

Articles that are removed from the source

In the free edition, a copy stays on the target site when its original is removed. Nothing happens to it.

In PRO you decide. Switch on Handle Deleted Articles and choose under Action for Removed Articles what happens to the copy:

  • Move to Trash - the default. The copy goes to the trash of the target site, where you can still get it back.
  • Unpublish - the copy stays, but visitors no longer see it.
  • Permanently Delete - the copy is deleted, with its tags and field values. This cannot be undone.

What counts as removed

ContentSync compares the articles it copied before with the articles the source hands over in this run. A copy whose original is not in that list any more counts as removed.

That is wider than deleted. An article also counts as removed when:

  • it was unpublished on the source, while your state filter asks for published articles;
  • it was moved to a category that your filter does not include;
  • you narrowed a filter in the task yourself.

For a mirror this is usually exactly what you want: what is no longer shown on the source is no longer shown here. But it means a change to a filter can touch many copies at once. Do a dry run first. The log lists every article it would trash, unpublish or delete.

There are safety nets. Removed articles are only handled after a run that got the complete list from the source:

  • When a batch could not be fetched, because the source was slow, down or gave an error, nothing is treated as removed. The articles on the missing batch are not gone, they were just not seen.
  • When the run logged an error, nothing is treated as removed either.
  • When the source hands over no articles at all, nothing is treated as removed.

The log says when and why removal was skipped. The next complete run handles it.

Removed articles and Maximum Run Time

A large sync can be spread over several runs: when Maximum Run Time is up, the run stops and the next one continues with the next batch. A run that continues an earlier one has not seen every article, so it does not handle removed articles. The log says so.

This only matters for a sync that does not fit in one run every time. A first sync is usually the big one, and there are no removed articles yet. If your regular runs are spread over several runs too, raise Maximum Run Time, or set it to 0 for a task that runs from a real cron job, where there is no PHP time limit to worry about.

Incremental sync

A normal run asks the source for every article that passes the filters, and then skips the ones that did not change. On a site with thousands of articles that is a lot of asking.

With Incremental Sync on, the task only asks for articles that were modified since its last successful run. It remembers that moment in Last Sync Watermark (UTC), which it fills in by itself.

Incremental Overlap (minutes) moves that moment a little back in time, to allow for clocks that are not exactly equal on the two servers. The default of 10 minutes is a safe choice.

Two things to know

  • It needs Joomla 6.2 or newer on the source site. An older source ignores the question and hands over everything. See Joomla 5 and Joomla 6.
  • An incremental run does not handle removed articles. It only sees what changed, so it cannot tell what is gone. The log says so when both options are on.

To get both, use two tasks for the same source: one incremental task that runs often, and one full task with Handle Deleted Articles that runs once a day or once a week. Or clear the watermark field now and then, which makes the next run a full one.

Force Resync

Force Resync makes one run process every article again, whether it changed or not. The switch turns itself off after that run.

Use it after you changed something that applies to articles that were already copied:

  • a mapping for categories, tags, authors or access levels;
  • switching on custom fields, or documents and media;
  • the HTML filter or link rewriting.

A forced run overwrites every copy with the source version. Changes made by hand on the target site are lost.