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() {
  db_update('system')
    ->fields(array('weight' => 1))
    ->condition('name', 'font_provider')
    ->execute();

...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).

CommentFileSizeAuthor
#2 fontyourface-convert-update-queries-1837202-2.patch4.71 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Drave Robber’s picture

Issue tags: +Novice

Tagging.

Anonymous’s picture

Status: Active » Needs review
FileSize
4.71 KB

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

Thanks!

sreynen’s picture

Status: Needs review » Fixed

Looks good, thanks. Committed.

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

Anonymous’s picture

Thank you!

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