varbase.install in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 7.2
Same filename and directory in other branches
Install, update and uninstall functions for the Vardot Base install profile.
File
varbase.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Vardot Base install profile.
*/
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*
* @see system_install()
*/
function varbase_install() {
// Disable user picture support.
variable_set('user_pictures', '0');
// Allow visitor account creation with administrative approval.
variable_set('user_register', USER_REGISTER_ADMINISTRATORS_ONLY);
// Enable default permissions for system roles.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array(
'access content',
));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array(
'access content',
));
// Projects to disable.
$dis_module = array(
"toolbar",
"overlay",
);
// Disable Projects.
db_update('system')
->fields(array(
'status' => 0,
))
->condition('name', $dis_module, 'IN')
->execute();
//themes to enable
$en_theme = array(
'ember',
'bootstrap',
'vartheme2',
);
$dis_theme = array(
'bartik',
);
theme_enable($en_theme);
theme_disable($dis_theme);
// Create a default role for site administrators, with all available permissions assigned.
$admin_role = new stdClass();
$admin_role->name = 'Super admin';
$admin_role->weight = 4;
if ($role = user_role_load_by_name($admin_role->name)) {
$admin_role = $role;
}
else {
user_role_save($admin_role);
}
user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission')));
// Set this as the administrator role.
variable_set('user_admin_role', $admin_role->rid);
//Create a other roles for specific site administration tasks.
$content_role = new stdClass();
$content_role->name = 'Content admin';
$content_role->weight = 2;
if (!($role = user_role_load_by_name($content_role->name))) {
user_role_save($content_role);
}
$site_admin_role = new stdClass();
$site_admin_role->name = 'Site admin';
$site_admin_role->weight = 3;
if (!($role = user_role_load_by_name($site_admin_role->name))) {
user_role_save($content_role);
}
// Assign user 1 the "administrator" role.
db_insert('users_roles')
->fields(array(
'uid' => 1,
'rid' => $admin_role->rid,
))
->execute();
//* @todo: investigate further this problem below to the end of the function
/**
* For some reason rdf throws a "Base table of view not found" error on installation if made through dependendices[]
* for some another freaky reason diff always appears as non-existing when trying to install.
*
* This is a workaround to enable these module after the batch install is done.
*/
$modules_to_enable = array(
'rdf',
'diff',
);
module_enable($modules_to_enable);
// For some reason the feature varbase_ckeditor keeps getting overriden when enabled. Here's a quick workaround
if (module_exists('varbase_ckeditor')) {
features_revert(array(
'varbase_ckeditor' => array(
'ckeditor_profile',
),
));
}
}
Functions
Name | Description |
---|---|
varbase_install | Implements hook_install(). |