1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Install, uninstall, and update functions for libraries.module.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_schema().
|
10
|
*/
|
11
|
function libraries_schema() {
|
12
|
$schema['cache_libraries'] = drupal_get_schema_unprocessed('system', 'cache');
|
13
|
$schema['cache_libraries']['description'] = 'Cache table to store library information.';
|
14
|
return $schema;
|
15
|
}
|
16
|
|
17
|
/**
|
18
|
* Create the 'cache_libraries' table.
|
19
|
*/
|
20
|
function libraries_update_7200() {
|
21
|
// Note that previous versions of this function created the table with a
|
22
|
// different table comment.
|
23
|
if (!db_table_exists('cache_libraries')) {
|
24
|
$specs = libraries_schema();
|
25
|
db_create_table('cache_libraries', $specs['cache_libraries']);
|
26
|
}
|
27
|
}
|
28
|
|
29
|
/**
|
30
|
* Rebuild the class registry.
|
31
|
*/
|
32
|
function libraries_update_7201() {
|
33
|
// The tests were split from a single libraries.test file into multiple files
|
34
|
// during the 7.x-2.x cycle.
|
35
|
registry_rebuild();
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* Grant the "View library reports" permission to roles with the "View site reports" permission.
|
40
|
*/
|
41
|
function libraries_update_7202() {
|
42
|
$rids = array_keys(user_roles(FALSE, 'access site reports'));
|
43
|
foreach ($rids as $rid) {
|
44
|
_update_7000_user_role_grant_permissions($rid, array('access library reports'), 'libraries');
|
45
|
}
|
46
|
}
|