Mercurial > hg > isophonics-drupal-site
diff core/includes/module.inc @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
line wrap: on
line diff
--- a/core/includes/module.inc Thu Feb 28 13:21:36 2019 +0000 +++ b/core/includes/module.inc Thu May 09 15:33:08 2019 +0100 @@ -14,51 +14,49 @@ * The type of list to return: * - theme: All installed themes. * - * @return + * @return array * An associative array of themes, keyed by name. * For $type 'theme', the array values are objects representing the * respective database row, with the 'info' property already unserialized. * + * @deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use + * \Drupal::service('theme_handler')->listInfo() instead. + * + * @see https://www.drupal.org/node/2709919 * @see \Drupal\Core\Extension\ThemeHandler::listInfo() */ function system_list($type) { - $lists = &drupal_static(__FUNCTION__); - if ($cached = \Drupal::cache('bootstrap')->get('system_list')) { - $lists = $cached->data; + @trigger_error('system_list() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal::service(\'theme_handler\')->listInfo() instead. See https://www.drupal.org/node/2709919', E_USER_DEPRECATED); + + $lists = [ + 'theme' => \Drupal::service('theme_handler')->listInfo(), + 'filepaths' => [], + ]; + foreach ($lists['theme'] as $name => $theme) { + $lists['filepaths'][] = [ + 'type' => 'theme', + 'name' => $name, + 'filepath' => $theme->getPathname(), + ]; } - else { - $lists = [ - 'theme' => [], - 'filepaths' => [], - ]; - // ThemeHandler maintains the 'system.theme.data' state record. - $theme_data = \Drupal::state()->get('system.theme.data', []); - foreach ($theme_data as $name => $theme) { - $lists['theme'][$name] = $theme; - $lists['filepaths'][] = [ - 'type' => 'theme', - 'name' => $name, - 'filepath' => $theme->getPathname(), - ]; - } - \Drupal::cache('bootstrap')->set('system_list', $lists); - } - // To avoid a separate database lookup for the filepath, prime the - // drupal_get_filename() static cache with all enabled themes. - foreach ($lists['filepaths'] as $item) { - system_register($item['type'], $item['name'], $item['filepath']); - } - return $lists[$type]; } /** * Resets all system_list() caches. + * + * @deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. There + * is no direct replacement. Call each + * \Drupal::service('extension.list.TYPE')->reset() as necessary. + * + * @see https://www.drupal.org/node/2709919 */ function system_list_reset() { - drupal_static_reset('system_list'); + @trigger_error("system_list_reset() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. There is no direct replacement. Call each \Drupal::service('extension.list.TYPE')->reset() as necessary. See https://www.drupal.org/node/2709919.", E_USER_DEPRECATED); + \Drupal::service('extension.list.profile')->reset(); \Drupal::service('extension.list.module')->reset(); - \Drupal::cache('bootstrap')->delete('system_list'); + \Drupal::service('extension.list.theme_engine')->reset(); + \Drupal::service('extension.list.theme')->reset(); } /**