Index: openacs.org-dev/www/bboard-migr/cat-migr.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/www/bboard-migr/cat-migr.tcl,v diff -u -r1.1 -r1.2 --- openacs.org-dev/www/bboard-migr/cat-migr.tcl 10 Jul 2002 19:29:04 -0000 1.1 +++ openacs.org-dev/www/bboard-migr/cat-migr.tcl 30 Jul 2002 21:00:12 -0000 1.2 @@ -1,7 +1,7 @@ #hardcode if you're not in the correct package instance... #set package_id [ad_conn package_id] -set package_id 3189 +set package_id 3061 #hardcode regexp for link replacement #... later Index: openacs.org-dev/www/bboard-migr/msg-migr.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/www/bboard-migr/msg-migr.tcl,v diff -u -r1.5 -r1.6 --- openacs.org-dev/www/bboard-migr/msg-migr.tcl 22 Jul 2002 20:08:54 -0000 1.5 +++ openacs.org-dev/www/bboard-migr/msg-migr.tcl 30 Jul 2002 21:00:12 -0000 1.6 @@ -5,7 +5,7 @@ set bboard_package "forums" #set package_id [ad_conn package_id] -set package_id 12679 +set package_id 3061 set olddb [ns_db gethandle acs32] Index: openacs.org-dev/www/bboard-migr/subs-forum-migr.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/www/bboard-migr/subs-forum-migr.tcl,v diff -u -r1.2 -r1.3 --- openacs.org-dev/www/bboard-migr/subs-forum-migr.tcl 29 Jul 2002 09:03:13 -0000 1.2 +++ openacs.org-dev/www/bboard-migr/subs-forum-migr.tcl 30 Jul 2002 21:00:12 -0000 1.3 @@ -41,6 +41,8 @@ (forum_id, subscriber_id) values (:new_forum_id, :new_user_id)" + set id_description "forum-user" + } else { # assume it's the new "forums" package @@ -54,22 +56,23 @@ and user_id = :new_user_id and object_id = :new_forum_id " + + set id_description "request_id" } set nil [set new [list]] set output "" - while { [ns_db getrow $olddb $selection] } { - set_variables_after_query +while { [ns_db getrow $olddb $selection] } { + set_variables_after_query -db_transaction { + db_transaction { #also lookup forum and user mapping db_1row q $forum_mapping_sql db_1row q $user_mapping_sql incr n_tried_old - if [db_0or1row r $mapped_subs_sql] { ##already mapped, sets new_map_id set new_id $new_map_id @@ -84,18 +87,20 @@ if {[string equal $frequency "Monday/Thursday"]} { set frequency "every other day" } - set interval_id [notification::get_interval_id $frequency] + set interval_id [notification::get_interval_id \ + -name $frequency] set request_id [notification::request::new -type_id $type_id \ - -user_id :new_user_id -object_id :new_forum_id \ - -interval_id $interval_id \ + -user_id $new_user_id -object_id $new_forum_id \ + -interval_id $interval_id \ -delivery_method_id $delivery_method_id -format "text"] + } set new_id "$new_forum_id-$new_user_id" set action "new" } set html " - forum-user: $new_id + $id_description: $new_id
" lappend $action $html @@ -112,7 +117,7 @@ Migratonisubscripforum

Migrating Forum Subscrtiptions

Unsorted Output:

$output

Sorted Output:

-

[llength $nil] nil -- categorys already created & mapped

[join $nil]

+

[llength $nil] nil -- subscriptions already created & mapped

[join $nil]

[llength $new] new -- uncreated and unmapped

[join $new]

" Index: openacs.org-dev/www/bboard-migr/subs-thread-migr.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/www/bboard-migr/subs-thread-migr.tcl,v diff -u -r1.1 -r1.2 --- openacs.org-dev/www/bboard-migr/subs-thread-migr.tcl 10 Jul 2002 19:29:04 -0000 1.1 +++ openacs.org-dev/www/bboard-migr/subs-thread-migr.tcl 30 Jul 2002 21:00:12 -0000 1.2 @@ -1,7 +1,11 @@ #hardcode if you're not in the correct package instance... +# which package are we using +#set bboard_package "bboard" +set bboard_package "forums" + #set package_id [ad_conn package_id] -set package_id 3189 +set package_id 3061 set olddb [ns_db gethandle acs32] @@ -26,61 +30,95 @@ #note: no migr_map neccessary for subscriptions # or even possible -- covered by user and topic map -set mapped_subs_sql " -select thread_id || '-' || subscriber_id as new_map_id - from bboard_thread_subscribers -where thread_id = :new_thread_id -and subscriber_id = :new_user_id" +if {[string equal $bboard_package "bboard"]} { -set map_subs_sql " -insert into bboard_thread_subscribers -(thread_id, subscriber_id) values -(:new_thread_id, :new_user_id)" + set mapped_subs_sql " + select thread_id || '-' || subscriber_id as new_map_id + from bboard_thread_subscribers + where thread_id = :new_thread_id + and subscriber_id = :new_user_id" + + set map_subs_sql " + insert into bboard_thread_subscribers + (thread_id, subscriber_id) values + (:new_thread_id, :new_user_id)" + set id_description "thread-user" + +} else { + # assume it's the new "forums" package + + set type_id [notification::type::get_type_id -short_name forums_message_notif] + set delivery_method_id [notification::get_delivery_method_id -name "email"] + set interval_id [notification::get_interval_id -name "instant"] + + set mapped_subs_sql " + select request_id as new_map_id + from notification_requests + where type_id = :type_id + and user_id = :new_user_id + and object_id = :new_thread_id +" + + set id_description "request_id" +} + set nil [set new [list]] set output "" -db_transaction { while { [ns_db getrow $olddb $selection] } { set_variables_after_query - #also lookup thread and user mapping - db_1row q $thread_mapping_sql - db_1row q $user_mapping_sql + db_transaction { + #also lookup thread and user mapping + db_1row q $thread_mapping_sql + db_1row q $user_mapping_sql - incr n_tried_old + incr n_tried_old - if [db_0or1row r $mapped_subs_sql] { - ##already mapped, sets new_map_id - set new_id $new_map_id - set action "nil" - } else { - #it's new; insert it. - db_dml q $map_subs_sql - set new_id "$new_thread_id-$new_user_id" - set action "new" - } + if [db_0or1row r $mapped_subs_sql] { + ##already mapped, sets new_map_id + set new_id $new_map_id + set action "nil" + } else { + #it's new; insert it. + if {[string equal $bboard_package "bboard"]} { + db_dml q $map_subs_sql + } else { + # assume it's the new "forums" package - set html " - thread-user: $new_id -
" + set request_id [notification::request::new -type_id $type_id \ + -user_id $new_user_id -object_id $new_thread_id \ + -interval_id $interval_id \ + -delivery_method_id $delivery_method_id -format "text"] - lappend $action $html - - append output "$action: $html" - + + } + + set new_id "$new_thread_id-$new_user_id" + set action "new" + } + + set html " + $id_description: $new_id +
" + + lappend $action $html + + append output "$action: $html" + + } on_error { + set output "

Error:

$errmsg


$output" + } } -} on_error { - set output "

Error:

$errmsg


$output" -} ns_db releasehandle $olddb - + ns_return 200 text/html " -Migratonisubscripforum -

Migrating Forum Subscrtiptions

+Migratonisubscrimessage +

Migrating Message Subscrtiptions

Unsorted Output:

$output

Sorted Output:

-

[llength $nil] nil -- categorys already created & mapped

[join $nil]

+

[llength $nil] nil -- subscriptions already created & mapped

[join $nil]

[llength $new] new -- uncreated and unmapped

[join $new]

" Index: openacs.org-dev/www/bboard-migr/user-migr.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/www/bboard-migr/user-migr.tcl,v diff -u -r1.4 -r1.5 --- openacs.org-dev/www/bboard-migr/user-migr.tcl 17 Jul 2002 13:31:51 -0000 1.4 +++ openacs.org-dev/www/bboard-migr/user-migr.tcl 30 Jul 2002 21:00:12 -0000 1.5 @@ -7,9 +7,9 @@ # added where and order by clauses (olah) set selection [ns_db select $olddb " select last_name, first_names, email, password, url, - user_id as old_user_id, registration_date, registration_ip + user_id as old_user_id, registration_date, + registration_ip, user_state from users - where user_state ='authorized' order by user_id "] @@ -30,6 +30,23 @@ while { [ns_db getrow $olddb $selection] } { set_variables_after_query + # we'are mapping the user_state/member_state of the users thusly: + # 3.x <--> 4.5 + # need_email_verification_and_admin_approv <--> needs approval + # need_admin_approv <--> needs approval + # need_email_verification <--> needs approval + # rejected <--> rejected + # authorized <--> approved + # deleted <--> deleted + + switch [string range $user_state 0 3] { + auth { set member_state "approved" } + dele { set member_state "deleted" } + need { set member_state "needs approval" } + reje { set member_state "rejected" } + default { set member_state "rejected" } + } + incr n_tried_old if [db_0or1row tt $new_user_sql] { # a user with this email address is already on the new system. @@ -59,7 +76,7 @@ # mapped before. the user probably changed email address since the last # pass of this script... let's create a new user (or should we update the email address). - set new_created_id [ad_user_new $email $first_names $last_name $password "" "" $url "t" "approved" "" $registration_date $registration_ip] + set new_created_id [ad_user_new $email $first_names $last_name $password "" "" $url "t" $member_state "" $registration_date $registration_ip] set new_id $new_map_id set action "update" @@ -68,7 +85,7 @@ # mapped before. let's create this previously unseen user and register # the event in the mapping table. - set new_created_id [ad_user_new $email $first_names $last_name $password "" "" $url "t" "approved" "" $registration_date $registration_ip] + set new_created_id [ad_user_new $email $first_names $last_name $password "" "" $url "t" $member_state "" $registration_date $registration_ip] db_dml q "insert into migr_user_map (old_user_id, new_user_id) values ($old_user_id, $new_created_id)" set new_id $new_created_id