File Bridge

Last Updated: 14 Jan 2016

The File Bridge asset allows you to connect Squiz Matrix to a file system on the same server as your Matrix installation, creating a representation of the file system as assets within the Asset Map. The concept of the File Bridge is shown in the figure below.

5-0-0_file-bridge-concept.png
The concept of the File Bridge

The files and folders on your server will be displayed within Squiz 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 these files.

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 Squiz Matrix section of this chapter.

Adding a File Bridge

When you create a File Bridge,  the Create New File Bridge screen appear, allowing you to name the File Bridge and displaying the server path that is being used. The Details section of this screen is shown in the figure below.

5-0-0_details-section-create-new-file-bridge.png
The Details section of the Create New File Bridge screen

5-0-0_example-file-bridge.png
An example File Bridge

The fields available are as follows:

  • Name: enter a name for the File Bridge.
  • Path: the path of the file system. This path can be set in the system's file_bridge.inc file, located in the /home/websites/squiz_matrix/data/private/conf directory.

    This set path should be an absolute path that the Apache user has read access to, allowing Squiz Matrix to access the file information. If the file system path contains a file or folder with the incorrect permissions, the File Bridge will not function correctly.

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

Once you have done this, click Commit. The files and directories of the file system will appear as shadow assets in the Asset Map. In the figure to the right, a File Bridge has been configured to display the files of the Squiz Matrix installation.

Browsing and Viewing Files

The files of a File Bridge can be browsed and viewed in the same manner as other assets within the system.

5-0-0_view-file.png
An example File Bridge

To view the contents of a file, right click on the Phsyical File asset in the Asset Map and select View File, as shown in the figure to the left. The View File screen will appear. The View File section of the View File screen is shown in the figure below.

5-0-0_file-preview.png
Viewing a File on the View File screen

Please note that you will not be able to edit the contents of these files within Squiz Matrix.

Importing Files into Squiz Matrix

The File Bridge can be used to import files into Squiz Matrix using both the File Bridge Import Tool and the import_files_from_bridge script. These files will be created as corresponding asset types within Squiz 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, click the Tools icon icon located at the top right hand corner of the screen and click on File Bridge Import Tool. 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 underneath 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. Please note that, by default,the contents of these folders will not be imported. An example, of this is shown in the figure below.

    5-0-0_import-file-tool-example.png
    Importing the File Bridge

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

  • New Parent Node: select the asset where you want to create the imported files under. In the figure above, the New Parent Node Folder has been used.
  • 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.

    5-0-0_import-file-tool-example-recursive.png
    The Recursive option

  • Import: select this option to import the index.html file as a Standard Page asset, resplacing the folder containing this index file. By default this option is disabled.
  • Allow Virus Scan: enabling this option will perform a virus scan on each imported file. This will potentially slow down the import process. Please note that the Virus Checker must be enabled on the External Tools Configuration screen in the System Configuration settings.
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 to import files from.
  • The asset ID of the parent to import the files under.
  • Whether or not to import the contents of any folders underneath the specified File Bridge root node. This parameter is optional; by default, this script will import files from the root directory only.
  • Whether or not to import index.html files as Standard Page asset with the content of the index file. This parameter is optional; by default, this setting is disabled.
Example
$ php import_files_from_bridge.php <system_root> 100 150 y y
START IMPORTING
FINISHED

Previous Chapter