Font provider submodules set their own weight to 1 in hook_enable() to ensure [provider]_preprocess_html() is called after fontyourface_preprocess_html(), in a manner like:

function font_provider_enable() {
  // Weight must be above @font-your-face weight so preprocess comes after
  db_query("UPDATE {system} SET weight = 1 WHERE name = 'font_provider'");

This code comes from 6.x and is not quite the proper way to do the task in D7. Documentation for db_query() explicitly tells us not to use it for UPDATE queries (while it still works for most users, it may fail on exotic databases). Hence, these lines need to be rewritten like:

function font_provider_enable() {
    ->fields(array('weight' => 1))
    ->condition('name', 'font_provider')

...and the comment could be a bit more verbose, too.

Here's how this was done for Edge Fonts module (which is not yet part of @font-your-face).

#2 fontyourface-convert-update-queries-1837202-2.patch4.71 KBsjhuda
PASSED: [[SimpleTest]]: [MySQL] 9 pass(es).
[ View ]


Drave Robber’s picture

Issue tags:+Novice


sjhuda’s picture

Status:Active» Needs review
new4.71 KB
PASSED: [[SimpleTest]]: [MySQL] 9 pass(es).
[ View ]

I've had a go at this. Let me know if it's OK (not just the code but also the patch/git process).


sreynen’s picture

Status:Needs review» Fixed

Looks good, thanks. Committed.

Looks like this is your first committed patch on, sjhuda. Congrats!

sjhuda’s picture

Thank you!

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