Sync

Sync is very useful when you are importing or modifying files directly on the file system, e.g. with FTP. It basically compares the File Info (file size, modification time and MD5 checksum) stored in the database with the actual files.

New files will be added automatically, including ID3 tag detection and thumbnail generation. For files in sub-directories Sync creates the Category tree, i.e. for “folder1/subfolder/file.pdf” it creates the category named “subfolder” and it’s parent category “folder1”.

You find the Tool on WP-Filebase Dashboard:

Where to find the Sync Button

The Mechanism

Sync can be divided in mutliple steps:

  1. At first the plugin checks for changed or deleted files. In normal sync operation it just compares sizes and modification dates to detect a file changed. In hash sync it compares the MD5 hashes, which is more reliable, but can take much more time. When a file change is detected, it updates the values in the database including extended file info (ID3 tags).
  2. New files are added to the database. When adding new files with sync WP-Filebase looks for an image in the same directory with the same basename to use it as thumbnails. Example: document.pdf and document.png. Images named folder.png are used for category icons.
  3. Remote Syncs are executed (WP-Filebase Pro only). See Remote Syncs.
  4. In a final step file tags are refreshed and categories are synchronized. (updating file count and checking for missing folders)

Thumbnails

You can simple add thumbnails to your files by uploading an image with the same name as the file. For example mypdf.jpg will be used as thumbnail for mypdf.pdf. Also images with names like document-80×120.jpg are use as thumbnails. Any images named ‘folder.jpg’, ‘folder.png’, ‘folder.gif’, ‘cover.jpg’, ‘_caticon.jpg’, ‘_caticon.png’ or ‘_caticon.gif’ will be treated as category icon.

Troubleshooting

A complete successfull sync should end with the message:

 Filebase successfully synced.

If not something went wrong. In most cases its PHP running out of memory, especially when adding a great amount of files. To reduce memory usage, disable ID3 detection (WP-Filebase -> Settings -> Misc).

If you still have problems, append &debug=1 to the URL of the sync page, for example: //wpfilebase.com/wp-admin/admin.php?page=wpfilebase_manage&action=sync&debug=1 . The plugin will output backtrace debug info in HTML comments. Right click on the page, view source  and scroll to the end of the document to see the last backtrace info. Copy this text and include it in a support request to get help.

Batch Sync

WP-Filebase Pro has a batch sync mechanism to partition the files to add. The sync is executed with multiple HTTP requests so the overall memory usage is reduced. That allows to sync an unlimited number of files at once.

The normal sync would run out of memory after about 1000 files (with ID3 tag detection enabled and depending on server’s operating system and configuration). Batch Sync detects if the memory usage is critically and starts a new request if needed.

21 thoughts on “Sync

  1. Luke says:
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

    Is it possible to store files on remote FTP only not locally on the wordpress system

Leave a Reply to Luke Cancel reply

Your email address will not be published. Required fields are marked *