Server scripts

This chapter lists an index of the scripts that are provided within Matrix, categorized by their root directory within the system.

Scripts within Matrix should be run by an appropriate user that satisfies the required permissions of the script action. For example, scripts that write to the /data/ or /cache/ directories would usually need to be run by the system’s apache user (apache/www-data).

Scripts in the /scripts/ directory

The following scripts are located in the /scripts/ root directory within Matrix. These scripts are predominately used to perform general administrative tasks.

Script Description

add_remove_url.php

Adds or removes a URL from a site asset and its children or the designs, media, and users system folders.

add_user_own_access.php

Ensures that each user in the system has permissions to access their Matrix user asset and is provided as a fail-safe measure in case the permissions have become corrupted.

asset_listing_change_metadata_sort_option.php

Generates the SQL queries needed to change the metadata sorting options from raw to presentation or vice versa for an asset listing page.

backup.sh

Backs up all files and database data from your Matrix installation to a single tar.gz file.

clean_old_shadow_links.php

Clean links to shadow assets in the system that are no longer valid

dejavu_management.php

Enables or disables the Deja Vu Memcache extension on your system.

generate_ssh_key.php

Generates an SSH Key that can be used on external services supporting SSH key authorization, such as the Git file bridge.

get_design_area_setable_attrs.php

Prints out the names of all the settable attributes of all the design areas in the Matrix system, along with their descriptions.

hipo_management.php

Displays any HIPO jobs currently running on the system, allowing you to manage jobs that may have stalled.

indent_list_to_xml.php

Takes a text file containing a list of indented items and converts it into a thesaurus XML import file.

matrixsqlclient.php

Initiates an interactive database terminal in PHP to run commands against Oracle databases and can be used as an alternative to SQL*Plus.

migrate_metadata_text_to_multiple_text.php

Converts metadata content on a group of specified assets from metadata text fields to multiple text fields, splitting single entries by the specified delimiter.

move_assets.php

Moves all assets of a single type from one specified folder to another.

move_assets_to_dated_folders.php

Moves all assets of a single type into a dated folder structure.

morph_assets.php

Morphs an asset from one asset type to another.

permission_change.php

Changes the permissions of an asset with the option to cascade the change to child assets.

publish_static_content.php

Publishes the static content of specified assets to a set directory in the system.

purge_trash.php

Purges the trash within the system.

recreate_link_tree.php

Regenerates the link tree in the database for all assets.

recreate_rollback_triggers.php

Regenerates the Rollback triggers in the database and may be required during upgrades.

regenerate_file_systems.php

Regenerates the asset file contents within the system, including metadata, design, and bodycopy content files.

regenerate_treeids_for_triggers.php

Regenerates the IDs in the database for all triggers.

regen_metadata_by_root_nodes.php

Takes an argument of a list of root nodes separated by commas and regenerates the metadata for the child assets of each root node.

regen_metadata_schemas.php

Regenerates the metadata schemas from the command line.

regen_system_assets_config.php

Generates the system assets config for installed systems.

remove_assets_of_type.php

Removes all assets of the specified type from your Matrix system.

remove_asset_type.php

Removes all assets of the specified type and then removes the asset type itself from your Matrix system.

remove_form_submission.php

Removes all form submissions created between two specified dates.

remove_internal_message.php

Removes internal messages from the Matrix system, allowing you to specify the period, source, destination, type, and status of messages to remove.

remove_old_cron_jobs.php

Removes any Cron jobs that were scheduled to run more than a week ago.

replace_text.php

Runs the WYSIWYG editor’s replace text plugin on the editable content of a specified set of root nodes.

replace_url.php

Changes the base URL associated with a site or a system folder.

reset_root_password.php

Resets the system’s root password to root.

rollback_management.php

Manages rollback and is used to enable rollback if you did not enable rollback during installation.

session_cleanup.sh

Clears stale session files on the system.

set_files_unrestricted.php

Sets all files underneath a specific root node to either restricted or unrestricted.

shrink_matrix_file_assets.php

Reduces the space taken up by file assets on the file system for Matrix systems installed on versions lower than 5.3.2.0.

status_change.php

Changes the status of an asset with the option to cascade the status change to child assets.

system_apply_metadata_schema.php

Applies a metadata schema to a set of specified assets and their children.

system_apply_permissions.php

Applies permissions to a set of specified assets and their children.

system_check.php

Checks and identifies system integrity issues and reports back on any known inconsistencies in the system.

system_integrity_check_indexes.php

Checks the Matrix database for any missing indexes. If missing indexes are found, this script will print an SQL query to run.

system_integrity_check_links.php

Checks that all hyperlinks to another asset (referenced as ./?a=xx) inside a WYSIWYG editor (for example, a standard page) link to an existing asset.

system_integrity_clean_cache_dir.php

Deletes any expired cache files in the cache directory of Matrix.

system_integrity_clean_old_files.php

Checks for, and optionally deletes, files in the data directory that do not belong to an asset (orphaned files).

system_integrity_content_links.php

Verifies and updates asset reference links for images or files in bodycopy contents.

system_integrity_deleted_user_perms.php

Deletes permissions that exist for deleted or non-existent users.

system_integrity_fix_char_encoding.php

Replaces all non-UTF8 smart quote chars by their respective regular counterpart chars. If a string is still invalid, this script will perform charset conversion on the string.

system_integrity_fix_public_files.php

Evaluate and fixes the files on the public data directory, updating any out-of-date files, creating any missing files, and removing any files that are private or should not be in the directory.

system_integrity_fix_sort_orders.php

Verifies and corrects the asset sort order in the database.

system_integrity_foreign_keys.php

Reports on the integrity of foreign keys within a Matrix database.

system_integrity_form_submissions.php

Ensures that form submissions only appear under their associated form assets.

system_integrity_incomplete_attachments.php

Checks for (and optionally deletes) any temporary incomplete attachments that were not automatically removed from the Matrix file system

system_integrity_inconsistent_workflow_status.php

Detect and fix assets with a status that is inconsistent with their current workflow statuses.

system_integrity_internal_links.php

Ensures all links to assets in the system in bodycopy contents use the internal format of (./?a=xxx).

system_integrity_invalid_links.php

Finds and links orphaned assets (that is, ones with no links to them) underneath a specified asset ID, which should preferably be a folder.

system_integrity_orphaned_assets.php

Finds and links orphaned assets (that is, ones with no links to them) underneath a specified asset ID, which should preferably be a folder.

system_integrity_recover_file_versions.php

Recover incorrect file versioning entries in Matrix.

system_integrity_run_tidy.php

Runs HTML tidy across all WYSIWYG editor cells in a system or under a particular asset.

system_move_update.php

A simple script to be run after the system root pathname has been changed, for example, when restoring from a backup or migrating your Matrix installation to a new server.

system_parse_design.php

Re-parses a specified design asset.

system_parse_designs.php

Re-parses all the designs in your Matrix system.

system_update_lookups.php

Refreshes the lookups (URLs and designs) on all the sites in the system (and their children).

system_virus_scan.php

Runs the system virus checker and removes any viruses found.

system_reimport_content.php

Re-imports content into a database. Most useful in cases where a database was not initially set up with the correct character set

tool_export_form_submission_logs.php

Exports the form submissions of a custom form asset to a CSV file.

upgrade_form_submission_linking.php

Moves custom form submissions under their designated submissions folder (a requirement when upgrading to v3.14)

upgrade_future_trigger_actions.php

Converts any set future permissions and status trigger actions present in trigger assets (a requirement when upgrading to v3.20.2)

upgrade_of_funnelback_binary_to_9_1.php

Upgrades the Funnelback binaries to 9.1 OEM (a requirement when upgrading to v3.28.6).

upgrade_session_expiry_preferences.php

Convert existing global and user group session expiry rules to multiple-rule format (a requirement when upgrading to v3.20.1).

upgrade_ecom_keyword_total_item_price.php

Converts e-commerce keyword` %total_item_price%` to %total_item_price_excl_tax%.

Advanced scripts in the /scripts/ directory

The following scripts are located in the /scripts/ root directory within Matrix. These scripts are used to perform more advanced administrative tasks.

Script Description

clean_oven.sh

Cleans the following directories: core/lib/`DAL/Oven/` and core/lib/DAL/QueryStore.

convert_database.php

Converts a database from Postgres to Oracle or Oracle to Postgres.

rebake.php

Rebakes the DAL queries for installed assets/packages.

run_cron_job.php

Runs a specified cron job.

Scripts in the /scripts/import directory

The following script are located in the /scripts/import directory within Matrix. These scripts are used to perform import and creation tasks.

Script Description

convert_fonz_for_import.php

Forms a valid thesaurus XML file from a comma-separated values file (CSV) - Functions of New Zealand (FONZ) thesaurus standard.

create_pages.php

Mass creates assets using a comma-separated values file (CSV) containing page data.

csv_to_html_tree.php

Takes a comma-separated values file (CSV) and converts it to a tree represented by HTML headings.

csv_to_xml_actions.php

Creates an import XML file from a comma-separated values file (CSV) and an XML metadata mapping file.

export_to_xml.php

Takes an asset and all its children and exports its details to an XML file, using the import_from_xml.php script.

import_asset_csv_to_matrix.php

Can be used to import a CSV file containing asset attributes and metadata values into Matrix to add, edit or delete an asset.

import_files.php

Uploads files sitting on the server. These include MS Word documents, PDFs, images, and more.

import_folder_structure.php

Creates folders in the Matrix system based on directories in the file system.

import_from_xml.php

Performs actions passed to it in the form of an import script (this can include creating assets, setting metadata, or any other action available when creating a trigger).

import_quiz_from_xml.php

Imports online quiz multiple choice questions and question groups from an XML file.

update_asset_titles.php

Changes the title attribute on a group of assets (for example, file assets), specified in a header-less comma-separated values (CSV) file.

Scripts in the /scripts/locale directory

The following scripts are located in the /scripts/locale directory within Matrix. These scripts are used to manage locale data within the system.

Script

Description

locale_backup.php

Gathers locale information stored underneath each asset and package to assist with translating the interface and error messages to different languages.

locale_restore.php

Takes all the locale string data generated by locale_backup.php and reintegrates it with your installation.

Package scripts

The following scripts are package specified scripts located in the various locations within Matrix. These scripts are used to manage different package-specific tasks.

Script

Description

ldap_change_dn.php

Updates the DN of an old LDAP user to point to a new LDAP user.

reindexSearchIndex.php

Re-indexes the assets within Matrix on either a root node or system-wide basis.

reset_bulkmail_job.php

Prepares a bulkmail job to be resent and changes its status from live to under construction.

run.php

Runs the bulk mailer, dispatching the bulkmail jobs.

schedule_bulkmail_job.php

Schedules a bulkmail job to be run immediately.

import_files_from_bridge.php

Imports the files exposed by a file bridge asset into Matrix.

check_funnelback_setup.php

Checks the setup of the Funnelback system.

funnelback_rebuild_cache.php

Rebuilds the cache for a set of assets (or system-wide).

funnelback_reindex.php

Indexes a specified set of assets (or system-wide).

give_funnelback_permission.php

Applies write permission on a set of assets for a specified user.

upgrade_suiteid.php

(Funnelback) Updates the DB table information on Funnelback search pages in the system (run during Matrix’s automatic upgrade procedure).

upgrade_suiteid.php

(Squiz Suite) Updates the IDs on the Squiz suite DB table (run during Matrix’s automatic upgrade procedure).

Install scripts

The following scripts are used during Matrix’s installation process. These scripts are located in the system’s /install directory.

Script

Description

check_requirements.php

Verifies the program requirements of a Matrix installation against your server configuration.

generate_install_key.php

Generates an install key for the system.

step_01.php

Creates the main system configuration file during installation.

step_02.php

Initializes the Matrix database schema, creating database tables, views, functions, and sequences.

step_03.php

Installs the various asset types on the system, including certain system assets.

update_squiz_logo_login_design.php

Updates the Matrix logo in login designs (requirement when upgrading to v4.0).

Additional scripts

The following additional scripts are also available for use within Matrix.

Script

Description

matrix_upgrade.php

Automatically upgrades your system from one version to another.

Automatic updates are only available to users who have an update subscription.

© 2015- Squiz Pty Ltd