? better_warnings_191393.patch ? bookpathalias_144366.patch ? delete_index_aliases_192576.patch ? edit_checkbox_remember_180440.patch ? no_alter_no_pattern_192300.patch ? only_alias_blogabble_bloggers_83993.patch ? require_code_191187.patch ? token_list_moved.patch ? verbose_perm_32956.patch Index: pathauto.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.inc,v retrieving revision 1.1.2.18 diff -u -p -r1.1.2.18 pathauto.inc --- pathauto.inc 16 Nov 2007 21:34:11 -0000 1.1.2.18 +++ pathauto.inc 17 Nov 2007 03:38:09 -0000 @@ -171,7 +171,7 @@ function pathauto_cleanstring($string, $ * @return * The alias that was created */ -function pathauto_create_alias($module, $op, $placeholders, $src, $type = NULL) { +function pathauto_create_alias($module, $op, $placeholders, $src, $entity_id, $type = NULL) { if (($op != 'bulkupdate') and variable_get('pathauto_verbose', FALSE) && user_access('notify of path changes')) { $verbose = TRUE; } @@ -249,7 +249,7 @@ function pathauto_create_alias($module, // If $pid is NULL, a new alias is created - otherwise, the existing // alias for the designated src is replaced - _pathauto_set_alias($src, $alias, $pid, $verbose, $old_alias); + _pathauto_set_alias($src, $alias, $module, $entity_id, $pid, $verbose, $old_alias); // Also create a related feed alias if requested, and if supported // by the module @@ -260,10 +260,10 @@ function pathauto_create_alias($module, if ($module == 'forum') { $pieces = explode('/', $src); $tid = $pieces[1]; - _pathauto_set_alias("taxonomy/term/$tid/$feedappend", "$alias/feed", NULL, $verbose); + _pathauto_set_alias("taxonomy/term/$tid/$feedappend", "$alias/feed", $module, $entity_id, NULL, $verbose); } else { - _pathauto_set_alias("$src/$feedappend", "$alias/feed", NULL, $verbose); + _pathauto_set_alias("$src/$feedappend", "$alias/feed", $module, $entity_id, NULL, $verbose); } } @@ -305,7 +305,7 @@ function _pathauto_path_is_callback($pat * If the item is currently aliased, the existing alias for that item. * */ -function _pathauto_set_alias($src, $dst, $pid = NULL, $verbose = FALSE, $old_alias = NULL) { +function _pathauto_set_alias($src, $dst, $entity_type, $entity_id, $pid = NULL, $verbose = FALSE, $old_alias = NULL) { // Alert users that an existing callback cannot be overridden automatically if (_pathauto_path_is_callback($dst)) { if ($verbose and user_access('notify of path changes')) { @@ -317,6 +317,9 @@ function _pathauto_set_alias($src, $dst, // Skip replacing the current alias with an identical alias if ($old_alias != $dst) { path_set_alias($src, $dst, $pid, 1, 10); + $new_pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s' and dst = '%s'", $src, $dst)); + db_query("INSERT INTO {url_alias_extra} (pid, dst, entity_type, entity_id, created_by) VALUES (%d, '%s', '%s', %d, '%s')", $new_pid, $dst, $entity_type, $entity_id, 'Pathauto'); + if (variable_get('pathauto_update_action', 2) == 3 && function_exists('path_redirect_save')) { if (isset($old_alias)) { $save['path'] = $old_alias; Index: pathauto.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.install,v retrieving revision 1.1.4.19 diff -u -p -r1.1.4.19 pathauto.install --- pathauto.install 29 Oct 2007 14:26:43 -0000 1.1.4.19 +++ pathauto.install 17 Nov 2007 03:38:09 -0000 @@ -62,9 +62,38 @@ function pathauto_install() { db_query("ALTER TABLE {variable} CHANGE name name varchar(128) NOT NULL default ''"); break; } - + // Clear the cache to get these to take effect. cache_clear_all(); + + // Create a table so that we can track which items we keep + // And eventually to improve join performance + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + db_query("CREATE TABLE {url_alias_extra} ( + pid int unsigned NOT NULL default 0, + dst varchar(128) NOT NULL default '', + entity_type varchar(20) default NULL, + entity_id int(10) unsigned default NULL, + created_by varchar(20) default NULL, + PRIMARY KEY (pid), + UNIQUE KEY dst (dst) + ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); + break; + case 'pgsql': + db_query("CREATE TABLE {url_alias_extra} ( + pid int_unsigned NOT NULL default 0, + dst varchar(128) NOT NULL default '', + entity_type varchar(20) default NULL, + entity_id int4 default NULL, + created_by varchar(20) default NULL, + PRIMARY KEY (pid), + UNIQUE (dst) + )"); + break; + } + } /** @@ -125,3 +154,33 @@ function pathauto_update_4() { $items = array(); return $items; } + +/** + * Create a table so that we can track which items we keep + * And eventually to improve join performance + */ +function pathauto_update_5() { + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + $ret[] = update_sql("CREATE TABLE {url_alias_extra} ( + pid int unsigned NOT NULL default 0, + dst varchar(128) NOT NULL default '', + entity_type varchar(20) default NULL, + entity_id int(10) unsigned default NULL, + created_by varchar(20) default NULL, + PRIMARY KEY (pid) + ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); + break; + case 'pgsql': + $ret[] = update_sql("CREATE TABLE {url_alias_extra} ( + pid int_unsigned NOT NULL default 0, + dst varchar(128) NOT NULL default '', + entity_type varchar(20) default NULL, + entity_id int4 default NULL, + created_by varchar(20) default NULL, + PRIMARY KEY (pid) + )"); + } + return $ret; +} \ No newline at end of file Index: pathauto.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.module,v retrieving revision 1.44.4.54 diff -u -p -r1.44.4.54 pathauto.module --- pathauto.module 16 Nov 2007 21:34:11 -0000 1.44.4.54 +++ pathauto.module 17 Nov 2007 03:38:11 -0000 @@ -554,7 +554,7 @@ function pathauto_nodeapi(&$node, $op, $ if ($node->pathauto_perform_alias || !isset($node->pathauto_perform_alias)) { $placeholders = pathauto_get_placeholders('node', $node); $src = "node/$node->nid"; - $alias = pathauto_create_alias('node', $op, $placeholders, $src, $node->type); + $alias = pathauto_create_alias('node', $op, $placeholders, $src, $node->nid, $node->type); } break; default: @@ -576,6 +576,8 @@ function pathauto_form_alter($formid, &$ if (!$pattern) { $pattern = variable_get('pathauto_node_pattern', FALSE); } + $path = $form['path']['path']['#default_value']; + $pid = db_result(db_query("SELECT pid FROM {url_alias_extra} WHERE dst = '%s'", $path)); if ($pattern && user_access('create url aliases')) { $output = t('An alias will be generated for you. If you wish to create your own alias below, untick this option.'); if (user_access('administer pathauto')) { @@ -586,7 +588,7 @@ function pathauto_form_alter($formid, &$ $form['path']['pathauto_perform_alias'] = array('#type' => 'checkbox', '#title' => t('Automatic alias'), - '#default_value' => TRUE, + '#default_value' => $pid, '#description' => $output, '#weight' => 0 ); @@ -651,14 +653,14 @@ function pathauto_user($op, &$edit, &$us if ($user->name) { $placeholders = pathauto_get_placeholders('user', $pathauto_user); $src = 'user/'. $user->uid; - $alias = pathauto_create_alias('user', $op, $placeholders, $src); + $alias = pathauto_create_alias('user', $op, $placeholders, $src, $user->uid); if (module_exists('blog')) { $new_user = $user; $new_user->roles = $edit['roles'] + array(DRUPAL_AUTHENTICATED_RID => 'authenticated user'); if (user_access('edit own blog', $new_user)) { $src = 'blog/'. $user->uid; - $alias = pathauto_create_alias('blog', $op, $placeholders, $src); + $alias = pathauto_create_alias('blog', $op, $placeholders, $src, $user->uid); } else { path_set_alias('blog/'. $user->uid); @@ -667,7 +669,7 @@ function pathauto_user($op, &$edit, &$us } if (module_exists('tracker')) { $src = 'user/'. $user->uid .'/track'; - $alias = pathauto_create_alias('tracker', $op, $placeholders, $src); + $alias = pathauto_create_alias('tracker', $op, $placeholders, $src, $user->uid); } } break; Index: pathauto_node.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto_node.inc,v retrieving revision 1.29.4.20 diff -u -p -r1.29.4.20 pathauto_node.inc --- pathauto_node.inc 25 Oct 2007 15:47:17 -0000 1.29.4.20 +++ pathauto_node.inc 17 Nov 2007 03:38:11 -0000 @@ -80,7 +80,7 @@ function node_pathauto_bulkupdate() { } $placeholders = pathauto_get_placeholders('node', $node); $src = "node/$node->nid"; - if ($alias = pathauto_create_alias('node', 'bulkupdate', $placeholders, $src, $node->type)) { + if ($alias = pathauto_create_alias('node', 'bulkupdate', $placeholders, $src, $node->nid, $node->type)) { $count++; } } Index: pathauto_taxonomy.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto_taxonomy.inc,v retrieving revision 1.20.4.16 diff -u -p -r1.20.4.16 pathauto_taxonomy.inc --- pathauto_taxonomy.inc 25 Oct 2007 17:18:57 -0000 1.20.4.16 +++ pathauto_taxonomy.inc 17 Nov 2007 03:38:12 -0000 @@ -79,13 +79,13 @@ function _taxonomy_pathauto_alias($categ // If we're in a forum vocabulary, also create a forum container, forum, or forum topic alias. if (module_exists('forum') && $forum_vid == (int)$category->vid) { $src = 'forum/'. $category->tid; - if ($alias = pathauto_create_alias('forum', $op, $placeholders, $src, $vid)) { + if ($alias = pathauto_create_alias('forum', $op, $placeholders, $src, $category->tid, $vid)) { $count++; } } else { $src = 'taxonomy/term/'. $category->tid; - if ($alias = pathauto_create_alias('taxonomy', $op, $placeholders, $src, $category->vid)) { + if ($alias = pathauto_create_alias('taxonomy', $op, $placeholders, $src, $category->tid, $category->vid)) { $count++; } } Index: pathauto_user.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto_user.inc,v retrieving revision 1.17.4.13 diff -u -p -r1.17.4.13 pathauto_user.inc --- pathauto_user.inc 25 Oct 2007 15:47:17 -0000 1.17.4.13 +++ pathauto_user.inc 17 Nov 2007 03:38:12 -0000 @@ -92,7 +92,7 @@ function user_pathauto_bulkupdate() { while ($user = db_fetch_object($result)) { $placeholders = pathauto_get_placeholders('user', $user); $src = 'user/'. $user->uid; - if ($alias = pathauto_create_alias('user', 'bulkupdate', $placeholders, $src)) { + if ($alias = pathauto_create_alias('user', 'bulkupdate', $placeholders, $src, $user->uid)) { $count++; } } @@ -115,7 +115,7 @@ function blog_pathauto_bulkupdate() { while ($user = db_fetch_object($result)) { $placeholders = pathauto_get_placeholders('user', $user); $src = 'blog/'. $user->uid; - if ($alias = pathauto_create_alias('blog', 'bulkupdate', $placeholders, $src)) { + if ($alias = pathauto_create_alias('blog', 'bulkupdate', $placeholders, $src, $user->uid)) { $count++; } } @@ -137,7 +137,7 @@ function tracker_pathauto_bulkupdate() { while ($user = db_fetch_object($result)) { $placeholders = pathauto_get_placeholders('user', $user); $src = 'user/'. $user->uid .'/track'; - if ($alias = pathauto_create_alias('tracker', 'bulkupdate', $placeholders, $src)) { + if ($alias = pathauto_create_alias('tracker', 'bulkupdate', $placeholders, $src, $user->uid)) { $count++; } }