diff -up a/libraries.info b/libraries.info --- a/libraries.info 2011-05-02 15:10:06.351910000 -0500 +++ b/libraries.info 2011-05-02 14:00:12.363057001 -0500 @@ -1,4 +1,3 @@ name = Libraries description = Allows version dependent and shared usage of external libraries. -core = 7.x -files[] = tests/libraries.test +core = 6.x diff -up a/libraries.install b/libraries.install --- a/libraries.install 2011-05-02 15:10:06.351910000 -0500 +++ b/libraries.install 2011-05-02 15:51:06.331473001 -0500 @@ -15,11 +15,27 @@ function libraries_schema() { } /** + * Implements hook_install(). + */ +function libraries_install() { + drupal_install_schema('libraries'); +} + +/** + * Implements hook_uninstall(). + */ +function libraries_uninstall() { + drupal_uninstall_schema('libraries'); +} + +/** * Create the 'cache_libraries' table. */ -function libraries_update_7200() { +function libraries_update_6200() { + $ret = array(); if (!db_table_exists('cache_libraries')) { $specs = drupal_get_schema_unprocessed('system', 'cache'); - db_create_table('cache_libraries', $specs); + db_create_table($ret, 'cache_libraries', $specs); } + return $ret; } diff -up a/libraries.module b/libraries.module --- a/libraries.module 2011-05-02 15:10:06.351910000 -0500 +++ b/libraries.module 2011-05-02 15:43:02.522868999 -0500 @@ -26,7 +26,7 @@ function libraries_flush_caches() { * @ingroup libraries */ function libraries_get_path($name, $base_path = FALSE) { - $libraries = &drupal_static(__FUNCTION__); + static $libraries; if (!isset($libraries)) { $libraries = libraries_get_libraries(); @@ -62,7 +62,7 @@ function libraries_get_path($name, $base function libraries_get_libraries() { $directory = 'libraries'; $searchdir = array(); - $profile = drupal_get_profile(); + $profile = libraries_get_profile(); $config = conf_path(); // Similar to 'modules' and 'themes' directories in the root directory, @@ -121,7 +121,7 @@ function libraries_get_libraries() { * the files. */ function libraries_scan_info_files() { - $profile = drupal_get_profile(); + $profile = libraries_get_profile(); $config = conf_path(); // Build a list of directories. @@ -135,10 +135,7 @@ function libraries_scan_info_files() { $files = array(); foreach ($directories as $dir) { if (file_exists($dir)) { - $files = array_merge($files, file_scan_directory($dir, '@^[a-z0-9._-]+\.libraries\.info$@', array( - 'key' => 'name', - 'recurse' => FALSE, - ))); + $files = array_merge($files, file_scan_directory($dir, '^[a-z0-9._-]+\.libraries\.info$', array('.', '..', 'CVS'), FALSE, 'name')); } } @@ -223,8 +220,7 @@ function libraries_traverse_library(&$li * Wysiwyg's code, or directly switching to CTools. */ function libraries_info($name = NULL) { - $libraries = &drupal_static(__FUNCTION__); - + static $libraries; if (!isset($libraries)) { $libraries = array(); // Gather information from hook_libraries_info(). @@ -431,7 +427,7 @@ function libraries_detect($name) { * See hook_libraries_info() for more information. */ function libraries_load($name, $variant = NULL) { - $loaded = &drupal_static(__FUNCTION__, array()); + static $loaded = array(); if (!isset($loaded[$name])) { $library = cache_get($name, 'cache_libraries'); @@ -588,3 +584,20 @@ function libraries_get_version($library, } fclose($file); } + +/** + * Gets the name of the installed profile. + */ +function libraries_get_profile() { + global $profile; + + // When this function is called during Drupal's initial installation process, + // the name of the profile that is about to be installed is stored in the + // global $profile variable. At all other times, the regular system variable + // contains the name of the current profile, and we can call variable_get() + // to determine the profile. + if (!isset($profile)) { + $profile = variable_get('install_profile', 'default'); + } + return $profile; +}