Forum OpenACS Q&A: Changing URL of Main Site: Error No Data Found

Hello!

After getting OpenACS to work properly I added several subsites and wanted to switch the subsite to the main site. I did it by going to acs-admin -> subsites -> Main Site -> Administration -> Edit and changing the URL there.

Now, every URL returns the following error:

Database operation "0or1row" failed (exception ERROR, "ERROR: NO DATA FOUND
CONTEXT: PL/pgSQL function site_node__find_pattern(integer) line 8 at RAISE
PL/pgSQL function site_node__node_id(character varying,integer) line 58 at RETURN
")

ERROR: NO DATA FOUND
CONTEXT: PL/pgSQL function site_node__find_pattern(integer) line 8 at RAISE
PL/pgSQL function site_node__node_id(character varying,integer) line 58 at RETURN

SQL:
select site_node__node_id('/', null)

while executing
"ns_pg_bind 0or1row $db $sql"
("uplevel" body line 3)
invoked from within
"uplevel 1 $code_block "
invoked from within
"db_with_handle -dbn $dbn db {
#ns_log notice "--sql=$sql"
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}"
(procedure "node_id" line 16)
::xo::db::sql::site_node->node_id
invoked from within
"next "
invoked from within
"ns_cache_eval -- site_nodes_id_cache id-/ { next }"
("uplevel" body line 1)
::acs::site_nodes_id_cache ::nx::Object->uplevel
invoked from within
":uplevel [list ns_cache_eval {*}$expires_flag -- [:cache_name $partition_key] $key $command]"
(procedure "eval" line 16)
invoked from within
"acs::site_nodes_id_cache eval id-$url { next }"
(procedure ":get_node_id" line 6)
invoked from within
"next"
(procedure ":get_node_id" line 33)
invoked from within
":get_node_id -url $url"
(procedure "get" line 14)
invoked from within
"::xo::site_node get -url $url -node_id $node_id"
(procedure "::nsf::procs::site_node::get" line 2)
invoked from within
"site_node::get -url $url"
(procedure "::nsf::procs::site_node::closest_ancestor_package" line 14)
invoked from within
"site_node::closest_ancestor_package -node_id [ad_conn node_id] -package_key [subsite::package_keys] -include_self -element "node_id""
(procedure "ad_conn" line 131)
invoked from within
"ad_conn subsite_node_id"
(procedure "ad_conn" line 135)
invoked from within
"ad_conn subsite_id"
(procedure ":get_context" line 10)
invoked from within
":get_context"
(procedure ":check" line 4)
invoked from within
":check"
(procedure "postauth" line 4)
invoked from within
"{*}$cmd"
("::try" body line 2)

How can this be fixed?

Thank you in advance,
Ann

Collapse
Posted by Antonio Pisano on

Dear Ann,

this happens because the name of the main subsite was changed, which should not be allowed by the user interface. We could reproduce the issue and we'll fix it.

For your instance, please execute this query in your postgres shell:

update site_nodes set name = '' where node_id = (select node_id from site_nodes order by node_id asc limit 1);

All the best

Antonio

Collapse
Posted by Gustaf Neumann on
Dear Ann,

OpenACS has no API for turning a subsite into the main site. Although it is possible to achieve something close to this by updating the site node relations in the site_nodes table (including re-parenting nodes), it is more complicated than this due to caching and membership relations (what should happen with the members of the main site) and membership inheritance. There are probably more things lurking in the dark, which would have to be addressed by such an operation.

OpenACS offers two means for achieving similar effects:
a) host-node maps (via web interface on side-wide admin pages) - binding a subsite to the name transmitted in the "host" header field.
b) un-monting and mounting of packages (e.g. unmount packages from the subsite, mount it on the main site or vice versa).

For the time being, it is the best to protect the system against killing it via the web interface, as it was committed yesterday by antonio.

all the best
-g

Collapse
Posted by Michael Aram on
Dear all,

I would say the API function for achieving this is subsite::pivot_root. I have actually used this function in one of our projects in the past, but it only does half of the job, thus I had to do some afterwork after calling this function. However, I ended up with what I wanted back then, namely having the subsite in question mounted at root.

Collapse
Posted by Gustaf Neumann on
i am not sure, what the intention of subsite::pivot_root actually is, since it just flips the package associated with a node_id, but lets e.g. the node-hierarchy unchanged. Since this function had already a couple of TODOs, and it is actually not clear, to what extend the subsite should/most be flipped, i added more potential TODOs to it. Since makes at least clear what the function does not do (yet).