Forum OpenACS Development: Re: Lars Blogger multilanguage support

Collapse
Posted by Eduardo Santos on
Hi everybody,

I'm facing some troubles with the lars blogger migration script, mine above or Cognovis' in the address http://www.cognovis.de/developer/en/xowiki-upgrade-lars-blogger.

I'm using the latest XoWiki and XoTcl versions (0.95 and 0.90) and it seems like the script is broken. I've tried to change the script like this:

# Change the following variables to suit your environment
set pinds_package_id 3900
set xowiki_package_id 4345
set xowiki_folder_id 4368

db_1row template "select item_id as page_template, parent_id as xowiki_folder_id from cr_items where name = 'en:news-item' and content_type = '::xowiki::Form' and parent_id = :xowiki_folder_id"

## Do not change anything below

set import ""
db_foreach pinds_entry {select creation_user, creation_ip, creation_date, entry_date as last_modified, p.title, title_url as detail_link, content, content_format, draft_p from pinds_blog_entries p, acs_objects o where p.entry_id = o.object_id and p.package_id = :pinds_package_id} {

# Set publish status
if {$draft_p} {
set publish_status "production"
} else {
set publish_status "ready"
}

# Text conversion
if {$content_format ne "text/html"} {
set content [ad_html_text_convert -from $content_format -to "text/html" $content]
}

set item_id [db_nextval acs_object_id_seq]
set creator [person::name -person_id $creation_user]

set import "::xowiki::FormPage create \
page_template $page_template \
creator $creator \
instance_attributes {detail_link $detail_link} \
description {} \
text {$content} \
package_id $xowiki_package_id \
name $item_id \
title $title \
publish_status $publish_status \
last_modified $last_modified \
parent_id $xowiki_folder_id"

}
if {[catch {namespace eval ::xo::import $import} error]} {
set msg "Error: $error"
} else {
set msg [$xowiki_package_id import -replace 0]
}

But I keep seeing this error message:

invalid command name "4345"
while executing
"$xowiki_package_id import -replace 0
"

I've tried to find out, but I don't know where it's coming from. Can you help me on this?

Collapse
Posted by Gustaf Neumann on
Eduardo, you have not created the package object (via ::xowiki::Package initialize ...) in your variant of Maltes script.

I have added an improved and more robust version for recent xowiki versions to the XoWiki documentation in:
http://alice.wu-wien.ac.at:8000/xowiki-doc/#import-export-from-other-sources

Best regards
-gustaf neumann

Collapse
Posted by Richard Hamilton on

I have been reading through the content migration scripts for general interest and, please forgive me if I am mistaken, but I think something is amiss in the third example script posted here:

http://alice.wu-wien.ac.at:8000/xowiki-doc/#import-export-from-other-sources

8.3.2 Import and Export of XoWiki Pages from other Sources

...

if {$root(package_id) == $pinds(package_id)} {
  ns_return 200 text/plain "Cannot find xowiki instance '$xowiki_url'"
  ad_script_abort
} elseif {$root(package_id) == $pinds(package_id) } {
  ns_return 200 text/plain "Cannot find lars_blogger instance '$lars_blogger_url'"
  ad_script_abort
}

...

How can the elseif clause ever be true/executed?

It looks to me as if there might once have been an array set for the xowiki url #using [site_node::get_from_url -url $xowiki_url] # and that the if/elseif has been modified but not cleaned up.

This is clearly not important, but I think it might mean that if the lars blogger instance cannot be found, the error will say that it is the xowiki instance that cannot be found.

Collapse
Posted by Gustaf Neumann on
the code testing for the existence of an xowiki instance was not correct. i've updated it to make it look more reasonable.