Index: gsitemap.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/gsitemap/Attic/gsitemap.install,v retrieving revision 1.4.2.20 diff -u -p -r1.4.2.20 gsitemap.install --- gsitemap.install 7 Oct 2007 17:26:42 -0000 1.4.2.20 +++ gsitemap.install 7 Oct 2007 18:29:02 -0000 @@ -52,6 +52,16 @@ function gsitemap_install() { } /** + * Implementation of hook_enable(). + */ +function gsitemap_enable() { + $weight = db_result(db_query("SELECT weight FROM {system} WHERE type = 'module' AND name = 'pathautho'")); + if ($weight !== FALSE) { + db_query("UPDATE {system} SET weight = %d WHERE type = 'module' AND name = 'gsitemap'", ++$weight); + } +} + +/** * Implementation of hook_disable(). */ function gsitemap_disable() { @@ -144,10 +154,10 @@ function gsitemap_update_4() { db_add_column($ret, 'gsitemap', 'pid', 'integer'); break; } - $result = db_query('SELECT nid FROM {gsitemap}'); - while ($node = db_fetch_object($result)) { - $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", 'node/'. $node->nid)); - db_query('UPDATE {gsitemap} SET pid = %d WHERE nid = %d', $pid, $node->nid); + $nids = db_query('SELECT nid FROM {gsitemap}'); + while ($node = db_fetch_object($nids)) { + $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = 'node/%s'", $node->nid)); + $ret[] = update_sql("UPDATE {gsitemap} SET pid = $pid WHERE nid = $node->nid"); } _gsitemap_update_cache(); menu_rebuild(); @@ -168,6 +178,17 @@ function gsitemap_update_5() { } function gsitemap_update_6() { - return array(update_sql("DELETE FROM {url_alias} WHERE dst LIKE 'sitemap%.xml'")); + $ret[] = update_sql("DELETE FROM {url_alias} WHERE dst LIKE 'sitemap%.xml'"); + $weight = db_result(db_query("SELECT weight FROM {system} WHERE type = 'module' AND name = 'pathautho'")); + if ($weight !== FALSE) { + $ret[] = update_sql("UPDATE {system} SET weight = %d WHERE type = 'module' AND name = 'gsitemap'", ++$weight); + } + $nids = db_query('SELECT nid FROM {gsitemap}'); + while ($node = db_fetch_object($nids)) { + $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = 'node/%s'", $node->nid)); + $ret[] = update_sql("UPDATE {gsitemap} SET pid = $pid WHERE nid = $node->nid"); + } + _gsitemap_update_cache(); + return $ret; }