# Local customizations broke site on upgrade, how to disable?

**URL:** https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724
**Category:** Support
**Created:** [2015 年5 月 12 日 22:31 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724 "2015-05-12T22:31:00Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![jesselperry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jesselperry/32/119501_2.png) [@jesselperry](https://meta.discourse.org/u/jesselperry)
#### Post date: [2015 年5 月 12 日 22:31 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/1 "2015-05-12T22:31:00Z")

</div>

Just updated to beta 9, now my Discourse is completely white. I did the below and still have the same thing. Don’t have CDN.

```
cd /var/discourse
git pull
./launcher rebuild app

```

Any ideas?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015 年5 月 12 日 23:10 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/14 "2015-05-12T23:10:39Z")

</div>

What plugins do you have installed?

---

<div class="post-metadata">

### Author: ![jesselperry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jesselperry/32/119501_2.png) [@jesselperry](https://meta.discourse.org/u/jesselperry)
#### Post date: [2015 年5 月 12 日 23:12 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/15 "2015-05-12T23:12:05Z")

</div>

None.

Reading this: [https://meta.discourse.org/t/deprecating-objectcontroller/28385?u=jesselperry](https://meta.discourse.org/t/deprecating-objectcontroller/28385)

I _think_ I have a customization that gets the current logged in user name. Could that be causing this error? The `this.get('name')` in the post made me think of that customization.

Any way to disable that customization, even though I can’t get into /admin?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015 年5 月 12 日 23:13 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/17 "2015-05-12T23:13:51Z")

</div>

hmmm yeah

```plaintext
cd /var/discourse
./launcher enter app 
rails c
> SiteCustomization.update_all(enabled: false)
exit
exit

```

After this restart the container

```plaintext
./launcher restart app

```

---

<div class="post-metadata">

### Author: ![jesselperry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jesselperry/32/119501_2.png) [@jesselperry](https://meta.discourse.org/u/jesselperry)
#### Post date: [2015 年5 月 12 日 23:25 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/22 "2015-05-12T23:25:09Z")

</div>

I’m back in business!! Thank you so much @sam

And based things working now, and the /logs errors I saw and this post: [https://meta.discourse.org/t/deprecating-objectcontroller/28385?u=jesselperry](https://meta.discourse.org/t/deprecating-objectcontroller/28385)

I think it had something to do with me calling one of these in a site customization?

```
Discourse.User.currentProp('username')

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015 年5 月 12 日 23:26 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/23 "2015-05-12T23:26:25Z")

</div>

Paste the full customization source here, @eviltrout can have a quick look

---

<div class="post-metadata">

### Author: ![jesselperry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jesselperry/32/119501_2.png) [@jesselperry](https://meta.discourse.org/u/jesselperry)
#### Post date: [2015 年5 月 12 日 23:33 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/24 "2015-05-12T23:33:30Z")

</div>

Please forgive the ugly method I’m probably using to get logged in user email address. I hacked around on Meta to try to pull this together a couple months back.

```
<script>
    var currentusername = Discourse.User.currentProp('username');
    var fulllinktojson = "DISCOURSE_SITE_REDACTED/users/" + currentusername + ".json";
    $.getJSON(fulllinktojson, function(json){
        currentuseremail = String(json.user.email);
    });
</script>

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015 年5 月 12 日 23:35 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/25 "2015-05-12T23:35:00Z")

</div>

Discourse.User.currentProp should work fine, my guess is that you are calling it too early now.

---

<div class="post-metadata">

### Author: ![jesselperry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jesselperry/32/119501_2.png) [@jesselperry](https://meta.discourse.org/u/jesselperry)
#### Post date: [2015 年5 月 12 日 23:36 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/26 "2015-05-12T23:36:05Z")

</div>

I have this in `</body>`

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2015 年5 月 12 日 23:43 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/27 "2015-05-12T23:43:54Z")

</div>

@sam we need a way to have a site launch in “[safe mode](https://meta.discourse.org/t/53504?silent=true)” with all plugins and customizations disabled.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015 年5 月 12 日 23:49 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/28 "2015-05-12T23:49:17Z")

</div>

It was meant to be simply visiting “admin” directly, but for some reason we only disable css there, we should fix that.

---

<div class="post-metadata">

### Author: ![jesselperry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jesselperry/32/119501_2.png) [@jesselperry](https://meta.discourse.org/u/jesselperry)
#### Post date: [2015 年5 月 13 日 00:04 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/30 "2015-05-13T00:04:03Z")

</div>

Ok this is very strange! (to me)

The code that seems to be causing the problem is this?

**CSS** :

```
#site-map-dropdown a[href="/users"] {
    display: none;
}

#site-map-dropdown a[href="/about"] {
    display: none;
}

#site-map-dropdown a[href="/faq"] {
    display: none;
}

#site-map-dropdown a[class="keyboard-shortcuts-link"] {
    display: none;
}

```

**Head:**

```
<script type='text/x-handlebars' data-template-name='/connectors/site-map-links/members-as-users'>
    <li><a href="DISCOURSE_SITE/groups/trust_level_2/members" title="Team Flower Members listing" class="members-link">Members List</a></li>
    <li><a href="DISCOURSE_SITE/faq" title="Learn more on using Team Flower Community" class="faq-new-link">How to use Community</a></li>
    <li><a href="http://www.teamflower.org/members-login" title="Manage your Team Flower account" class="team-flower-account-dropdown" target="_blank">Team Flower Account</a></li>
</script>

```

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [2015 年5 月 13 日 16:24 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/31 "2015-05-13T16:24:26Z")

</div>

Aha, in this particular case you are compiling a template in production. After the recent ember refactor I removed the compiler from our production build. I didn’t realize people were using it in customizations.

I’ve added it back:

[https://github.com/discourse/discourse/commit/29631f65f1ae8d78ae61ed1e19e10d2b52b04387](https://github.com/discourse/discourse/commit/29631f65f1ae8d78ae61ed1e19e10d2b52b04387)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2015 年11 月 25 日 05:45 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/32 "2015-11-25T05:45:49Z")

</div>

Why don’t we put this behind a site setting so every Discourse install in the world is not penalized with extra load time, for the incredibly tiny number of cases where a random customization compiles templates?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [2015 年11 月 25 日 15:37 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/33 "2015-11-25T15:37:05Z")

</div>

We could do that, but if we default it to off it will temporarily break all the sites who have customizations. If we default it to on, most won’t get the savings.

Backwards compatibility is hard ☹

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2015 年11 月 25 日 21:47 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/34 "2015-11-25T21:47:37Z")

</div>

As Spock once said, the needs of the many outweigh the needs of the few. And the type of advanced sites doing advanced customization should be more than able to tweak a setting.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2015 年11 月 26 日 19:26 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/35 "2015-11-26T19:26:10Z")

</div>

You could put in a migration that does a string comparison for `text/x-handlebars` on all the customizations, and sets the setting to true at migration time if any are there.

No need for human intervention, and we get the perf boost.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015 年11 月 26 日 21:05 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/36 "2015-11-26T21:05:21Z")

</div>

Or just follow my plan and precompile the templates 😃 no need for a setting then

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015 年11 月 27 日 01:05 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/37 "2015-11-27T01:05:40Z")

</div>

This change (automatically compiling templates in site customizations) is now complete!

[https://github.com/discourse/discourse/commit/43d63367fdf39dc5f69b640936ac19cd817f6631](https://github.com/discourse/discourse/commit/43d63367fdf39dc5f69b640936ac19cd817f6631)

This means we no longer ship **66K gzipped** Ember template compiler AND we stop shipping **11K gzipped** handlebars (and instead ship **3.7K** gzipped runtime)

Total savings on initial load is approx **73K** also this is a bunch of code that is no longer evaluated and kept in memory which is another huge saving.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016 年4 月 27 日 03:57 UTC](https://meta.discourse.org/t/local-customizations-broke-site-on-upgrade-how-to-disable/28724/38 "2016-04-27T03:57:36Z")

</div>


