Overview
Comment:Add DB_OPEN_SQL constant
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA3-256: b38c094abaea491d2514f9c8e31e7308353389bef66abf55447f193d59df17bf
User & Date: bohwaz on 2022-09-13 19:14:43
Other Links: branch diff | manifest | tags
Context
2022-09-13
19:20
Implement maximum number of failed logins check-in: f82ba2a474 user: bohwaz tags: dev
19:14
Add DB_OPEN_SQL constant check-in: b38c094aba user: bohwaz tags: dev
19:14
Fix reversed arguments order check-in: bc0b469868 user: bohwaz tags: dev
Changes

Modified src/config.dist.php from [c9619f3e87] to [ba39520d68].

114
115
116
117
118
119
120













121
122
123
124
125
126
127
 * Emplacement du fichier de base de données de Garradin
 *
 * Défaut : DATA_ROOT . '/association.sqlite'
 */

//const DB_FILE = DATA_ROOT . '/association.sqlite';














/**
 * Emplacement de stockage des plugins
 *
 * Défaut : DATA_ROOT . '/plugins'
 */

//const PLUGINS_ROOT = DATA_ROOT . '/plugins';







>
>
>
>
>
>
>
>
>
>
>
>
>







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
 * Emplacement du fichier de base de données de Garradin
 *
 * Défaut : DATA_ROOT . '/association.sqlite'
 */

//const DB_FILE = DATA_ROOT . '/association.sqlite';

/**
 * DB_OPEN_SQL
 * Commande SQL exécutée à l'ouverture de la base de données.
 *
 * Utile par exemple pour utiliser une base de données chiffrée.
 *
 * Voir https://www.zetetic.net/sqlcipher/ par exemple.
 *
 * Défaut : null
 */

//const DB_OPEN_SQL = 'PRAGMA key = \'secret\';';

/**
 * Emplacement de stockage des plugins
 *
 * Défaut : DATA_ROOT . '/plugins'
 */

//const PLUGINS_ROOT = DATA_ROOT . '/plugins';

Modified src/include/init.php from [0766d0455b] to [2637346290].

215
216
217
218
219
220
221

222
223
224
225
226
227
228
	'CALC_CONVERT_COMMAND'  => null,
	'CONTRIBUTOR_LICENSE'   => null,
	'SQL_DEBUG'             => null,
	'SYSTEM_SIGNALS'        => [],
	'LOCAL_LOGIN'           => null,
	'LEGAL_LINE'            => 'Hébergé par <strong>%1$s</strong>, %2$s',
	'DISABLE_INSTALL_PING'  => false,

];

foreach ($default_config as $const => $value)
{
	$const = sprintf('Garradin\\%s', $const);

	if (!defined($const))







>







215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
	'CALC_CONVERT_COMMAND'  => null,
	'CONTRIBUTOR_LICENSE'   => null,
	'SQL_DEBUG'             => null,
	'SYSTEM_SIGNALS'        => [],
	'LOCAL_LOGIN'           => null,
	'LEGAL_LINE'            => 'Hébergé par <strong>%1$s</strong>, %2$s',
	'DISABLE_INSTALL_PING'  => false,
	'DB_OPEN_SQL'           => null,
];

foreach ($default_config as $const => $value)
{
	$const = sprintf('Garradin\\%s', $const);

	if (!defined($const))

Modified src/include/lib/Garradin/DB.php from [cf2da7e9fc] to [c379aac3c9].

50
51
52
53
54
55
56




57
58
59
60
61
62
63
    public function __construct(string $driver, array $params)
    {
        if (self::$_instance !== null) {
            throw new \LogicException('Cannot start instance');
        }

        parent::__construct($driver, $params);





        // Enable SQL debug log if configured
        if (SQL_DEBUG) {
            $this->callback = [$this, 'log'];
            $this->_log_start = microtime(true);
        }
    }







>
>
>
>







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
    public function __construct(string $driver, array $params)
    {
        if (self::$_instance !== null) {
            throw new \LogicException('Cannot start instance');
        }

        parent::__construct($driver, $params);

        if (DB_OPEN_SQL) {
            $this->exec(DB_OPEN_SQL);
        }

        // Enable SQL debug log if configured
        if (SQL_DEBUG) {
            $this->callback = [$this, 'log'];
            $this->_log_start = microtime(true);
        }
    }