Search by

se7enxweb / ocdropbox

7x

Exponential extension, an unfinished prototype of a Dropbox folder importer: a cronjob that creates folders and files from a Dropbox folder in the content tree, and an admin tab to connect a Dropbox account.

1.0-alpha 2026-10-22 06:21 UTC

This package is auto-updated.

Last update: 2026-10-22 07:52:23 UTC


README

Status: unfinished prototype (1.0-alpha). This extension does not work as shipped. It is published so the code stays available to anyone who wants to finish it. Read Current state before you install it.

ocdropbox was started as a Dropbox importer for Exponential. The idea:

  1. An administrator connects a Dropbox account from an admin tab.
  2. A cronjob reads one Dropbox folder and its subfolders.
  3. Every Dropbox folder becomes a container object (a folder by default) and every file becomes a content object, created the same way as a file uploaded in the admin, under one node of the content tree.
  4. A table remembers what was imported, so later runs update only the files that changed in Dropbox.

It is aimed at developers who want a starting point for a Dropbox import, not at site editors looking for a finished tool.

Contents

Current state

The code was left in the middle of a move between two Dropbox libraries:

  • The importer (classes/ocdropbox.php) and modules/dropbox/bootstrap.php use the classes \Dropbox\API, \Dropbox\OAuth\Storage\Encrypter, \Dropbox\OAuth\Storage\Session and \Dropbox\OAuth\Consumer\Curl. None of them is part of the extension, so the cronjob stops with a fatal error.
  • lib/Dropbox holds a Dropbox SDK for PHP that talks to Dropbox API v1 (1/oauth/..., 1/account/info) and forces SSL v3 in lib/Dropbox/Curl.php. Dropbox has since retired API v1, and current servers refuse SSL v3.
  • The dashboard view (modules/dropbox/dashboard.php) uses an application key and secret written into the code instead of the ones in dropbox.ini, sends Dropbox a fixed development callback address, prints the access token and the account data with print_r(), and never renders its template dropbox/dashboard.tpl.
  • The key and secret in settings/dropbox.ini and in dashboard.php belong to an old Dropbox application. Do not rely on them; create your own Dropbox app.

Requirements

  • Exponential 6.x (the legacy kernel)

  • PHP 8.0 or later with the curl and json extensions

  • A MySQL or MariaDB database (the extension ships only a MySQL table definition)

  • The admin siteaccess design chain must contain admin2, because the extension's templates live in design/admin2:

    [DesignSettings]
    AdditionalSiteDesignList[]=admin2

Installation

With Composer

composer require se7enxweb/ocdropbox:1.0-alpha

The Exponential legacy installer places the extension in extension/ocdropbox. If Composer cannot find the package, add the repository to the repositories list of your composer.json first:

{
    "type": "vcs",
    "url": "https://github.com/se7enxweb/ocdropbox"
}

By hand

  1. Clone or download the extension into extension/ocdropbox:

    git clone https://github.com/se7enxweb/ocdropbox.git extension/ocdropbox
  2. Create the table that tracks imported items:

    mysql -u <user> -p <database> < extension/ocdropbox/sql/mysql/schema.sql
  3. Activate the extension in settings/override/site.ini.append.php:

    [ExtensionSettings]
    ActiveExtensions[]=ocdropbox
  4. Regenerate the autoload array and clear the caches:

    php bin/php/ezpgenerateautoloads.php -e
    php bin/php/ezcache.php --clear-all

Configuration

The importer reads extension/ocdropbox/settings/dropbox.ini. Override it in settings/override/dropbox.ini.append.php:

[DropBoxConfig]
# The key and secret of your Dropbox application
ConsumerKey=<your app key>
ConsumerSecret=<your app secret>

# The Dropbox folder the import starts from
DropBoxBasePath=published

# The class of the object created for a mapped Dropbox folder (default: folder)
# MapDropboxFolder[<Dropbox folder name>]=<class identifier>
MapDropboxFolder[]
MapDropboxFolder[published]=folder

# The class of the objects created for every subfolder of a mapped folder
# MapDropboxSubFolder[<Dropbox folder name>]=<class identifier>
MapDropboxSubFolder[]
MapDropboxSubFolder[published]=article

# The node the import creates its folders and files under (default: 2)
ImportDropBoxRootNode=2

The dashboard also reads AccessType (FullDropbox, the default, or AppFolder) from the same group.

Files are created through the kernel's upload handling, so the class used for each file type comes from upload.ini ([CreateSettings] MimeClassMap[]), as for a file uploaded in the admin.

The extension also registers:

  • the cronjob part dropbox (settings/cronjob.ini.append.php), which runs cronjobs/dropbox.php;
  • the cache item dropbox (settings/site.ini.append.php), the directory under the cache directory where downloaded files are stored before they are imported. Clear it with php bin/php/ezcache.php --clear-id=dropbox.

Usage

These are the steps the extension was designed for. With the code as it is they do not complete (see Current state).

  1. Open the Dropbox tab in the admin. In the admin4 design it shows the cloud-arrow-down icon (Icon=cloud-arrow-down in settings/menu.ini.append.php). The tab opens /dropbox/dashboard, which sends you to Dropbox to allow access.

  2. The access token is stored in the ezsite_data table under the name dropbox_token.

  3. Run the import:

    php runcronjobs.php dropbox

    The importer logs what it creates, updates or skips.

  4. /dropbox/disconnect removes the stored token and returns to the dashboard.

Permissions

Function View
dropbox/dashboard dashboard (and the admin tab)

The disconnect view has no function of its own.

What is in the extension

Path Purpose
classes/ocdropbox.php OCDropbox, the importer
classes/ocdropboxobject.php OCDropboxObject, a persistent object for the ezdropbox table
cronjobs/dropbox.php The cronjob part dropbox
modules/dropbox/ The dashboard and disconnect views
design/admin2/templates/ The dashboard and its left menu
lib/Dropbox/ Dropbox SDK for PHP (API v1)
sql/mysql/schema.sql The ezdropbox table

Finishing the extension

Anyone who wants to make it work needs at least to:

  1. Replace lib/Dropbox and the missing \Dropbox\API / OAuth classes with a client for the current Dropbox API (v2, OAuth 2).
  2. Read the key, secret and callback address from dropbox.ini in dashboard.php, store the token, and render dropbox/dashboard.tpl with the variables it expects (list, parent, account, noParentList).
  3. Give disconnect a policy function.

Pull requests are welcome.

Contributing

Issues and pull requests: https://github.com/se7enxweb/ocdropbox.

License

GNU General Public License v2.0. See LICENSE.

Credits and history

ocdropbox was started by OpenContent (http://www.opencontent.it) in 2011 for eZ Publish 4, the content management system eZ Systems developed until its creator discontinued it. 7x maintains the code for Exponential, which continues that code base. See CHANGELOG.md.