Importing mojoportal 1.x site data into 2.x install

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
1/19/2009 1:34:16 PM
Gravatar
Total Posts 29

Importing mojoportal 1.x site data into 2.x install

Hi everybody,

I currently run two sites with mojoportal 1 (one featuring an open source toolkit for security research, the other one being my personal homepage - I think one of the earliest pages having used mojoportal under Linux/mono) and have been quite happy with it so far. Now that mojoportal 2 runs smoothly under Linux/mono (that is, with sufficiently recent mono packages being available in Debian proper, albeit still with some experimental package mix-in), I would like to update.

Prior tries with importing my (PostgreSQL) database into a test system and then updating the database schema using mojoportal db-scripts went horribly wrong, with mojoportal 2 unable to start properly and not being able to display even the main entry page. Thus, my current try is a fresh mojoportal 2 install with "empty" database (that is, automatically created by the setup), which works nicely on its own (again, on a Debian system).

Now the problem: How can I import the old site data into the new installation without doing it manually by copy&paste using a browser? I already tried dumping the old database in form of SQL inserts and selectively (only those tables that are not for configuration but seem to contain pure data) importing them in the new database, which obvioiusly doesn't work in a lot of cases because the schema changed (and, btw, is a nice way to break the new installation).

Is there a way to import this data, or do I need to try and convert the old site using the schema update scripts? The latter approach seems even more problematic than the first one. I don't use too many mojoportal modules right now, mostly static HTML data and one blog/news block for each of the sites. If I could import just the page structure and static HTML fragments, I could rather easily adapt the rest.

Any hints would be highly appreciated,

Rene

1/19/2009 1:57:46 PM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Hi Rene,

I can't think of any good way to get there other than upgrading. I know it can be very difficult upgrading from such an old version but it is possible. Recently someone emailed and told me they managed to upgrade a very old Mono installation of mojoPortal. I have some notes at the bottom of the upgrading page, though you probably saw that already.

The only other way I think would be to re-create the pages manually. I'm not sure which approach will be the least painful as they both seem very painful.

I will say that since my blog post, several Mono bugs have been reported, but as far as I know you will be ok with the features you mention.

Wish I knew of a way to make it easier. If only you can manually upgrade to 2.2.1.5 then the rest should work from the automated upgrading system by visiting /Setup/Default.aspx.

Best,

Joe

1/19/2009 2:25:45 PM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

Wow, you're as quick in responding as ever!

I'll try to follow your advice and go the upgrade route again. Would you recommend running the db-update scripts manually to change the schema and then see what new tables are missing?

PS: The only reason why I haven't create a new mojoportal Debian package yet is simply lack of time. But if anybody else would like to spend some time towards that aim, I would be more than happy to assist (and also sponsor package uploads!).

best regards,

Rene

1/19/2009 2:34:57 PM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Hi Rene,

The hard part is if you don't know your current version. Whatever your current version you want to run the manual upgrade scripts from the legacy-dbscripts folder starting with the one after your current version until you get up to 2.2.1.5. After that if the new code is deployed, you can visit /Setup/Default.aspx and with luck the rest of the upgrade scripts will run ok.

Before doing any upgrade I would rename the original subblue skin folder to jsavard-subblue and set that as your skin before upgrading sql or code. Skinning has changed a lot since the 1.1 framework so you will have to re-do your custom skin afterwards.

Hope it helps,

Joe

1/19/2009 4:10:58 PM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

My current version is 1.0.4 with a few updates taken from SVN to fix mono problems. I could successfully dump the current database, and then run the update scripts in this order (on a test server): 3CreateStoredProcedures.sql, upgradefrom1-0to1-01-or-2-01.sql, upgradefrom2-01to2-1.sql, upgradefrom2-1to2-2.sql, upgradefrom2-2-0to2-2-1.sql, and upgradefrom2-2-1to2-2-1-5.sql (this one is in fact empty for PostgreSQL it seems). Then I ran 3CreateStoredProcedures.sql to update/create those functions that required new tables.

For the record, I initially ran those as the database superuser (postgres) to avoid permission problems. This in turn created permissions problems for the Setup/Default.aspx routine because it created new tables and functions as user "postgres". The tables were not many and easily fixed manually, but for the functions I scripted the owner change:

    echo "\df" | sudo sudo -u postgres psql mojoportal | grep " mp_" | cut -d'|' -f2,4 | while read func sep rem; do echo "alter function $func($rem) owner to mojo;" | sudo sudo -u postgres psql mojoportal; done

This did not appear to change all permissions (although it didn't give me any errors), so I dropped functions and types altogether:

    echo "\df" | sudo sudo -u postgres psql mojoportal | grep " mp_" | cut -d'|' -f2,4 | while read func sep rem; do echo "drop function $func($rem);" | sudo sudo -u postgres psql mojoportal; done

    echo "\dT" | sudo sudo -u postgres psql mojoportal | grep " mp_" | cut -d'|' -f2 | while read type; do echo "drop type $type;" | sudo sudo -u postgres psql mojoportal; done

and re-created them with 3CreateStoredProcedures.sql, this time executed as user "mojo". This got rid of the permissions problem.

However, there's still something wrong. Setup/Default.aspx now gives me:

Probing system...
File system permissions ok.
pgsql database connection ok.
database permissions are sufficient to alter schema.
database initial schema already exists.
database core schema needs upgrade.
2 site(s) found.
Running script mojoportal-core - 2.2.1.5 - 00:00:00.3359250
Npgsql.NpgsqlException: operator does not exist: integer = character varying Severity: ERROR Code: 42883 Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. at Npgsql.NpgsqlState+ c__Iterator1.MoveNext () [0x00000] at Npgsql.ForwardsOnlyDataReader.GetNextResponseObject () [0x00000] - 00:00:00.9667060
Note: This page shows some information that is helpful during setup and upgrades but for security it would be best not to show any information when the system is up to date. You can disable setup and suppress all information on this page by setting DisableSetup=true in Web.config. When you need to upgrade, you can set this back to false. If you are logged in as Administrator setup will run and you will be able to see this page even if it is disabled in Web.config so you can easily leave it disabled and just login before upgrading. But if you are not logged in you will need to enable setup in Web.config.

 

Are there any custom operators for integer/varchar conversion in mojoportal or does this indicate that some functions/types still don't match the current database schema? Do you happen to have any hint on how I should proceed from here?

PS: I cannot easily change the skin on my in-production sites, so I intend to do that directly in the database. Would you expect a problem with this approach?

best regards,

Rene

1/19/2009 4:15:27 PM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Hi Rene,

I don't think you should run 3CreateStoredProcedures.sql, just the ones that have upgrade in the name.

I don't know if running that is the cause of the problem but it might be.

Hope it helps,

Joe

1/19/2009 4:39:32 PM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

I re-tried the upgrade without running 3CreateStoredProcedures.sql and get the same error:

Probing system...
File system permissions ok.
pgsql database connection ok.
database permissions are sufficient to alter schema.
database initial schema already exists.
database core schema needs upgrade.
2 site(s) found.
Running script mojoportal-core - 2.2.1.5 - 00:00:01.1931850
Npgsql.NpgsqlException: operator does not exist: integer = character varying Severity: ERROR Code: 42883 Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. at Npgsql.NpgsqlState+ c__Iterator1.MoveNext () [0x00000] at Npgsql.ForwardsOnlyDataReader.GetNextResponseObject () [0x00000] - 00:00:01.8532410
Note: This page shows some information that is helpful during setup and upgrades but for security it would be best not to show any information when the system is up to date. You can disable setup and suppress all information on this page by setting DisableSetup=true in Web.config. When you need to upgrade, you can set this back to false. If you are logged in as Administrator setup will run and you will be able to see this page even if it is disabled in Web.config so you can easily leave it disabled and just login before upgrading. But if you are not logged in you will need to enable setup in Web.config.

best regards,

Rene

1/19/2009 4:47:52 PM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Hi Rene,

To trouble shoot this I would try running the 2.2.1.5 script manually.

Its located at /Setup/applications/mojoportal-core/SchemaUpgradeScripts/pgsql/2.2.1.5.config

Maybe running it manually will give better clues.

If it runs then you need to do an insert in the mp_schemaversion table.

insert into mp_schemaversion (applicationid,applicationname,major,minor,build,revision)
values ('077e4857-f583-488e-836e-34a4b04be855','mojoportal-core',2,2,1,5);

after that you can try the /Setup/Default.aspx page again and see if it will run the rest. If you have to run more manually just increment the version in this tables according to the script you ran.

Hope it helps,

Joe

1/19/2009 5:19:48 PM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

A little web search pointed me towards the same error with other PostgreSQL clients as well - it seems version 8.3 is more picky and some database layers don't cope with that. I now downgraded to PostgreSQL 8.1 and manually fixed some more permissions. Now I get farther:

 

Probing system...
File system permissions ok.
pgsql database connection ok.
database permissions are sufficient to alter schema.
database initial schema already exists.
database core schema needs upgrade.
2 site(s) found.
Running script mojoportal-core - 2.2.1.6 - 00:00:00.5516070
Running script mojoportal-core - 2.2.1.7 - 00:00:00.6990970
Running script mojoportal-core - 2.2.1.8 - 00:00:00.8414640
Running script mojoportal-core - 2.2.1.9 - 00:00:02.5850800
Running script mojoportal-core - 2.2.2.0 - 00:00:04.3527810
Running script mojoportal-core - 2.2.2.1 - 00:00:05.6415290
Running script mojoportal-core - 2.2.2.2 - 00:00:06.3948860
Running script mojoportal-core - 2.2.2.3 - 00:00:07.3406880
Running script mojoportal-core - 2.2.2.4 - 00:00:09.2846800
Running script mojoportal-core - 2.2.2.5 - 00:00:10.3491630
Running script mojoportal-core - 2.2.2.6 - 00:00:11.4374300
Running script mojoportal-core - 2.2.2.7 - 00:00:13.2176470
Running script mojoportal-core - 2.2.2.8 - 00:00:15.1374400
Running script mojoportal-core - 2.2.2.9 - 00:00:16.3398260
Running script mojoportal-core - 2.2.3.0 - 00:00:17.7880560
Running script mojoportal-core - 2.2.3.1 - 00:00:20.8098910
Running script mojoportal-core - 2.2.3.2 - 00:00:22.6965220
Running script mojoportal-core - 2.2.3.3 - 00:00:24.8435370
Running script mojoportal-core - 2.2.3.4 - 00:00:28.2308670
Running script mojoportal-core - 2.2.3.5 - 00:00:32.4490400
Running script mojoportal-core - 2.2.3.6 - 00:00:33.7729650
Running script mojoportal-core - 2.2.3.7 - 00:00:35.4236180
Running script mojoportal-core - 2.2.3.8 - 00:00:37.0137080
Running script mojoportal-core - 2.2.3.9 - 00:00:38.1221670
Npgsql.NpgsqlException: multiple primary keys for table "mp_modules" are not allowed Severity: ERROR Code: 42P16 at Npgsql.NpgsqlState+c__Iterator1.MoveNext () [0x00000] at Npgsql.ForwardsOnlyDataReader.GetNextResponseObject () [0x00000] - 00:00:38.2734760
Note: This page shows some information that is helpful during setup and upgrades but for security it would be best not to show any information when the system is up to date. You can disable setup and suppress all information on this page by setting DisableSetup=true in Web.config. When you need to upgrade, you can set this back to false. If you are logged in as Administrator setup will run and you will be able to see this page even if it is disabled in Web.config so you can easily leave it disabled and just login before upgrading. But if you are not logged in you will need to enable setup in Web.config.

 

Does this mean that mp_modules has not been updated correctly?

best regards,

Rene

1/19/2009 5:23:24 PM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

For the record, my current mp_modules looks like this:

 

                                                       Table "public.mp_modules"
             Column             |            Type             |                                Modifiers                                                                                                                           
--------------------------------+-----------------------------+-------------------------------------------------------------------------
 moduleid                       | integer                     | not null default nextval(('"mp_modules_moduleid_seq"'::text)::regclass)
 moduledefid                    | integer                     | not null
 moduletitle                    | character varying(255)      |
 authorizededitroles            | text                        |
 cachetime                      | integer                     | not null
 edituserid                     | integer                     | not null default 0
 showtitle                      | boolean                     | default true
 siteid                         | integer                     | not null default 0
 availableformypage             | boolean                     | not null default false
 createdbyuserid                | integer                     |
 createddate                    | timestamp without time zone |
 icon                           | character varying(255)      |
 allowmultipleinstancesonmypage | boolean                     | not null default true
 countofuseonmypage             | integer                     | not null default 0
Indexes:
    "mp_modules_pkey" PRIMARY KEY, btree (moduleid)
Foreign-key constraints:
    "fk_modules_moduledefinitions_fk" FOREIGN KEY (moduledefid) REFERENCES mp_moduledefinitions(moduledefid) ON DELETE CASCADE
 

Is that like it's supposed to be for 2.2.3.9?

best regards,

Rene

1/19/2009 5:26:12 PM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Hi Rene,

I know there was a time when things got funky with primary key names. The history is that originally we had just unique constraints and though they were functionally equivalent to primary keys, they had the disadvantage of not being found by getting the primary key list for a table, so there were some scripts to change it and add primary keys. The error sounds like the table already has one and the script is trying to add another one and its probably true. Any errors you get like this I would just find it in the script where its creating a new primary key and chop it out and try to keep going by visit the Setup page again.

Hope it helps,

Joe

1/19/2009 6:01:27 PM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

I managed to do that - edit the DB update script for 2.2.3.9, but now it's stuck at 2.2.4.9:

Probing system...
File system permissions ok.
pgsql database connection ok.
database permissions are sufficient to alter schema.
database initial schema already exists.
database core schema needs upgrade.
2 site(s) found.
Running script mojoportal-core - 2.2.4.9 - 00:00:00.3080820
Npgsql.NpgsqlException: cannot drop index mp_blogcategories_pkey because constraint mp_blogcategories_pkey on table mp_blogcategories requires it Severity: ERROR Code: 2BP01 Hint: You may drop constraint mp_blogcategories_pkey on table mp_blogcategories instead. at Npgsql.NpgsqlState+ c__Iterator1.MoveNext () [0x00000] at Npgsql.ForwardsOnlyDataReader.GetNextResponseObject () [0x00000] - 00:00:00.4155170
Note: This page shows some information that is helpful during setup and upgrades but for security it would be best not to show any information when the system is up to date. You can disable setup and suppress all information on this page by setting DisableSetup=true in Web.config. When you need to upgrade, you can set this back to false. If you are logged in as Administrator setup will run and you will be able to see this page even if it is disabled in Web.config so you can easily leave it disabled and just login before upgrading. But if you are not logged in you will need to enable setup in Web.config.

It's really getting quite late and I fear I have to abandon my update attempts for today (1:00 right now...). Hopefully I'll find some time to continue with this tomorrow, and I really hope I haven't gotten the database schema into an inconsistent state now.

best regards,

Rene

1/19/2009 6:06:09 PM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Same thing, just find where its trying to drop that index, chop it out and keep going.

Hope it helps,

Joe

1/20/2009 5:44:26 AM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

This was quite a painful (read: slow and requiring many manual steps) procedure, but I got the mojoportal-core scripts to run correctly until 2.2.8.2. I had to manually remove a lot of primary key constraints and modify the script for 2.2.4.9 to re-create them afterwards.

Now I am a few steps further, but still get an error:

Probing system...
File system permissions ok.
pgsql database connection ok.
database permissions are sufficient to alter schema.
database initial schema already exists.
database core schema needs upgrade.
2 site(s) found.
Running script mojoportal-core - 2.2.4.9 - 00:00:00.4009960
Running script mojoportal-core - 2.2.5.0 - 00:00:01.1466580
Running script mojoportal-core - 2.2.5.1 - 00:00:04.7723730
Running script mojoportal-core - 2.2.5.2 - 00:00:04.8713700
Running script mojoportal-core - 2.2.5.3 - 00:00:07.2356050
Running script mojoportal-core - 2.2.5.4 - 00:00:08.4920910
Running script mojoportal-core - 2.2.5.5 - 00:00:09.8359720
Running script mojoportal-core - 2.2.5.6 - 00:00:12.6329480
Running script mojoportal-core - 2.2.5.7 - 00:00:13.9040420
Running script mojoportal-core - 2.2.5.8 - 00:00:15.0594130
Running script mojoportal-core - 2.2.5.9 - 00:00:16.4074190
Running script mojoportal-core - 2.2.6.0 - 00:00:16.5189500
Running script mojoportal-core - 2.2.6.1 - 00:00:20.3936080
Running script mojoportal-core - 2.2.6.2 - 00:00:20.5261570
Running script mojoportal-core - 2.2.6.3 - 00:00:22.3825670
Running script mojoportal-core - 2.2.6.4 - 00:00:22.7107740
Running script mojoportal-core - 2.2.6.5 - 00:00:22.8580380
Running script mojoportal-core - 2.2.6.6 - 00:00:22.9767720
Running script mojoportal-core - 2.2.6.7 - 00:00:24.4593380
Running script mojoportal-core - 2.2.6.8 - 00:00:24.5936010
Running script mojoportal-core - 2.2.6.9 - 00:00:26.1721010
Running script mojoportal-core - 2.2.7.0 - 00:00:27.7825130
Running script mojoportal-core - 2.2.7.1 - 00:00:27.8876580
Running script mojoportal-core - 2.2.7.2 - 00:00:27.9988110
Running script mojoportal-core - 2.2.7.3 - 00:00:29.7991060
Running script mojoportal-core - 2.2.7.4 - 00:00:29.9293260
Running script mojoportal-core - 2.2.7.5 - 00:00:30.1820650
Running script mojoportal-core - 2.2.7.6 - 00:00:30.4810860
Running script mojoportal-core - 2.2.7.7 - 00:00:30.6187960
Running script mojoportal-core - 2.2.7.8 - 00:00:30.7450790
Running script mojoportal-core - 2.2.7.9 - 00:00:30.8888050
Running script mojoportal-core - 2.2.8.0 - 00:00:31.0071120
Running script mojoportal-core - 2.2.8.1 - 00:00:31.1368760
Running script mojoportal-core - 2.2.8.2 - 00:00:31.2381100
Configuring feature HTML-Inhalt - 00:00:32.0641690
Configuring feature Seitenstatistik - 00:00:32.3352450
Running script blog - 0.0.0.2 - 00:00:32.9648140
Running script blog - 0.0.0.3 - 00:00:33.0785960
Running script blog - 0.0.0.4 - 00:00:33.3083370
Running script blog - 0.0.0.5 - 00:00:33.4297660
Running script blog - 0.0.0.6 - 00:00:33.5704960
Configuring feature Blog - 00:00:33.7517360
Running script contactform - 0.0.0.2 - 00:00:36.5516310
Configuring feature Kontaktformular - 00:00:36.7772020
Running script eventcalendar - 0.0.0.2 - 00:00:37.2881790
Configuring feature Kalender - 00:00:37.4767400
Running script feed-manager - 0.0.0.2 - 00:00:38.2961040
Running script feed-manager - 0.0.0.3 - 00:00:38.4033130
Configuring feature Feed Manager - 00:00:38.5425010
Configuring feature Image Gallery (Simple Folder Version) - 00:00:39.5060260
Running script forums - 0.0.0.2 - 00:00:39.8258720
Configuring feature Foren - 00:00:39.9674630
Configuring feature Google Map - 00:00:40.4739340
Configuring feature Html Fragment include - 00:00:41.2375450
Running script imagegallery - 0.0.0.2 - 00:00:41.6627000
Configuring feature Bildgalerie - 00:00:41.8037580
Running script linksmodule - 0.0.0.2 - 00:00:42.3049490
Configuring feature Link-Tabelle - 00:00:42.4345950
Running script pollfeature-byChristianFredh - 0.0.0.2 - 00:00:42.7344840
Running script pollfeature-byChristianFredh - 0.0.0.3 - 00:00:43.4287700
Configuring feature Poll - 00:00:43.6808100
Running script sharedfiles - 0.0.0.2 - 00:00:44.2622060
Configuring feature Gemeinsam benutzte Dateien - 00:00:44.5330390
Running script surveyfeature - 0.0.1.2 - 00:00:44.7697840
Running script surveyfeature - 0.0.1.3 - 00:00:45.7508480
Configuring feature Survey - 00:00:45.9729970
Configuring feature Xml/Xsl - 00:00:46.4183220
Ensuring all features are installed in server admin sites... - 00:00:46.6100130

An Error Occurred:ERROR: 23502: null value in column "sortorder" violates not-null constraint
Source:Npgsql
Stack Trace at Npgsql.NpgsqlState+ c__Iterator1.MoveNext () [0x00000] at Npgsql.ForwardsOnlyDataReader.GetNextResponseObject () [0x00000]
 
Unfortunately, it doesn't say which table that is... Do you have any idea on that one?
best regards,
Rene

1/20/2009 5:59:29 AM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

Addendum: if that table is mp_moduledefinitions, then I can't find that null value:

mojoportal=# select featurename,sortorder from mp_moduledefinitions;
          featurename           | sortorder
--------------------------------+-----------
 Html Snippet Include           |       500
 Feature Modules (Admin)        |       502
 Roles (Admin)                  |       505
 Pages                          |       500
 Site Settings (Admin)          |       501
 File Manager (Admin)           |       580
 Friendly Url Manager           |       700
 Url Manager (Admin)            |       700
 HtmlContentFeatureName         |       300
 SiteStatisticsFeatureName      |       500
 BlogFeatureName                |       500
 ContactFormFeatureName         |       500
 EventCalendarFeatureName       |       500
 FeatureName                    |       500
 FolderGalleryFeatureName       |       500
 ForumsFeatureName              |       500
 GoogleMapFeatureName           |       500
 HtmlFragmentIncludeFeatureName |       500
 ImageGalleryFeatureName        |       500
 LinksFeatureName               |       500
 PollFeatureName                |       500
 SharedFilesFeatureName         |       500
 SurveyFeatureName              |       500
 XmlXslFeatureName              |       500
(24 rows)
 

The same is true for mp_moduledefinitionsettings, mp_sitesettingsexdef, and mp_htmlcontent (other tables in which I could find a "sortorder" column). Any hints?

best regards,

Rene

1/20/2009 6:02:53 AM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Hi Rene,

I think this error is not crucial, its happening in the place where its just checking if all the features are installed. The site may work if you visit the root.

I would look in the mp_ModuleDefinitions table, if any rows are null in SortOrder give them a value.

I would check to make sure there are no orphan rows in mp_modulesettings

In general Guid columns have been added to most tables as alternate primary keys. It was tricky with pgsql because there is no native guid, so we generate them in .net and pass them in as char 36. I would look for any tables where the guids did not get populated. Let me know which tables if any are found not to have the guids.

Hope it helps,

Joe

1/20/2009 6:25:38 AM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

He, you're already up :)

To answer your questions:

1. mp_moduledefinitions seems to be ok:

mojoportal=# select * from mp_moduledefinitions where sortorder < 300 or guid is null;
 moduledefid | featurename | controlsrc | sortorder | isadmin | icon | defaultcachetime |guid | resourcefile
-------------+-------------+------------+-----------+---------+------+------------------+------+--------------
(0 rows)
 

2. I'm not sure what you mean by orphan rows in mp_modulesettings. Its current definition is

mojoportal=# \d mp_modulesettings
                                               Table "public.mp_modulesettings"
          Column           |          Type          |                                Modifiers
---------------------------+------------------------+--------------------------------------------------------------------------
 id                        | integer                | not null default nextval(('"mp_modulesettings_id_seq"'::text)::regclass)
 moduleid                  | integer                | not null
 settingname               | character varying(50)  | not null
 settingvalue              | character varying(255) | not null
 controltype               | character varying(50)  |
 regexvalidationexpression | text                   |
 moduleguid                | character varying(36)  |
 settingguid               | character varying(36)  |
 controlsrc                | character varying(255) |
 helpkey                   | character varying(255) |
 sortorder                 | integer                | not null default 100
Indexes:
    "pk_modulesettings" PRIMARY KEY, btree (id)
    "ifk_modulesettings_moduleid" btree (moduleid)
    "mp_modulesettings_ix_modul-0" btree (moduleid, settingname)
Foreign-key constraints:
    "fk_modulesettings_modules" FOREIGN KEY (moduleid) REFERENCES mp_modules(moduleid)
    "fk_modulesettings_modules_fk" FOREIGN KEY (moduleid) REFERENCES mp_modules(moduleid)

and it doesn't seem to contain any non-default entries in sortorder:

mojoportal=# select * from mp_modulesettings where sortorder != 100;
 id | moduleid | settingname | settingvalue | controltype | regexvalidationexpression | moduleguid | settingguid | controlsrc | helpkey | sortorder
----+----------+-------------+--------------+-------------+---------------------------+------------+-------------+------------+---------+-----------
(0 rows)
 

3. Concerning guid columns: There are many of them, and it would take quite some time to check them all. Would it be necessary to check all columns with "guid" in the name or only those that are named exactly "guid" (I assume the former are generally foreign keys and should therefore be filled no matter what)?

 

The root page of the site does indeed start, but with two major problems right now (without checking any of the details):

4. Skinning seems broken. Although I managed to (using Tab a lot ;) ) change from the default skin to one that would not overlay the whole page with my menu und sub-menu entries (I currently selected jsavard-subblue, which is still broken in terms of the menu layout, but at least restricted to the top part), only the menu seems to change with it. That is, the other elements (general page layout, header image, colors, etc.) seem to remain fixed to the styleshout-techmania style (or something else that looks like the mojoportal 2 default). Is there any database setting that needs to be overwritten to make it work again?

5. I have the same problem as on my eariler try of converting to mojoportal 2: All static HTML content blocks are shown in "encoded" (i.e. HTML) form. I assume the reason is that in my mojoportal 1 database, all HTML content is stored in an escaped form, and thus doesn't get interpreted. What is the best way to change the encoding to the way mojoportal 2 handles it now?

best regards,

Rene

1/20/2009 6:43:17 AM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Hi Rene,

DB stuff

Delete from mp_modulesettings where moduleid NOT IN (SELECT moduleid from mp_modules);

Delete from mp_modulesettings where moduleid  IN (SELECT moduleid from mp_modules WHERE moduledefid NOT IN (SELECT moduledefid FROM mp_moduledefinitions));

Hopefully there are no orphans but that will get rid of them if there are.

Don't worry about guid columns for now they are probably/hopefully ok.

Skins

I would copy the content from /Data/skins into /Data/Sites/[SiteID]/skins for both of your sites.

If css problem continues, view the source of the page and get the full url for the css ...csshandler.ashx?... and paste it into the browser and see if you get css or an error. If an error, you may be able to workaround by setting <add key="CombineCSS" value="false"/> in Web.config.

Encoding Problem

I forgot about this but, back in the day we were encoding the content going into the db and decoding it on the way out which was a mistaken design. So now we do not encode it and we do not decode it so any content that is already in there encoded needs to be decoded in the db. There is a utility page to assist with this. If you log in as admin and navigate to /Admin/dbUtils.aspx you will see it.

Hope it helps,

Joe

 

 

1/20/2009 7:20:15 AM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

I'm still impressed by your speed on following up forum posts...

DB stuff

mojoportal=# Delete from mp_modulesettings where moduleid NOT IN (SELECT moduleid from mp_modules);
DELETE 0
mojoportal=# Delete from mp_modulesettings where moduleid  IN (SELECT moduleid from mp_modules WHERE moduledefid NOT IN (SELECT moduledefid FROM mp_moduledefinitions));
DELETE 0
So, seemingly no orphans -good.

Having been programming for too long now, failing consistency checks definitely make me worry, though ;) I assume the

Ensuring all features are installed in server admin sites... - 00:00:09.9047010

An Error Occurred:ERROR: 23502: null value in column "sortorder" violates not-null constraint
is generated by .Net code (and not DB stored procedures). Would it be clear in the code which tables might cause this error during this particular check?
Skins
I double-checked, and, as usual, /Data/skins and /Data/Sites/1/skins are equal:
rene@voyager:/srv/www/mojoportal/Data$ diff -rq skins/ Sites/1/skins/
rene@voyager:/srv/www/mojoportal/Data$ echo $?
0
On my in-production sites, I actually link most of the directories from Sites/x/y directly to ../../y. This has worked in the past, and now I did it for the test site as well. Thus, the skins should be properly installed. I will need to check the CSS and if the browser can reach it, but I don't think that this is the problem. When using the "empty" default database, skinning works. When using my converted one with content, it doesn't. (I can switch back and forth between the two dumps.)
Encoding
I used this tool to fix the encoding - thanks for the hint! With this issue fixed, the updated page is now slowly taking its shape (although I will need to adapt my layout).
 
best regards,
Rene

1/20/2009 8:06:20 AM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Hi Rene,

Try

Delete from mp_modulesettings WHERE controltype IS NULL;

The reason to test the css url in the browser is its a handler, it no longer adds just urls to static css files, it executes .NET code to combine and minify css files. Maybe it can't do it with your linked folders or maybe there is a Mono error happening. See Important Skin Changes for more info.

Hope it helps,

Joe

1/20/2009 8:15:36 AM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

Deleting these lines from mp_modulesettings did the trick, the Setup page now ran through successfully. Thanks for helping me debug it this far! Your excellent support is one of the reasons why I like mojoportal so much.

 

Concerning skinning, it seems that only part of the skin is applied: When I change the skin and then look at the page source, I see that the style files seem to be selected correctly, e.g.

link href='http://localhost/Data/Sites/1/skins/extjs-viewport1/style.css' type='text/css' rel='stylesheet' />
<link href='http://localhost/Data/Sites/1/skins/extjs-viewport1/styletext.css' type='text/css' rel='stylesheet' title='Normaltext' />
<link href='http://localhost/Data/Sites/1/skins/extjs-viewport1/styleprinter.css' type='text/css' rel='stylesheet' media='print' />
<link href='http://localhost/Data/Sites/1/skins/extjs-viewport1/stylemenu.css' type='text/css' rel='stylesheet' media='screen' />
<link href='http://localhost/Data/Sites/1/skins/extjs-viewport1/styletreeview.css' type='text/css' rel='stylesheet' media='screen' />
or


<link href='http://localhost/Data/Sites/1/skins/extjs-viewport1/styletreeview.css' type='text/css' rel='stylesheet' media='screen' />

This also shows in the way the top menu is painted. Although still horribly broken, I see that it changes depending on the selected skin. On the other hand, the whole page "master" layout does not change, as evident e.g. in the footer part:

        <a title="Visit the web site of the designer" href="http://www.styleshout.com/">Design by styleshout</a>

The weird thing is that with the same installation on fht filesystem, skins work with the empty default database, just not with the converted one. So it's (IMHO) unlikely to be a filesystem (permissions, links, whatever) reason.

best regards,

Rene

1/20/2009 8:23:39 AM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

I now tried the full ...csshandler... URL (which I got from the footer where it links to jigsaw.w3.org) directly. No error, just a (long) and seemingly valid CSS line. The URL matches the skin I selected last (http://localhost/Data/Sites/1/skins/extjs-viewport1/csshandler.ashx?skin=extjs-viewport1&amp;config=style.config).

best regards,

Rene

 

1/20/2009 8:27:21 AM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

The only reason you see urls to static css files is if you have

<add key="CombineCSS" value="false"/>

The default is true and you end up with a most css combined into one url that looks like ...csshandler.ashx?....

I don't recommend using extjs-viewport skin that one is experimental.

You may need to clear your browser cache frequently in solving css problems.

Something seems not right, style.css file no longer exists and the latest code does not write that into the page if StyleSheetCombiner is used in the layout.master (and it is if you have the correct files)

Are you sure you are using mojoPortal 2.2.8.2-c? If so then I think your skins under /Data/Sites/[SiteID]/skins is not correct versions in spite of what the diff says, it must be different than in the clean install. View the source of the clean install page and it should not output a link to style.css

Best if you can get it to work with CombineCSS = true

Hope it helps,

Joe

1/20/2009 8:31:54 AM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Dear Joe,

I'll try to debug it further and use all your hints. Right now I'll need to run to the next lecture, but I hope to continue with my conversion later in the evening.

Thanks,

Rene

1/20/2009 3:32:21 PM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

<add key="CombineCSS" value="true"/>

is set in Web.conf and I can't see anything otherwise. I have not modified Web.config besides adding my database connection details. This seems to be acknowledged by the fact that I get a single, long line CSS by the csshandler.aspx link.

At the moment, I can reproducable switch between the two cases:

- Using the empty default database setting (with just 2 pages added and the style changed to styleshout-refresh) gives me the working site with the following header:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="ctl00_Head1"><title>
	Rene Mayrhofer - Home
</title>
<link rel='stylesheet' type='text/css' href='http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/tabview/assets/skins/sam/tabview.css' />
<link href='http://localhost/Data/Sites/1/skins/styleshout-refresh/csshandler.ashx?skin=styleshout-refresh&amp;config=style.config&amp;add=' type='text/css' rel='stylesheet' />
<!--[if lt IE 7]>
<link rel="stylesheet" href="http://localhost/Data/Sites/1/skins/styleshout-refresh/IESpecific.css" type="text/css" id="IEMenuCSS" />
<![endif]-->
<!--[if gt IE 6]>
<link rel="stylesheet" href="http://localhost/Data/Sites/1/skins/styleshout-refresh/IE7Specific.css" type="text/css" id="IE7MenuCSS" />
<![endif]-->

- Using my converted database (now with the same style set) gives me the broken layout with this header:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="ctl00_Head1"><title>
	Rene Mayrhofer - Einstellungen Website
</title><link rel="stylesheet" type="text/css" href="../App_DesignTimeStyle/style.css" /><link rel="stylesheet" type="text/css" href="../App_DesignTimeStyle/blogmodule.css" /><link rel="stylesheet" type="text/css" href="../App_DesignTimeStyle/aspcalendar.css" /><link rel="stylesheet" type="text/css" href="../App_DesignTimeStyle/stylemenu.css" /><link rel="stylesheet" type="text/css" href="../App_DesignTimeStyle/styletreeview.css" />
<link href='http://localhost/Data/Sites/1/skins/styleshout-refresh/style.css' type='text/css' rel='stylesheet' />
<link href='http://localhost/Data/Sites/1/skins/styleshout-refresh/styletext.css' type='text/css' rel='stylesheet' title='Normaltext' />
<link href='http://localhost/Data/Sites/1/skins/styleshout-refresh/styleprinter.css' type='text/css' rel='stylesheet' media='print' />
<link href='http://localhost/Data/Sites/1/skins/styleshout-refresh/stylemenu.css' type='text/css' rel='stylesheet' media='screen' />
<link href='http://localhost/Data/Sites/1/skins/styleshout-refresh/styletreeview.css' type='text/css' rel='stylesheet' media='screen' />
<!--[if lt IE 7]>
<link rel="stylesheet" href="http://localhost/Data/Sites/1/skins/styleshout-refresh/IESpecific.css" type="text/css" id="IEMenuCSS" />
<![endif]-->
<!--[if gt IE 6]>
<link rel="stylesheet" href="http://localhost/Data/Sites/1/skins/styleshout-refresh/IE7Specific.css" type="text/css" id="IE7MenuCSS" />
<![endif]-->

To switch between the two cases, I only stop apache2 (with mod_mono), drop the mojoportal database, re-create it, and populate it with either of the dumps, and finally start apache2 again. Ctrl-F5 loading in Firefox triggers the switch. As nothing besides the database changes, I'm pretty sure the mojoportal installation is fine otherwise.

Which DB settings are important for the skinning? Is there anything I could check?

best regards,
Rene

1/20/2009 3:40:40 PM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Skin name is set in mp_sites, I would look for any difference between the 2 dbs but probably they are the same and the problem eludes me.

I would try do away with the sym links for folders so its for sure using /Data/Sites/[SiteID]

I'll keep pondering it but it makes no sense to me.

Best,

Joe

1/20/2009 4:01:39 PM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Skin name appears to be correct, but I just noticed that the guid in mp_sitesettingsex is all zeros. Could that have something to do with it?

Rene

1/20/2009 4:05:56 PM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Other differences in mp_sites: sitealias is set to '\N' for the working (empty) site but to 'p_default' for the broken (updated) one. And the siteguid is also all zeroes in here.

I'll try to do a more thorough comparison of these two based on their SQL dump.

best regards,
Rene

1/20/2009 4:29:31 PM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Hi Rene,

SiteAlias is a legacy field it can be safely ignored.

I'm not sure it may be possible that guid issue is the problem, it would be ideal to replace the empty guid with a real guid. It doesn't matter what the guid is, you could copy the one from the good db.

The main thing is after you add it to mp_sites, you need to look at every other table for the field siteguid and if that field is present populate it with the correct one using a query.

The siteguids for your 2 sites need to be different, if you have no other way to generate them, using a new db should generate a new one each time.

Sorry this upgrade is so painful, but its a very old version and so much has changed.

Best,

Joe

1/21/2009 12:08:12 PM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

The siteguid was indeed the issue messing up skinning. I generated two fresh guids with the "uuidgen" utility under Linux and inserted them into the tables like that:

update mp_sites set siteguid='03aa973f-358d-42aa-8164-00c136049a1f' where siteid = '1';
update mp_sites set siteguid='816f7a30-72c1-4eaf-88d1-6d5243974706' where siteid = '2';

I found that for the features/modules I use, tables mp_sites mp_friendlyurls mp_modules mp_pages mp_roles mp_sitehosts mp_sitemoduledefinitions mp_sitesettingsex mp_users needed an update.

The fact that this was possible indicates that there is quite some redudancy in the current database schema (the guids correlate with primary keys) and that it in fact doesn't conform to third normal form. Is there any specific reason for having e.g. the guids in there at all? The risk of inconsistency is a real one (as demonstrated by this failed automatic update).

 

The missing thing is the member list, which still returns an error:

System.FormatException: Invalid format for Guid.Guid(string).
  at System.Guid+GuidParser.ThrowFormatException () [0x00000]
  at System.Guid+GuidParser.ParseChar (Char c) [0x00000]
  at System.Guid+GuidParser.ParseGuid2 () [0x00000]
  at System.Guid+GuidParser.Parse () [0x00000]
  at System.Guid..ctor (System.String g) [0x00000]
  at mojoPortal.Business.SiteUser.PopulateFromReaderRow (mojoPortal.Business.SiteUser user, IDataReader reader) [0x00000]
  at mojoPortal.Business.SiteUser.GetPage (Int32 siteId, Int32 pageNumber, Int32 pageSize, System.String userNameBeginsWith, System.Int32& totalPages) [0x00000]
  at mojoPortal.Web.UI.Pages.MemberList.PopulateControls () [0x00000]
  at mojoPortal.Web.UI.Pages.MemberList.Page_Load (System.Object sender, System.EventArgs e) [0x00000]
  at System.Web.UI.Control.OnLoad (System.EventArgs e) [0x00000]
  at mojoPortal.Web.mojoBasePage.OnLoad (System.EventArgs e) [0x00000]
  at System.Web.UI.Control.LoadRecursive () [0x00000]
  at System.Web.UI.Page.ProcessLoad () [0x00000]
  at System.Web.UI.Page.ProcessPostData () [0x00000]
  at System.Web.UI.Page.InternalProcessRequest () [0x00000]
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000]

 

Next, I will try to adapt my skin to the new version and hope to get the update online by the end of this week.

Summarising, the following hints my help others trying to update from mojoporal 1.<old> to 2.x:

- Don't use postgresql 8.3 until the mojoportal data layer can deal with it (8.1 works).
- Watch out for schema changes during upgrade (somewhere along the update scripts, this seems broken).
- Watch out for empty uids in the database after the upgrade.
- Many skins are badly broken when you have sub-menus that are marked to be shown (two that work are e.g. mitchinson-earthy or jsavard-blue).
 

Thanks for your help so far!

Rene

1/21/2009 12:20:44 PM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

Hi Rene,

The reasons for the failure to upgrade smoothly are due the evolution of the project and the imperfections of the upgrade scripts due to historical errors

Yes, there are reasons for this as there are often good reasons for deviating from third normal form, especially in web applications.

The first reason is that it helps make it possible to integrate data from more than one installation and have the ability to restore the relationships even though the integer keys will have to be different. This supports the scenario of 2 companies merging with 2 different sites.

The second and more useful reason is that it makes it possible to do things you can't do with normal table relationships.

For example, I recently implemented a content rating system. Because of using guids I can use the same content rating system to rate articles, products, sites, pages, users, or any other feature where the content has guid identifiers.

Each thing can pass in its own guid and select its ratings, but there is no formal foriegn key relation to the ratings table from any of the tables that store their related ratings there. So many different tables can join to the rating table and get their own ratings.

The same solution will allow me to build a content versioning system, tagging, comments and re-use them across features.

Hope that makes sense to you.

Best,

Joe

1/21/2009 12:35:31 PM
Gravatar
Total Posts 29

Re: Importing mojoportal 1.x site data into 2.x install

Hi Joe,

Interesting, I didn't think of merging web sites later on - guids would certainly do the trick, as they would for general annotation. However, have you considered using these guids as primary keys and thus getting rid of the integers (and only having a single key again)?

best regards,
Rene

1/21/2009 12:53:16 PM
Gravatar
Total Posts 18439

Re: Importing mojoportal 1.x site data into 2.x install

I've considered it but not sure that's the best for performance, I think joins are faster on integer columns and it would be a lot of work with additional potential to break things and no value added for actual use.

I don't rule it out for someday, but I'm working full time on my own funding so its not something I plan to put my energy into any time soon. The redundancy doesn't keep me up at night, especially because its possible I would do all that work and then regret it later. :-)

Best,

Joe

 

1/12/2010 1:49:18 PM
Gravatar
Total Posts 1

Re: Importing mojoportal 1.x site data into 2.x install

Thanks for this post, it helped me out today.

You must sign in to post in the forums. This thread is closed to new posts.