File bridge

The file bridge asset lets you connect Matrix to a file system on the same server as your Matrix system. It creates a representation of the file system as assets within the asset tree.

Concept of the file bridge
Figure 1. Concept of the file bridge:

The files and folders on your server will be displayed within Matrix as physical file and physical folder assets. These assets allow you to view and browse the files within the system; however, you will not be able to move or modify them. The files displayed through a file bridge can be imported into the system using the File bridge import tool. For more information, refer to the importing files into Matrix section of this chapter.

Adding a file bridge

When you create a file bridge, the create new file bridge screen appears, allowing you to name the file bridge and displaying the server path.

The details section of this screen:

The details section of the create new file bridge screen
An example file bridge

To add a file bridge:

  1. Complete the following fields:

    Name

    Enter a name for the file bridge.

    Path

    Set an absolute path that the Apache user has read access to, allowing Matrix to access the file information.

    This path can be set in the system’s file_bridge.inc file, located in the /home/websites/squiz_matrix/data/private/conf directory.

    The file bridge will not function correctly if the file system path contains a file or folder with the incorrect permissions.

    By default, this path will be set to your system’s /data/public directory.

  2. Select Save.

The files and directories of the file system will appear as shadow assets in the asset tree.

Browsing and viewing files

The files of a file bridge can be browsed and viewed in the same manner as other assets.

View the contents of a file by right-clicking on the physical file asset in the asset tree and select view file, as shown:

An example file bridge

The View file screen will appear:

Viewing a file on the view file screen
You will not be able to edit the contents of these files within Matrix.

Importing files into Matrix

The file bridge can be used to import files into Matrix using the File bridge import tool and the import_files_from_bridge script. These files will be created as corresponding asset types within Matrix, where available.

For example, an image file will be imported as an image type asset.

The File bridge import tool

To access the File bridge import tool:

  1. Click the Tools in the toolbar.

  2. Click on File bridge import tool.

  3. The File bridge import tool screen will appear.

The fields available are as follows:

File bridge root node

Select the file bridge asset or a file or folder beneath it to act as the root node, determining which files to import.

If the file bridge asset or a folder is selected, the File bridge import tool will import the top-level files and folders underneath it, rather than importing the selected asset. By default, the contents of these folders will not be imported.

Importing the file bridge

If a file is selected, only that file will be imported.

New parent node

Select the asset under which you want to create the imported files. In the figure above, this is the new parent node folder.

Recursive

In the figure above, the File 3 file asset has not been imported as it is not a top-level child of the file bridge. Select this option to import the contents of any folders underneath the file bridge root node, as shown in the figure below.

The recursive option
Import

Select this option to import the index.html file as a standard page asset, replacing the folder containing this index file. This option is disabled by default.

Allow virus scan

Enabling this option will perform a virus scan on each imported file. This scan will potentially slow down the import process. The virus checker must be enabled on the External tools configuration screen.

The import files from bridge script

The import_files_from_bridge script will import the files exposed by a file bridge asset and is located in the /packages/filesystem/scripts directory.

This script takes the following parameters:

  • The system root directory.

  • The asset ID of the file bridge asset from which to import files.

  • The asset ID of the parent under which to import the files.

  • Optional: Whether to import the contents of any folders underneath the specified file bridge root node.

This script will only import files from the root directory by default.

  • Optional: Whether or not to import index.html files as standard page asset with the content of the index file. It is disabled by default.

Example
$ php import_files_from_bridge.php <system_root> 100 150 y y
Start importing
Finished