Files
Romain Derie ce345b5947 [IMP] website: avoid copying cdn enabled website setting on db duplicate
When a DB is duplicated, it's going through the neutralize process
which is helpful to clean stuff that will be messing around with the
duplicated DB.

The CDN should actually be part of that. Since a CDN url is bound to a
domain, when you copy the database (and most likely run it on its own
different domain), it just won't properly work.

Indeed, if you setup a CDN X for domain A and then copy a DB to domain
B, this will happen:
- You access website B
- You try to load an img, which is using CDN X URL
- CDN X URL is fetching the ressource on DB A instead of DB B, which
  might or might not exist (an image will likely share the same path so
  it might work, but for assets url it might not if the bundle url has
  changed)

In the event of the assets having changed, they will never be loaded and
the duplicated DB won't be loading properly.
The only workaround in this case is to switch to debug mode to bypass
the post processing and so the CDN url transform.

Useful commits:
- Introduction of neutralize
  https://github.com/odoo/odoo/pull/67825
- Conversion of neutralize from ORM calls to raw SQL
  https://github.com/odoo/odoo/commit/e5dbded9bb363351feff7ca8a56c7f8a6860f492

opw-3880102

closes odoo/odoo#163210

X-original-commit: ab6493ae9fff218a43df12829011a4f642902114
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2024-04-25 11:21:55 +00:00

13 lines
248 B
SQL

-- delete domains on websites
UPDATE website
SET domain = NULL;
-- activate neutralization watermarks
UPDATE ir_ui_view
SET active = true
WHERE key = 'website.neutralize_ribbon';
-- disable cdn
UPDATE website
SET cdn_activated = false;