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.
| Table | Role |
|---|---|
cron_queue | doc_drive_sync, doc_zip_unpack, doc_recognise rows |
job table (system/job model) | record of the sync request |
doc | the resulting documents |
Drive sync
drivesync: a job row (addDocJob) and a one-offdoc_drive_syncqueue row for the chosen client (a super admin without client: everyone); the answer gives the row number and – withsystem/joblistvisibility – the link to the job list.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 withdocument/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
unpackzip:zipextension only; for a ZIP on the Drive by its Drive id, for a local ZIP via a temporary copy (≤300 MB), it starts adoc_zip_unpackjob; selectable target root (account/drive/folder or local directory + subfolder); the ZIP is kept (keep_archive).doc_zip_unpack(one-off; started by upload or row action): within a time budget, entry by entry, loads the PDF into the sharedaddDocument()with the chosen storage rule, queues it for recognition, then starts adoc_recognisejob; the rest continues as a new row; at the end the ZIP is deleted (unlesskeep_archive); the user is notified.
Permissions
drivesync(UNMAPPED, missing from the catalogue list) + coremodify; a restricted user must choose a client (error_drivesync_company), within scope.unpackzip(UNMAPPED) + coremodify+ scope.