There were several commits in HEAD post 7.x-1.0-alpha1 that changed taxonomy token names. Here's one: http://drupalcode.org/viewvc/drupal/contributions/modules/pathauto/patha....

As a result, for anyone who installed alpha1 and upgrades to beta1, going to admin/config/search/path/patterns reports an error.

Comments

effulgentsia’s picture

Status: Active » Needs review

My connection to CVS is currently flaky, so unable to roll a patch, but here's an update function that can be added to pathauto.install that appears to fix it.

/**
 * Update old taxonomy tokens with their new names.
 */
function pathauto_update_7005() {
  $variables = db_query('SELECT name FROM {variable} WHERE name LIKE :pattern OR name LIKE :pattern2', array(':pattern' => db_like('pathauto_taxonomy_term_') . '%' . db_like('pattern'), ':pattern2' => db_like('pathauto_forum_') . '%' . db_like('pattern')))->fetchCol();
  foreach ($variables as $variable) {
    $replacements = array(
      '[vocabulary:name]' => '[term:vocabulary]',
      '[term:catpath]' => '[term:name]',
    );
    $old_value = variable_get($variable);
    if (is_string($old_value)) {
      $new_value = str_replace(array_keys($replacements), array_values($replacements), $old_value);
      if ($new_value != $old_value) {
        variable_set($variable, $new_value);
      }
    }
  }
}
dave reid’s picture

Priority: Normal » Major
effulgentsia’s picture

StatusFileSize
new1.3 KB
dave reid’s picture

+++ pathauto.install	3 Feb 2011 22:31:36 -0000
@@ -135,6 +135,26 @@ function pathauto_update_7004() {
+    $old_value = variable_get($variable);
+    if (is_string($old_value)) {
+      $new_value = str_replace(array_keys($replacements), array_values($replacements), $old_value);
+      if ($new_value != $old_value) {
+        variable_set($variable, $new_value);
+      }
+    }

This could probably avoid the is_string() call by providing a default parameter of '' to variable_get()?

Powered by Dreditor.

dave reid’s picture

Status: Needs review » Needs work
dave reid’s picture

Also using db_like() doesn't work with db_query(). You have to use db_select().

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new2.47 KB
dave reid’s picture

Status: Needs review » Fixed

Tested this several times manually and it worked beautifully. Committed #7 to Git: http://drupalcode.org/project/pathauto.git/commit/44d4c68

Status: Fixed » Closed (fixed)

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