Drive sync and ZIP unpacking – system description

Starting the Drive → document centre sync and its background job, and the ZIP unpacking row action with its chunked background job.

Both functions run as jobs in the job queue: the Drive sync registers the folders of the client's Drive storage rules as records, the ZIP unpacking loads the package's PDFs through the shared document intake path.

Data model

Table names carry the installation's own prefix in the database.

TableRole
cron_queuedoc_drive_sync, doc_zip_unpack, doc_recognise rows
job table (system/job model)record of the sync request
docthe resulting documents

Drive sync

  1. drivesync: a job row (addDocJob) and a one-off doc_drive_sync queue row for the chosen client (a super admin without client: everyone); the answer gives the row number and – with system/job list visibility – the link to the job list.
  2. doc_drive_sync (hourly too, immediately via the button): walks the folders of the client(s)' Drive storage rules in full depth and creates a record with document/document::addDoc() for every file without one (the file stays on the Drive); Google's own formats are skipped; the file of a trashed document counts as known; chunked run, one notification at the end.

ZIP unpacking

  1. unpackzip: zip extension only; for a ZIP on the Drive by its Drive id, for a local ZIP via a temporary copy (≤300 MB), it starts a doc_zip_unpack job; selectable target root (account/drive/folder or local directory + subfolder); the ZIP is kept (keep_archive).
  2. doc_zip_unpack (one-off; started by upload or row action): within a time budget, entry by entry, loads the PDF into the shared addDocument() with the chosen storage rule, queues it for recognition, then starts a doc_recognise job; the rest continues as a new row; at the end the ZIP is deleted (unless keep_archive); the user is notified.

Permissions

  • drivesync (UNMAPPED, missing from the catalogue list) + core modify; a restricted user must choose a client (error_drivesync_company), within scope.
  • unpackzip (UNMAPPED) + core modify + scope.