Example #1
0
/**
 * Implementation of hook_init.
 */
function ft_log_init()
{
    global $ft;
    // Check if DB plugin is loaded.
    if (ft_plugin_exists('db')) {
        // Check if we need to create new table.
        $sql = "CREATE TABLE log (\n    id INTEGER PRIMARY KEY,\n    type TEXT NOT NULL,\n    message TEXT NOT NULL,\n    location TEXT NOL NULL,\n    timestamp DATE NOT NULL,\n    user TEXT NOT NULL,\n    hostname TEXT NOT NULL,\n    severity INTEGER NOT NULL\n    )";
        ft_db_install_table('log', $sql);
    }
}
/**
 * Implementation of hook_init.
 */
function ft_fileinfo_init()
{
    // Check if DB plugin is loaded.
    if (!ft_plugin_exists('db')) {
        ft_set_message(t('!name plugin not enabled because required !required plugin was not found.', array('!name' => 'Fileinfo', '!required' => 'db')), 'error');
        ft_plugin_unload('fileinfo');
    } else {
        // Check if we need to create new table.
        $sql = "CREATE TABLE fileinfo (\n      dir TEXT NOT NULL,\n      file TEXT NOT NULL,\n      description TEXT\n    )";
        ft_db_install_table('fileinfo', $sql);
    }
}