Skip to content
Snippets Groups Projects
Unverified Commit 01329e9a 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 d8d9b246
No related branches found
No related tags found
21 merge requests!11515Issue #3480419 by mondrake, smustgrave, catch: Method...,!11380Issue #3490698 by catch, spokje: Bump MINIMUM_STABILITY back to 'stable' when...,!11281Use Drupal Core Leadership terminology in MAINTAINERS.txt,!11239Issue #3507548: Allow workspace changes listing to show all items, without a pager,!11238Fix issue #3051797,!11213Issue #3506743 by tomislav.matokovic: Increasing the color contrast for the navigation block title against the background of the navigation sidebar to at least 4.5:1,!11147Draft: Try to avoid manually setting required cache contexts,!11108Issue #3490298 by nicxvan: Profiles can be missed in OOP hooks,!11093Drupal on MongoDB 11.1.x,!11017Issue #3502540: Add date filter for moderated content.,!11009Issue #3486972 migrate feed icon,!10999Cleaning up Taxonomy hooks and updating baseline.,!10977Issue #3501457: Fix path used in a A11y Test Admin,!10881Issue #3489329 by mfb, casey: symfony/http-foundation commit 32310ff breaks PathValidator,!10570Issue #3494197: Convert Twig engine hooks,!10567Issue #3494154: Index is not added if entity doesn't support revisions,!10548Revert "Issue #3478621 by catch, longwave, nicxvan: Add filecache to OOP hook attribute parsing",!10404Margin has been added,!10391Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...,!10388Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...,!10376Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...
Pipeline #343234 passed with warnings
Pipeline: drupal

#343246

    ......@@ -133,15 +133,13 @@ public function describeAll(): array {
    * constraints.
    */
    public function collectAll(InputCollectorInterface $collector, array &$processed = []): void {
    if (is_array($this->values)) {
    throw new \LogicException('Input values cannot be changed once they have been set.');
    }
    // Don't bother collecting values for a recipe we've already seen.
    if (in_array($this->prefix, $processed, TRUE)) {
    return;
    }
    if (is_array($this->values)) {
    throw new \LogicException('Input values cannot be changed once they have been set.');
    }
    // First, collect values for the recipe's dependencies.
    /** @var \Drupal\Core\Recipe\Recipe $dependency */
    foreach ($this->dependencies->recipes as $dependency) {
    ......
    ......@@ -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