Support

Documentation

The extrasql section

Required: No; this section is optional

Scope: Just like extrafiles, you can use the extrasql section to execute SQL scripts against your newly restored site's database. There is no limit on the number of SQL files you can execute against your site's database or in the number of SQL commands a single SQL file can hold.

If you do not wish to make use of this feature, you should not include this section at all in your XML file.

This section can consist of any number of subsections. Each subsection specifies the execution details of exactly one SQL script against the newly restored site's database.

Each subsection has the following keys:

file

The absolute or relative (to the current working directory) path to the SQL file.

db

Which database to run the SQL files against. You need to provide the database tag which is the database subsection key under the databaseInfo section. To run the SQL file against the site's main database set this to site.

The SQL file can hold any number of SQL commands, as long as they are terminated by a semicolon, as per the standard SQL language definition. You can use the “metaprefix”, a single hash followed by two underscores (#__) instead of the real prefix to the site's database in table names. So, if you use the table name #__content and your site's prefix is foo_, before executing the SQL command UNiTE will translate it to foo_content. If you use the same script against another site whose prefix is bar_ then UNiTE will translate it to bar_content. This allows for reusable SQL scripts across multiple restored sites with different table name prefixes, without having to update the table prefixes in your SQL scripts every time.

An extrasql section with two files, being run against two different databases, will look like this

extrasql:
  # This runs foo.sql against the main site database
  -
    file: foo.sql
    db: site
  # This runs bar.sql against the database abdef01234-example
  -
    file: bar.sql
    db: abdef01234-example