EDocman Dropbox plugin

The Edocman - Dropbox plugin allows you to integrate Edocman with Dropbox. As you know, Dropbox is a service that keeps your files safe, synced, and easy to share. Storing Edocman documents on a third party storage like Dropbox helps you reduce the disk space used on your server, and the documents are stored safely.

Since version 4.2.0 the plugin works in two directions:

  • Edocman → Dropbox: files uploaded in Edocman are stored on Dropbox, downloads are streamed from Dropbox, and deleting a document in Edocman removes its file from Dropbox.
  • Dropbox → Edocman: a background job scans the Dropbox Root Path and imports new files into Edocman as documents, choosing the category automatically from the folder the file is in.

This is a storage and import integration. It is not real-time synchronization and not a full two-way mirror. Changes made on Dropbox are noticed by the next scan, and deleting, moving or editing content is not mirrored in both directions (see What is and is not synchronized).

Feature overview

Feature What it does
Upload to Dropbox Single, Ajax and Batch uploads in Edocman store the file on Dropbox.
Download via Edocman Downloads are streamed from Dropbox through Edocman, so Edocman access rules still apply.
Automatic import from Dropbox A Joomla Scheduled Task or a Joomla CLI command scans the Root Path and creates Edocman documents for new files.
Automatic category matching The folder of a file (relative to the Root Path) must be equal to the Path of an existing Edocman category.
Bounded background processing Each run has limits (files, folders, changes, seconds), saves a checkpoint in the database, resumes in the next run, and never imports the same Dropbox file twice.

Important safety rules, verified in the plugin code:

  • Imported documents are always created Unpublished. Review and publish them manually.
  • The plugin never creates categories. Files whose folder has no matching category are skipped.
  • Dropbox sharing permissions are not translated to Joomla ACL. Access comes from the category (or the plugin default access level).
  • A file that disappears from Dropbox never deletes the Edocman document; only the internal link is marked as missing.
  • A sync run never uploads files and never deletes files on Dropbox.

Requirements

  • PHP 8.1 or higher (also for the PHP CLI binary used by cron).
  • The Dropbox to Edocman import requires EDocman - Dropbox 2.5.0 or later. Database tables for the import are created by the plugin install/update; if System -> Maintenance -> Database reports a problem, press Fix. MySQL/MariaDB only.
  • The PHP curl extension, and an outbound network connection from your server to Dropbox.
  • Optional runners (install and enable only the one you will use):
    • Task - Edocman Dropbox Sync (plg_task_edocmandropboxsync): needs the Joomla Scheduler, available from Joomla 4.1.
    • Console - Edocman Dropbox Sync (plg_console_edocmandropboxsync): needs Joomla 4.0 or later and SSH/cron access to run php cli/joomla.php.

How to setup

You should go to Extensions -> Plugins to filter "Edocman - Dropbox plugin" and enable it.

The Dropbox plugin works based on Dropbox API. So you should create the Dropbox Application to get Application Key, Secret and Access token. To create the Dropbox Application, please following these steps:

  1. First of all, access your account, specifically in the reserved area where you can configure an App, from this address: https://www.dropbox.com/developers/apps/create

  2. Click on “App console” in the left menu and then select “Dropbox API app”. Set the various options like shown in the image (click to enlarge it), give a name to the App and click on Create app button.

  3. Enable the Following Permissions
    To allow Edocman to upload files, create folders, delete folders/files, and copy files, make sure you check (enable) these permissions:

    • files.content.write (Allows the app to upload, modify, move, or delete files and folders.)
    • files.content.read (Allows the app to read file content and metadata.)
    • files.metadata.write (Allows the app to create, move, and delete folders and files.)
    • files.metadata.read (Allows the app to read file and folder metadata.)
  4. After creation, you will see your App information, including the App key (client_id) and App secret.

  5. Register the Redirect URI: open the Edocman Dropbox plugin in Joomla, copy the read-only Redirect URI (<your site>/administrator/index.php?option=com_edocman&task=dropbox.callback) and add it in the Dropbox App Console (Settings -> Redirect URIs).

  6. Connect: enter App Key and App Secret, save the plugin, then click Connect (or Reconnect). Log in to Dropbox and allow access. You are redirected back to Joomla and the status shows that the plugin is connected. The Refresh Token is stored automatically; you do not need to copy any authorization code.

  7. Click Test Connection to verify that the root folder can be reached. Disconnect removes the stored connection (files on Dropbox are not touched).

Plugin Parameters

Connection and storage (tab "Basic")

PropertyDescription
App Key Dropbox Application key.
App Secret Dropbox Application secret. Saving the form without changing it keeps the stored value.
Redirect URI Read-only. Register this exact URL as a Redirect URI in the Dropbox App Console.
Root Folder (inside the Dropbox 'edocman' folder) The Root Path. All Edocman documents are stored in the Dropbox folder edocman/<Root Folder>; when the field is empty the Root Path is the edocman folder itself. You can enter a sub-folder, for example /edocment1. The same folder is the starting point of the Dropbox to Edocman scan. Changing it makes documents uploaded earlier unreachable and starts a new scan cycle; files are never moved automatically.
Connect / Test Connection / Disconnect Buttons that start the OAuth connection, check it (read-only) and remove it.

Dropbox to EDocman sync (tab "Dropbox to EDocman sync")

PropertyDescription
Enable sync Default No. When off, the console command and the scheduled task do nothing (status disabled).
Default owner Owner of imported documents. If the Edocman configuration option for owner inheritance is on and the category has owners, the category owners are used instead.
Default access Default 2. Used only when the category has no access level. Otherwise the category access level is used.
Max file entries per run Default 100. Dropbox file entries examined in one run, whether imported, already known, skipped or not matching a category.
Max folder entries per run Default 100. Dropbox folder entries examined in one run. Deleted entries and end-of-cycle checks have a separate limit equal to files + folders.
Max seconds per run Default 30. Time budget, checked between units of work. A Dropbox request that is already running is not interrupted, so a run can slightly overrun it.
Max changes per run Default 100. Additional limit on changes applied in one run (import, link, update, rename, missing...). It does not replace the file/folder limits.
Allowed extensions Comma separated, for example pdf,docx,xlsx. Empty means Edocman's Allowed file types. Script-type extensions (php, phtml, sh, py, ...) are always rejected.
Max file size (MB) 0 means only Edocman's upload limit applies. The smaller of this value and Edocman's limit is used; larger files are skipped.

Order of precedence for limits: a valid override from the Scheduled Task or the CLI option (a positive whole number) → the plugin parameter → the built-in default (100 files / 100 folders / 30 seconds / 100 changes). Empty, 0, negative or non-numeric values never mean "unlimited".

The old manual Folder → Category mapping is no longer used; category matching is automatic (see below). Old values stored in the database are ignored.

Category matching and Root Path

A file is imported only when the folder it is in has exactly the same path as an Edocman category. The category Path is the field on the category edit form (for example products/manuals).

Example

Root Folder in the plugin: /edocman (Root Path in Dropbox: /edocman).

Dropbox file Path relative to Root Path Category Path required Result
/edocman/products/manuals/guide.pdf products/manuals/guide.pdf products/manuals Imported into that category as an Unpublished document titled guide.
/edocman/products/readme.pdf products/readme.pdf products Imported only if a category with Path products exists; otherwise skipped.
/edocman/readme.pdf readme.pdf (none) Skipped: files directly under the Root Path have no folder path to match.
/edocman/news/2025/report.pdf news/2025/report.pdf news/2025 Skipped if there is no category with Path news/2025, even when a category news exists. There is no parent fallback.

Matching rules

  • The Root Path itself is never part of the compared path: for Root Path /edocman and file /edocman/products/manuals/guide.pdf the folder to match is products/manuals.
  • The whole folder path must be equal to the category Path. Category title, alias or only the last folder name are never used.
  • Both sides are normalised the same way before comparing: \ becomes /, repeated, leading and trailing slashes are removed, Unicode is normalised (NFC) and the text is lower-cased. Paths with .. or control characters never match.
  • A folder without a matching category does not stop the scan of its sub-folders: every file is matched on its own folder.
  • A file with no matching category is skipped (it is reported as skipped (no category), nothing is created) and is evaluated again in every later cycle, so it is picked up after you create the category.
  • If two or more categories have the same normalised Path, files in that folder are skipped and reported as ambiguous category path. Make the Paths unique.
  • The backup folder directly under the Root Path (used by Edocman for document version backups) is never imported. Files outside the Root Path are ignored.
  • The Dropbox sharing permissions of a folder or file are not mapped to Joomla ACL.

What an imported document looks like

  • Unpublished, in the matching category, title = file name without extension.
  • Access level = the category access level, or Default access of the plugin if the category has none. Owner = Default owner (or the category owners when owner inheritance is on).
  • The file is not copied or uploaded again; the document points at the existing Dropbox file and is downloaded from Dropbox like any other document of this plugin.
  • No notification e-mails are sent by the background import.
  • Files with a disallowed type or name, or larger than the size limit, are skipped.

Use Hierarchical Folder Structure vs. category Path

These two settings are different:

  • Use Herachical Folder Structure (Edocman configuration) decides where new uploads are stored: with it on and a category Path set, the file is uploaded to <Root Path>/<category Path>/; otherwise directly to the Root Path.
  • The category Path is also what the automatic import uses to find the category of a Dropbox file. It works whether or not the hierarchical structure option is on.

To keep both directions consistent, turn the hierarchical option on and give each category a Path that is the same as its Dropbox folder.

What is and is not synchronized

Situation on Dropbox Behaviour
New file in a folder that matches a category New Unpublished document.
File content changed The document's file size and link are updated. Title, owner, access, category and published state are never changed.
File renamed or moved inside the Root Path The same document is kept and its file link is updated; no duplicate. The category is not changed.
File deleted The internal link is marked missing at the end of a scan cycle. The Edocman document is not deleted.
File moved outside the Root Path or into backup The internal link is marked out_of_scope.
Missing file comes back (same Dropbox file ID) The link is restored.
A different file appears at the old path A conflict is recorded; the new file is not merged with the old document.
Edocman document renamed/changed after import If the document no longer matches the mapped file name, the Dropbox change is not applied and a conflict is recorded.

Not supported: webhooks or real-time sync, propagating Edocman changes (rename, move, content edit) to Dropbox, deleting Edocman documents because of Dropbox, multiple Dropbox accounts. Documents uploaded from Edocman remember their Dropbox file ID so they are not imported again; documents with the same file name that already exist are linked rather than duplicated (only when the name matches exactly).

Set up the Joomla Scheduled Task

Use this method if you want Joomla to run the import on a schedule.

  1. Install and enable EDocman - Dropbox (2.5.0 or later), then install and enable Task - Edocman Dropbox Sync in System -> Manage -> Plugins (filter by "Dropbox").
  2. Open the EDocman - Dropbox plugin, tab Dropbox to EDocman sync, set Enable sync to Yes, review the limits and save.
  3. Create the categories whose Paths match the Dropbox folders you want to import.
  4. Open the Scheduled Tasks page: System -> Scheduled Tasks (Joomla 4.1 and later; in the System dashboard it is in the "Manage" group).
  5. Click New and choose the task type Edocman Dropbox Sync (routine id edocman.dropbox.sync).
  6. Give it a title, set the execution interval (for example every 5 or 10 minutes) and make sure the task is enabled.
  7. Optional overrides on the task form: Max file entries, Max folder entries, Max changes, Max seconds. Leave a field empty (or 0) to use the plugin value. Keep Max seconds below the PHP max_execution_time. The task has no dry-run option.
  8. Save, then use Run Test on the task. The task only reports success or failure to the Scheduler. The details are written to the Joomla log file plg_edocman_dropbox.php when something changed or failed (see Logs).

The task returns a failure status only for real errors. A held lock, disabled sync, rate limit or a budget stop are reported as normal completion, and the next run continues.

Make sure the Scheduler really runs

A task's schedule does not create an always-running background process. Joomla only executes due tasks when something triggers the Scheduler:

  • Lazy Scheduler (default): due tasks run when visitors open the site. On a quiet site tasks can run late.
  • Web Cron: enable it in Scheduled Tasks -> Options, then copy the Web Cron URL that Joomla shows there (it contains a secret key; do not make up or share this URL) and call it from an external cron service or from cron with curl/wget. No visitor is needed.
  • Server cron with Joomla CLI: run php /path/to/joomla/cli/joomla.php scheduler:run from cron. Use php cli/joomla.php scheduler:run --help on your site to see the options of your Joomla version.

Set up the Console command on hosting

The Console - Edocman Dropbox Sync plugin registers a command in the Joomla CLI. It is run with PHP on the command line (php cli/joomla.php ...), not by opening a PHP file in the browser, and there is no public URL for it.

  1. Install and enable EDocman - Dropbox (2.5.0 or later) and Console - Edocman Dropbox Sync (plg_console_edocmandropboxsync). Enable sync in the Dropbox plugin as above.
  2. Open Terminal/SSH in the Joomla root and check that the command is registered:
php cli/joomla.php list edocman
php cli/joomla.php edocman:dropbox:sync --help
  1. Run a dry-run first (add -v to see messages):
php cli/joomla.php edocman:dropbox:sync --dry-run -v
  1. Run it normally:
php cli/joomla.php edocman:dropbox:sync
  1. Override the limits for one run and show details:
php cli/joomla.php edocman:dropbox:sync --max-files=200 --max-folders=50 --max-items=50 --max-seconds=40 -v
Option Meaning
--dry-run Report what would change without creating or changing documents, mappings or the checkpoint.
--max-files=N Limit of file entries examined in this run.
--max-folders=N Limit of folder entries examined in this run.
--max-items=N Limit of changes applied in this run.
--max-seconds=N Time budget of this run in seconds.
-v, -vv, -vvv Standard Joomla/Symfony verbosity (more messages).

Each number must be a positive whole number; otherwise the command stops with exit code 2. Exit code 0 means finished, nothing to do, or skipped (locked, disabled, rate limited); exit code 1 means an error (not configured, tables missing, Dropbox/authentication failure, lost lock). No token or secret is ever passed on the command line.

Cron Jobs in cPanel

In cPanel open Cron Jobs, choose a schedule (for example Once Per Five Minutes, */5 * * * *) and enter a command like this, using your own values:

*/5 * * * * /path/to/php-cli /home/ACCOUNT/public_html/cli/joomla.php edocman:dropbox:sync >> /home/ACCOUNT/logs/edocman-dropbox-sync.log 2>&1
  • ACCOUNT: your hosting account name. /home/ACCOUNT/public_html is only a placeholder for the folder that contains cli/joomla.php; use your real Joomla path.
  • /path/to/php-cli: the PHP CLI binary matching your Joomla/PHP version. This path is different on every hosting provider (for example some use /usr/local/bin/ea-php83, others /usr/bin/php8.3); ask your host or check the PHP version selector, and test with /path/to/php-cli -v.
  • Create the log folder outside the public web root (for example /home/ACCOUNT/logs), make sure the account can write to it, and set up log rotation (or truncate it regularly), because the file grows with every run.

Conditions: your hosting must allow cron jobs and PHP CLI; the CLI PHP must be 8.1 or higher with the extensions Joomla needs (including curl) and a suitable memory_limit (the CLI uses its own php.ini; check with php --ini); the server must reach Dropbox over the network. No browser needs to be open.

Scheduler cron or direct command: choose one

There are two different ways to run the import automatically:

  1. Cron calls the Joomla Scheduler, which runs every due task (including this one).
  2. Cron calls edocman:dropbox:sync directly.

Pick one main method. If the Scheduler is already driven reliably by cron/Web Cron, use the Scheduled Task. If you do not use the Scheduler, use the direct command. If both run, they share one database lock (a lease row in #__edocman_dropbox_sync_state, expiring after 300 seconds and extended while the run is active), so only one runs at a time and the other ends with status locked and changes nothing; this is safe but wasteful. An abandoned lock is released automatically once the lease expires.

How a scan works

  • Each run works inside its limits (files, folders, changes, seconds) and then stops.
  • The position (checkpoint) is saved in the database after each processed entry. The next run continues from it; the scan of a large Dropbox tree may therefore need many runs.
  • A cycle is complete only when all pages of the Dropbox listing were processed and the final check of linked files (marking missing / out-of-scope files) is finished.
  • The run after a completed cycle starts a new cycle from the beginning, so files that were skipped earlier (for example no category yet) are evaluated again. The plugin does not run continuously and changes on Dropbox are noticed only by the next cycle.
  • Reaching a limit is not an error. The result is partial with a stop reason such as max_files, max_folders, max_changes or max_seconds, and "work remaining". The max-files and max-folders limits count entries examined (including skipped ones); the max-changes limit counts changes applied (imports, links, updates...).
  • A failing file keeps the checkpoint on that entry and is retried in the next run until the cause is fixed.

Dry-run

A dry-run reads the settings and Dropbox and reports what would happen, within the same limits. It does not create or update documents, mappings, checkpoint or cycle state, and it does not run the final check, so it never completes a cycle. It is not completely free of side effects: it may refresh and store the OAuth access token and it takes and releases the operational lock. Dry-run is available only in the CLI command.

Result and logging

The CLI prints the status and a summary line: files/folders examined, imported, linked, updated, renamed/moved, restored, missing, out of scope, skipped (no category), skipped (policy), ambiguous category path, conflicts, errors, pages, cycle completed, work remaining and stop reason. Statuses are ok, partial, rate_limited, locked, disabled, not_ready, lease_lost and error.

Logs

  • Plugin log: plg_edocman_dropbox.php in the Joomla log folder (default administrator/logs, or the folder set in System -> Global Configuration -> Server -> Path to Log Folder). It records errors (an identical repeated error is logged once) and one summary line for a run that changed something or completed a cycle. Tokens and secrets are redacted.
  • The CLI prints the details to the terminal or to the cron output file.
  • The Scheduled Task only reports success/failure to the Scheduler; use the plugin log for details.
  • Do not enable extra debug logging for this plugin: the code contains disabled debug blocks that are not meant for production use.

Troubleshooting

Problem What to check
File is not imported Is Enable sync on? Is the file type allowed and under the size limit? Is the folder's relative path equal to a category Path? Run the CLI with --dry-run -v; the skipped messages show the reason. Files directly under the Root Path are never imported.
Category Path does not match Compare the Dropbox folder relative to the Root Path with the category Path (case is ignored, the whole path must match, no parent fallback). Check duplicate category Paths (ambiguous category path). Create the category and wait for the next cycle.
Document is Unpublished This is intended. Review and publish imported documents manually.
Task does not run by itself The task must be enabled and the Scheduler must be triggered: Lazy Scheduler needs site traffic; otherwise use Web Cron or server cron.
Budget reached but work remains Normal (partial). The next run continues. Raise the limits slowly or run more often. A run stopped by max_seconds may be caused by slow Dropbox responses.
Status locked Another run (task or CLI) holds the lock. Wait; a stale lock expires after 300 seconds. Avoid running both a Scheduler cron and a direct cron.
OAuth / API / rate-limit errors Use Test Connection; Reconnect if the authorisation expired; check the App Key/Secret, permissions and the Redirect URI. rate_limited is not a failure: the checkpoint is kept and the next run continues. Check plg_edocman_dropbox.php.
status: not_ready The sync tables are missing or outdated: update the plugin or use System -> Maintenance -> Database -> Fix.
"Command not defined" / CLI command not found The Console - Edocman Dropbox Sync plugin is not installed or enabled, or you ran the wrong Joomla path/PHP binary. Check with php cli/joomla.php list edocman.
Cron produces no output Check the cron log file path and permissions, and run the same command by hand with the same PHP binary.

Notes on remaining limitations

  • The import has automated tests with fake services; running it against a real Joomla and Dropbox account should be checked on your site first (start with a dry-run).
  • Whether thumbnails and search-index entries are generated for imported documents has not been verified; the background import does not send notification e-mails.
  • The behaviour of Web Cron and scheduler:run options depends on the Joomla version; verify them on your site.


When you turn on this plugin, the documents will be uploaded into your Dropbox account through Single upload, Ajax upload and Batch upload. Downloads are streamed from Dropbox.


When you delete documents from Edocman, the document files on Dropbox will be removed too. A synchronisation run never deletes Dropbox files.