Troubleshooting a migration into a Drupal database: "page not found" or no titles listed
At times, after you've imported your content into the appropriate Drupal tables, you get a "page not found" error or just various weirdnesses. Sometimes Drupal needs a kick in the pants to register your imported nodes.
First, clear your caches. If that doesn't work, try clearing them again and running cron. Next, you may need some stronger medicine.
Loading your nodes programmatically and saving them using Drupal's built in functions allows your nodes to register themselves with the various contributed modules on your site and can resolve various issues.
I did this using a short script:
Caution: if you have Pathauto enabled with it's default settings, this will create new aliases for all your nodes based on their titles. If you don't want this, either disable pathauto before running, or change pathauto's settings to not automatically alias all saved nodes if they already have a URL alias.
<?php
/**this script can be copied to a file in the root of your drupal install
** and invoked by visiting yoursite.com/name_of_file.php
** This loads and then programmically saves all the nodes
** in you drupal installation.
** You must change the 'chdir' directory to your Drupal root.
**/
//change this to the root directory of your drupal installation:
chdir('/home/members/quixote/sites/d6');
include_once('./includes/bootstrap.inc');
include_once('./modules/node/node.pages.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
db_set_active('default');
$sql = "SELECT `nid` FROM node ORDER BY node.nid";
$results = db_query($sql);
$old_dump = array();
while( $nodes = db_fetch_object($results) ) {
print_r ($nodes->nid);
$currentnode = node_load( $nodes->nid );
print_r($currentnode);
node_save( $currentnode );
}
?>