Last updated 29 August 2012. Created on 18 January 2011.
Edited by jenlampton, tamerzg. Log in to edit this page.

To migrate from Audio module to AudioField module in Drupal 6 please try this module:

If you have added any additional fields to the Audio node type provided by the audio module, you will need to modify the content type provided by this feature, and make sure all the fields are the same on your new Podcast node type before running the migration.

Alternatively, you can also try use this hackey script:

// ***** CONFIGURATION *******
// The audiofield CCK that you have already created as per Prerequisites.
$field_name = 'field_audio';
// The content type that you have already created as per Prerequisites.
$type_name = 'audio2';

//Database settings
// ***** END CONFIGURATION *******

$db_source_link=mysql_connect("localhost",$db_username,$db_password) or die("Error connecting to database");

mysql_select_db($source_db_name,$db_source_link) or die("Error connecting to drupal database");

// Populate the audiofield table for every audio node.
$table = 'content_type_'. $type_name;
$fid = $field_name. '_fid';
$res=mysql_query("SELECT * FROM audio",$db_source_link);

	mysql_query( "INSERT INTO $table (vid,nid,$fid) VALUES(".$audio['vid'].",".$audio['nid'].",".$audio['fid'].")",$db_source_link);
echo "- $counter audio nodes migrated.<br />\n";

// Change the content type from 'audio' to the configured type.
mysql_query("UPDATE node SET type = '$type_name' WHERE type = 'audio'",$db_source_link);

// Clear CCK cache.
mysql_query("DELETE FROM cache_content",$db_source_link);

Looking for support? Visit the forums, or join #drupal-support in IRC.


Sakrecoer’s picture

I love you and i Love you even more!

Right on time my beloved php gurus! :)

Now, despite this, my n00biness implies the following question:
where do I enter this script?

open your mind open the source
express yourself, share your tools

Sakrecoer’s picture

Could this be my sollution?:

Copy paste the code.
Adapt the information to my server (dbname, user pass etc...)
save it to a php file in the webfile root
run it from my webrowser?

greatfull for an answer :)

open your mind open the source
express yourself, share your tools

jenlampton’s picture

It looks horribly dangerous for someone who doesn't know exactly what they are doing.

Give the module a shot (on a test site) and see if that does the trick for you.

captcha’s picture

Yes, that works for me.
But I had to echo the insert statements and paste the sql code directly through phpmyadmin into the content_type_ table as the data wasn't getting inserted otherwise.

$sql_str = "INSERT INTO $table (vid,nid,".$fid.") VALUES(".$audio['vid'].",".$audio['nid'].",".$audio['fid'].");";
echo $sql_str."<br>";
$rs = mysql_query( $sql_str,$db_source_link);