hook for defining new read-write tables
This commit is contained in:
parent
e863903263
commit
55068030d2
|
@ -1391,3 +1391,12 @@ EndDocFileForTitle: After searching for a doc or mail template
|
||||||
- $title: Title we looked for
|
- $title: Title we looked for
|
||||||
- $paths: Paths we searched
|
- $paths: Paths we searched
|
||||||
- &$filename: Filename so far (set this if you want)
|
- &$filename: Filename so far (set this if you want)
|
||||||
|
|
||||||
|
StartReadWriteTables: when noting which tables must be read-write, even on read-only actions
|
||||||
|
- &$tables: list of table names
|
||||||
|
- &$rwdb: read-write database URI
|
||||||
|
|
||||||
|
EndReadWriteTables: after noting which tables must be read-write, even on read-only actions
|
||||||
|
- $tables: list of table names
|
||||||
|
- $rwdb: read-write database URI
|
||||||
|
|
||||||
|
|
21
index.php
21
index.php
|
@ -175,15 +175,24 @@ function setupRW()
|
||||||
|
|
||||||
static $alwaysRW = array('session', 'remember_me');
|
static $alwaysRW = array('session', 'remember_me');
|
||||||
|
|
||||||
// We ensure that these tables always are used
|
$rwdb = $config['db']['database'];
|
||||||
// on the master DB
|
|
||||||
|
|
||||||
$config['db']['database_rw'] = $config['db']['database'];
|
if (Event::handle('StartReadWriteTables', array(&$alwaysRW, &$rwdb))) {
|
||||||
$config['db']['ini_rw'] = INSTALLDIR.'/classes/statusnet.ini';
|
|
||||||
|
|
||||||
foreach ($alwaysRW as $table) {
|
// We ensure that these tables always are used
|
||||||
$config['db']['table_'.$table] = 'rw';
|
// on the master DB
|
||||||
|
|
||||||
|
$config['db']['database_rw'] = $rwdb;
|
||||||
|
$config['db']['ini_rw'] = INSTALLDIR.'/classes/statusnet.ini';
|
||||||
|
|
||||||
|
foreach ($alwaysRW as $table) {
|
||||||
|
$config['db']['table_'.$table] = 'rw';
|
||||||
|
}
|
||||||
|
|
||||||
|
Event::handle('EndReadWriteTables', array($alwaysRW, $rwdb));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkMirror($action_obj, $args)
|
function checkMirror($action_obj, $args)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user