Skip to content
Snippets Groups Projects
Unverified Commit ee95592c authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3488179 by phenaproxima, thejimbirch:...

Issue #3488179 by phenaproxima, thejimbirch: RecipeConfigurator::getIncludedRecipe() should statically cache recipe objects to avoid performance problems

(cherry picked from commit bc8a19c8)
parent 5d700891
No related branches found
No related tags found
2 merge requests!10663Issue #3495778: Update phpdoc in FileSaveHtaccessLoggingTest,!10451Issue #3472458 by watergate, smustgrave: CKEditor 5 show blocks label is not translated
Pipeline #343233 passed with warnings
Pipeline: drupal

#343250

    Pipeline: drupal

    #343236

      ......@@ -15,6 +15,13 @@ final class RecipeConfigurator {
      */
      public readonly array $recipes;
      /**
      * A cache of already-loaded recipes, keyed by path.
      *
      * @var \Drupal\Core\Recipe\Recipe[]
      */
      private static array $cache = [];
      /**
      * @param string[] $recipes
      * A list of recipes for a recipe to apply. The recipes will be applied in
      ......@@ -56,8 +63,11 @@ public static function getIncludedRecipe(string $include_path, string $name): Re
      $path = $include_path . "/$name/recipe.yml";
      }
      if (array_key_exists($path, static::$cache)) {
      return static::$cache[$path];
      }
      if (file_exists($path)) {
      return Recipe::createFromDirectory(dirname($path));
      return static::$cache[$path] = Recipe::createFromDirectory(dirname($path));
      }
      $search_path = dirname($path, 2);
      throw new UnknownRecipeException($name, $search_path, sprintf("Can not find the %s recipe, search path: %s", $name, $search_path));
      ......
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Finish editing this message first!
      Please register or to comment