se7enxweb / ocdropbox
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.
Package info
github.com/se7enxweb/ocdropbox
Type:ezpublish-legacy-extension
pkg:composer/se7enxweb/ocdropbox
Fund package maintenance!
Requires
- php: >=8.0
- ext-curl: *
- ext-json: *
- se7enxweb/ezpublish-legacy-installer: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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:
- An administrator connects a Dropbox account from an admin tab.
- A cronjob reads one Dropbox folder and its subfolders.
- Every Dropbox folder becomes a container object (a
folderby 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. - 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
- Requirements
- Installation
- Configuration
- Usage
- Permissions
- What is in the extension
- Finishing the extension
- Contributing
- License
- Credits and history
Current state
The code was left in the middle of a move between two Dropbox libraries:
- The importer (
classes/ocdropbox.php) andmodules/dropbox/bootstrap.phpuse the classes\Dropbox\API,\Dropbox\OAuth\Storage\Encrypter,\Dropbox\OAuth\Storage\Sessionand\Dropbox\OAuth\Consumer\Curl. None of them is part of the extension, so the cronjob stops with a fatal error. lib/Dropboxholds a Dropbox SDK for PHP that talks to Dropbox API v1 (1/oauth/...,1/account/info) and forces SSL v3 inlib/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 indropbox.ini, sends Dropbox a fixed development callback address, prints the access token and the account data withprint_r(), and never renders its templatedropbox/dashboard.tpl. - The key and secret in
settings/dropbox.iniand indashboard.phpbelong 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
curlandjsonextensions -
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 indesign/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
-
Clone or download the extension into
extension/ocdropbox:git clone https://github.com/se7enxweb/ocdropbox.git extension/ocdropbox
-
Create the table that tracks imported items:
mysql -u <user> -p <database> < extension/ocdropbox/sql/mysql/schema.sql
-
Activate the extension in
settings/override/site.ini.append.php:[ExtensionSettings] ActiveExtensions[]=ocdropbox -
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 runscronjobs/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 withphp 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).
-
Open the Dropbox tab in the admin. In the admin4 design it shows the
cloud-arrow-downicon (Icon=cloud-arrow-downinsettings/menu.ini.append.php). The tab opens/dropbox/dashboard, which sends you to Dropbox to allow access. -
The access token is stored in the
ezsite_datatable under the namedropbox_token. -
Run the import:
php runcronjobs.php dropbox
The importer logs what it creates, updates or skips.
-
/dropbox/disconnectremoves 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:
- Replace
lib/Dropboxand the missing\Dropbox\API/OAuthclasses with a client for the current Dropbox API (v2, OAuth 2). - Read the key, secret and callback address from
dropbox.iniindashboard.php, store the token, and renderdropbox/dashboard.tplwith the variables it expects (list,parent,account,noParentList). - Give
disconnecta 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.