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 <execute> tags. Each execute tag specifies the execution details of exactly one SQL script against the newly restored site's database.

There is a mandatory attribute for each <execute> tag, called db. The value of this attribute is database tag – as specified in the <databaseInfo> section – of the database against which the SQL file will run. For example, to run a file against the main database of the backed up site you have to use a tag like this: <execute db="site">.

The value between the starting and ending tag is the absolute or relative (to the current working directory) path to the SQL file.

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.