function system_init
Implements hook_init().
File
-
modules/
system/ system.module, line 1923
Code
function system_init() {
$path = drupal_get_path('module', 'system');
// Add the CSS for this module. These aren't in system.info, because they
// need to be in the CSS_SYSTEM group rather than the CSS_DEFAULT group.
drupal_add_css($path . '/system.base.css', array(
'group' => CSS_SYSTEM,
'every_page' => TRUE,
));
if (path_is_admin(current_path())) {
drupal_add_css($path . '/system.admin.css', array(
'group' => CSS_SYSTEM,
));
}
drupal_add_css($path . '/system.menus.css', array(
'group' => CSS_SYSTEM,
'every_page' => TRUE,
));
drupal_add_css($path . '/system.messages.css', array(
'group' => CSS_SYSTEM,
'every_page' => TRUE,
));
drupal_add_css($path . '/system.theme.css', array(
'group' => CSS_SYSTEM,
'every_page' => TRUE,
));
// Ignore slave database servers for this request.
//
// In Drupal's distributed database structure, new data is written to the
// master and then propagated to the slave servers. This means there is a
// lag between when data is written to the master and when it is available on
// the slave. At these times, we will want to avoid using a slave server
// temporarily. For example, if a user posts a new node then we want to
// disable the slave server for that user temporarily to allow the slave
// server to catch up. That way, that user will see their changes immediately
// while for other users we still get the benefits of having a slave server,
// just with slightly stale data. Code that wants to disable the slave
// server should use the db_ignore_slave() function to set
// $_SESSION['ignore_slave_server'] to the timestamp after which the slave
// can be re-enabled.
if (isset($_SESSION['ignore_slave_server'])) {
if ($_SESSION['ignore_slave_server'] >= REQUEST_TIME) {
Database::ignoreTarget('default', 'slave');
}
else {
unset($_SESSION['ignore_slave_server']);
}
}
// Add CSS/JS files from module .info files.
system_add_module_assets();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.