Drupal 4.7 to 5.x conversion

udvranto - November 1, 2009 - 05:21
Project:Birthdays
Version:4.7.x-1.0.x-dev
Component:Code
Category:task
Priority:minor
Assigned:udvranto
Status:patch (to be ported)
Description

I used to the following code thru drush for conversion.

<?php
db_query("INSERT INTO {profile_fields} (title, name, explanation, category, type, weight, required, register, visibility, autocomplete, options, page) VALUES ('জন্মতারিখ', 'profile_birthday', '', 'প্রোফাইল', 'date', 0, 0, 1, 1, 1, '', '')");
$result=db_query("SELECT fid FROM {profile_fields} WHERE name=\"profile_birthday\"");
$profile_field = db_fetch_object($result);
$fid = $profile_field->fid;

variable_set('birthdays_field_id',$fid);

//$fid=13;

$result = db_query('SELECT uid, birthday FROM {dob}');
while ($dob = db_fetch_object($result))
{
list($year, $month, $day) = split('[/.-]', $dob->birthday);

$birthday = array("day" => (int)$day, "month" => (int)$month, "year" => (int)$year);

db_query("INSERT INTO {profile_values} (fid, uid, value) VALUES (%d, %d, '%s')",$fid, $dob->uid, serialize($birthday));
}

 
 

Drupal is a registered trademark of Dries Buytaert.