When a project node is deleted, the auto-generated path alias in {url_alias} is not automatically cleaned out. See #430528: Flag Form module short_path URL doesn't resolve for an example of the confusion this can cause.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dww’s picture

Holy cow, there are a lot of these:

mysql> SELECT COUNT(*) FROM url_alias u LEFT JOIN project_projects pp ON u.src = CONCAT('node/', pp.nid) WHERE pp.nid IS NULL AND u.dst RLIKE 'project/';
+----------+
| COUNT(*) |
+----------+
|     1028 | 
+----------+
1 row in set (10.45 sec)

I guess we need a DB update to run a DELETE query like that. There might be a better way to write this query. ;) Suggestions for improvement welcome.

dww’s picture

Assigned: Unassigned » dww
Status: Active » Needs review
FileSize
1.33 KB

Ran this on d6.d.o and had no problems. Also tested that the URL alias is removed when I delete project nodes. Any objections?

dww’s picture

Title: URL alias not deleted when projects are deleted » URL aliases not removed for some legacy project nodes that were deleted

path.module does this cleanup itself:

function path_nodeapi(&$node, $op, $arg) {
  ...
      case 'delete':
        $path = 'node/'. $node->nid;
        if (drupal_get_path_alias($path) != $path) {
          path_set_alias($path);
        }
        break;
    }
  ...
}

Tested and this works. We don't need the hunk in project.inc, after all.

I guess it doesn't really hurt to leave the cleanup DB update in project.install and leave this issue in this queue, but this seems most likely legacy goo from d.o badness. The newest deleted project node with a stale URL alias still in the table is node/143062 -- we have no way of knowing what version of path.module was deployed on d.o at that time, but perhaps it was something old and buggy.

dww’s picture