Esempio n. 1
0
    public static function install()
    {
        SystemEvent::raise(SystemEvent::INFO, "Creating systemsettings table...", __METHOD__);
        $tableName = 'systemsettings';
        $sql = <<<EOT
DROP TABLE IF EXISTS {$tableName}NEW;
CREATE TABLE IF NOT EXISTS {$tableName}NEW(
  key VARCHAR(255) PRIMARY KEY,
  value TEXT NOT NULL DEFAULT ''
);
EOT;
        if (!Database::setupTable($tableName, $sql)) {
            SystemEvent::raise(SystemEvent::ERROR, "Problems setting up {$tableName} table.", __METHOD__);
            return false;
        }
        $self = new SystemSettings();
        $self->_save(true);
        // This allows us to save the default system settings values at install time.
        SystemEvent::raise(SystemEvent::INFO, "{$tableName} table created.", __METHOD__);
        return true;
    }