talerbarrsync.php
\file core/sync/talerbarrsync.php \ingroup talerbarr \brief Main file that handles the logic of sync between 2 systems
Table of Contents
Constants
- NOSESSION = 1
- Background synchroniser for the Taler-Barr module.
Functions
- writeStatus() : void
- Persist a human-readable sync status JSON file.
- cleanOrphanProductLinks() : array{checked: int, deleted: int, errors: int}
- Remove stale product_link rows: - links pointing to a deleted Dolibarr product - links that no longer exist on Taler
Constants
NOSESSION
Background synchroniser for the Taler-Barr module.
public
mixed
NOSESSION
= 1
Runs from CLI or by an async exec() call.
Refuses to start when another run is in progress (flock lock).
Writes human-readable progress into DOL_DATA_ROOT.'/talerbarr/sync.status.json'.
Normally you are not supposed to call it directly, only through the lib TalerSyncUtil class.
Usage examples php talerbarrsync.php – normal run, auto-detect direction php talerbarrsync.php --force – ignore stale lock file
Functions
writeStatus()
Persist a human-readable sync status JSON file.
writeStatus(array<string|int, mixed> $s) : void
Parameters
- $s : array<string|int, mixed>
-
Arbitrary status payload to serialize; function adds an RFC date in "ts".
cleanOrphanProductLinks()
Remove stale product_link rows: - links pointing to a deleted Dolibarr product - links that no longer exist on Taler
cleanOrphanProductLinks(DoliDB $db, string $instance, array<string|int, mixed> $remoteIds, User $user) : array{checked: int, deleted: int, errors: int}
Parameters
- $db : DoliDB
-
DB handler
- $instance : string
-
Taler instance id
- $remoteIds : array<string|int, mixed>
-
Product ids seen on Taler during this run
- $user : User
-
Current user