libraries.install 1.2 KB

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