Use $CFG->cacheversion for HTMLPurifier revision number

Bug #1558387 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Low
Unassigned
1.10
Fix Released
Low
Unassigned
15.04
Fix Released
Low
Unassigned
15.10
Fix Released
Low
Unassigned

Bug Description

As is the recommended practice, Mahara caches the computed form of its HTMLPurifier rules, for performance. We have in place in clean_html() a setting for "HTML.DefinitionID", with a comment that says that the developer should increment that number if they make changes to the HTML Purifier definition. But in the past we have *not* done that, and instead manually deleted the htmlpurifier cache directory from the dataroot.

It occurs to me that it would be simpler to set HTML.DefinitionRev to "get_config('cacheversion')", so that it will be automatically cleared whenever the Mahara system version changes. The a dev just needs to bump version.php to make the HTMLPurifier cache get cleared.

This will cause the cache to be cleared more frequently than it needs to be (we rarely make changes to our HTMLPurifier configuration), but only once per Mahara upgrade, so that's still not too bad.

Aaron Wells (u-aaronw)
tags: added: cache htmlpurifier
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/6165

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6165
Committed: https://git.mahara.org/mahara/mahara/commit/42559c5b9d9d95af4d78c4e0511bec441d43ec84
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 42559c5b9d9d95af4d78c4e0511bec441d43ec84
Author: Aaron Wells <email address hidden>
Date: Thu Mar 17 18:34:45 2016 +1300

Use $CFG->cacheversion for HTMLPurifier cache version

Bug 1558387

With this, we don't have to remember to bump HTML.DefinitionRev in
html_clean(), or clear the htmlpurifier directory in dataroot.

behatnotneeded: API change only

Change-Id: I15cd291fd8e5d7d5c357f1595a89f34f44236e7d

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "15.10_STABLE" branch: https://reviews.mahara.org/6173

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/6175

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "1.10_STABLE" branch: https://reviews.mahara.org/6177

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6175
Committed: https://git.mahara.org/mahara/mahara/commit/71d4590ab7aa2343c2a4b8af68d02bf79b350dce
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit 71d4590ab7aa2343c2a4b8af68d02bf79b350dce
Author: Aaron Wells <email address hidden>
Date: Thu Mar 17 18:34:45 2016 +1300

Use $CFG->cacheversion for HTMLPurifier cache version

Bug 1558387

With this, we don't have to remember to bump HTML.DefinitionRev in
html_clean(), or clear the htmlpurifier directory in dataroot.

behatnotneeded: API change only

Change-Id: I15cd291fd8e5d7d5c357f1595a89f34f44236e7d

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6177
Committed: https://git.mahara.org/mahara/mahara/commit/1c654e04c1b5af2104b53fa51aa82843435514dd
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.10_STABLE

commit 1c654e04c1b5af2104b53fa51aa82843435514dd
Author: Aaron Wells <email address hidden>
Date: Thu Mar 17 18:34:45 2016 +1300

Use $CFG->cacheversion for HTMLPurifier cache version

Bug 1558387

With this, we don't have to remember to bump HTML.DefinitionRev in
html_clean(), or clear the htmlpurifier directory in dataroot.

behatnotneeded: API change only

Change-Id: I15cd291fd8e5d7d5c357f1595a89f34f44236e7d

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6173
Committed: https://git.mahara.org/mahara/mahara/commit/f9c20cfd09388c5b531bc6079ea0b83ae3d6cb20
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.10_STABLE

commit f9c20cfd09388c5b531bc6079ea0b83ae3d6cb20
Author: Aaron Wells <email address hidden>
Date: Thu Mar 17 18:34:45 2016 +1300

Use $CFG->cacheversion for HTMLPurifier cache version

Bug 1558387

With this, we don't have to remember to bump HTML.DefinitionRev in
html_clean(), or clear the htmlpurifier directory in dataroot.

behatnotneeded: API change only

Change-Id: I15cd291fd8e5d7d5c357f1595a89f34f44236e7d

no longer affects: mahara/16.04
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.