When working on #3066987: Move Autoprefixer browsers gulp-option to .browserslistrc file i encountred the issue that the existing update hooks run for every child theme instead of the one given as argument to the drush command bs-theme-update [target-machine-name].

In the above mentioned issue I already started to pass the argument:

@@ -745,7 +746,7 @@ function _bs_base_theme_run_update_hooks($target_machine_name) {
       $update_function = $theme_name . '_bs_update_' . $version;
       if (function_exists($update_function)) {
         drush_print($version . ' -   ' . strip_tags($description), 2);
-        $update_function();
+        $update_function($target_machine_name);
       }
     }

Now this should be back ported to the last two update hooks, which I do here.

This patch here needs the patch from the mentioned issue applied to work properly!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ytsurk created an issue. See original summary.

ytsurk’s picture

Status: Active » Needs review
FileSize
5.29 KB

Here we go.

ytsurk’s picture

ytsurk’s picture

Removed the loops and added an example function.

pivica’s picture

I encountered this one also but didn't had time to investigate it. This totally makes sense but we are changing update API a bit with this. Will check this with @berdir to get his opinion on this.

pivica’s picture

@berdir agrees. Updated a patch a bit, nothing special, some empty space removed, improved comments a bit and expanded example. Note that i also updated a patch in #3066987: Move Autoprefixer browsers gulp-option to .browserslistrc file.

@ytsurk can you check?

pivica’s picture

Issue tags: +next-release

Tagging for next release.

ytsurk’s picture

Status: Needs review » Reviewed & tested by the community

Still, this works as intended when updating or creating a theme.

Although I have 2 findings, which we should probably cover in a new issue:

1. When creating a theme, bs_versions is missing, so an immediate update after creation will walk through all update functions ..
I suggest we write the latest theme version in bs_boostrap info.yml, so it gets copied.

2. When creating a theme with a dash in it's name, like test-theme, _bs_base_drupal_scan is not finding it ..
I suggest we disallow theme names with other then alpha(-numeric) characters and the special char underscore (_).

pivica’s picture

pivica’s picture

Assigned: ytsurk » Unassigned

  • pivica committed 85afd73 on 8.x-1.x authored by ytsurk
    Issue #3067574 by ytsurk, pivica: Make sure update functions only take...
pivica’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.