function optimizely_update_7200 in Optimizely 7.2
Same name and namespace in other branches
- 7.3 optimizely.install \optimizely_update_7200()
Create database table for the Optimizely module.
A default disbaled entry is made to support a base, site wide Optimizely snippet / experiment.
@parm &$sandbox
File
- ./
optimizely.install, line 195 - Install, update and uninstall functions for the Optimizely module
Code
function optimizely_update_7200(&$sandbox) {
// Setup the new table
drupal_install_schema('optimizely');
// Create default entry
// Load Optimizely account code - used for default project snippet ID for javascript file name
$account_id = variable_get('optimizely_id', 0);
$default_entry_created = (bool) db_insert('optimizely')
->fields(array(
'project_title' => 'Default',
'include' => 1,
'enabled' => 0,
'path' => serialize(array(
'*',
)),
'project_code' => $account_id,
))
->execute();
// Inform the administrator that a default snippet / project entry has been made. Acount ID and access permisisons need to be configured
if ($default_entry_created) {
drupal_set_message(st('A default project / experiment entry has been created. Next, enter your') . ' ' . l(st('Optimizely account ID'), 'admin/config/system/optimizely/settings') . ' ' . st('There\'s also an') . ' ' . l(st('optimizely permission'), 'admin/people/permissions#module-optimizely', array(
'fragment' => 'module-optimizely',
)) . ' ' . st('that can be set for specific roles to access the adminstration functionality.'), 'status');
}
else {
drupal_set_message(st('An error was encountred adding the default project entry for the Optimizely module.'), 'error');
}
}