Upgrading from ByteFX to the .NET Connector for MySQL

Last night I made the switch from the older ByteFX Data provider for MySQL to the newer  .NET Connector for MySQL.  It required some code changes in the MySQL data layer. 

For Example, anywhere I was using parameters like @SiteID, they had to be changed to ?SiteID except in places where the parameter is not being passed in but used in SQL with a SET statement .

In this line:
SET @PageLowerBound = (?PageSize * ?PageNumber) - ?PageSize

?PageSize and ?PageNumber are passed in but @PageLowerBound is not and it wouldn't work if I used ? instead of @

Another difference is in ByteFx you have only one data type for int MySqlDbType.Int whereas in the newer .NET Connector you have MySqlDbType.Int16, MySqlDbType.Int24, MySqlDbType.Int32, and MySqlDbType.Int64 and it won't work with just MySqlDbType.Int so you have to change the code.

I wasn't having any problems with the ByteFX provider myself but a few people have posted in the forums and been unable to connect using ByteFX with their specific version of MySQL. One person tried switching to the .NET Connector and then was able to connect but of course without the code changes described above it did not work for him either.  Hopefully this change will eliminate any problems some users were having with the MySQL version of mojoPortal.  It will be included in tomorrow's release.

Another user reported problems with losing special characters when data was saved to the database.  He was working with Portuguese content and it worked correctly in Text fields populated using the FCKeditor but did not work correctly with VarChar fields populated using normal text boxes.  I don't know if this change will fix that problem but I hope so.

Other gotchas I have observed with ByteFX and .NET Connector when building on Windows and deploying on mono you get the dreaded "File Not Found error" which would more accurately be described as "Couldn't load assembly".  This is caused because these data providers are shipped with a pre-comiled version of sharpziplib that was built using incremental build.  This problem is easily overcome by obtaining the source code for sharpziplib and compiling it myself with full Re-Build.  By doing this I have no problems compiling on Windows with VS.NET and deploying on mono.
 

A New Release this Sunday

I'm planning a new release this sunday. 

New things to look forward to include support for PostgreSQL thanks to Joseph Hill of GotMono.com.  Also with much thanks to Joseph Hill, a new RSS Feed Aggregation module to allow you to show one or many feeds on a page.  Joseph sent me the code he is currently using on GotMono.com for the bloggers page and I turned it into a module that can be plugged into any page in a mojoPortal site.  You can configure the cache time, the maximum age of posts to show and a maximum number of posts to show per feed and a few other settings.

Also a few bug fixes and improvements.

Release 20050320 alpha

Well I didn't think I would make a new release one day after my last release but I was able to complete 2 important features yesterday and also found out about a bug in the data layer for MS SQL.

The new release includes the ability to move content modules between pages and also to create "pages" in the menu hierarchy that are just links to other pages which can be either on site or off site.  You can also configure whether to open the page in a new window.  There is a new page setting to Show Child Pages Menu, but this feature is not implemented yet and checking the box will have no effect.

If you installed yesterday's release you will need to add 4 new columns to the mp_Pages table, see the create tables script for details. If you are using MS SQL you should also update the stored procedures.
If you are trying to upgrade from any previous version, be sure and backup both your site and current db before you start making changes in case things get messed up and you want to go back.  Upgrading while the project is in the alpha stage is a manual process, I will try to add some guidlines under the Documentation menu soon.  Eventually I will have an automated upgrade process.

The bug that was fixed in the MS SQL data layer would only have revealed itself if you configured an Html Module for multiple items like articles or announcements.

I also added some documentation to the site today under Documentation > Creating Skins and Documentation > Securing mojoPortal

I will be upgrading this site and my demo sites to the new version sometime in the next few days.  If you are viewing the site while I'm doing the upgrade you may get a page not found error or some other server error but rest assured it will only be for a few minutes when it happens.

Update 3/21/2005
I just finished upgrading this site as well as the demo sites and my personal site to the new version

Release 20050319 alpha is now available

See the download page for details.  mojoPortal now supports multiple sites using one installation and db. 
Each site must have a different host name entered in the mp_SiteHosts table, if no matching host name is found the first site in the mp_Sites table is returned.  The sites sharing a single installation each have separate users and content but they do share the same culture.  To support a different culture, you still need a separate installation and db.

As always, if you have any trouble with mojoPortal, please post in the forums and I will try to help as soon as possible.

Next steps in the development plan

Support for PostgreSQL is coming soon thanks to Joseph Hill of GotMono.com!

Page/Menu hierarchy improvements.
Currently, you can't create more than one menu item that points to the same page and you can't create menu items that point outside the page hierarchy either on site or off site.  I am going to change this so you can create "pages" that just point to a link which can be an exisiting page in the site or an external link.  You will also be able to configure whether it opens in the same window or a new one.  Also I will implement a feature so that a page can be configured to automatically display  links to its child pages.  For example, consider the Documentation menu item on this site, it is really just a container menu for other pages with specific documentation.  With the current implementation I had to add an Html Module to that page and manually add links to its child pages.  The next version will have a checkbox in the page configuration to do this automatically.

Moving content modules to different pages is a much needed feature that should be pretty easy to implement.  It can be done now manually by changing the PageID of the module in the database but I will make this very easy to do.

Module Consolidation
Not long ago I added features to the Html Module to allow configuring it for multiple items to support articles and announcements.  Now I see that there is almost a feature overlap with the blog module.  If the Html module had RSS, Comments and Archive capabilities the blog module would not be needed because the Html module could be configured as a blog.  I am planning to create a new Content Module that will combine all these features and will also add a content rating system and the ability to attach a threaded discussion to any content.  At that point I will move the current Blog and Html Modules out of the core and into separate assemblies.  This will provide backward compatibility for users with exisiting installations that are already using the Blog and Html modules and will also provide a reference architecture for others who may want to build external modules that plug in to mojoPortal.

Search
I had been thinking I would use Lucene.NET as the search engine for the site but now I'm leaning back toward using traditional db search capabilities.  My reasoning on this is that pages in mojoPortal can be configured as only visible to users in certain roles. I think the search needs to take into account whether the user is logged in and what roles the user is a member of in order to only display content that the user has rights to view.  I can easily pass the user id as a parameter for searching in the db and limit results to content on pages the user can see.  I haven't figured out a way to do something similar with Lucene but I am open to suggestions if those of you more familiar with Lucene.NET see something I am missing.

Multiple Sites is working!

The new feature to run multiple sites on one web instance and database is working now and will be in the next release. You can check it out now using one of my 3 demo sites :

demo.mojoportal.com
demo2.mojoportal.com
demo3.mojoportal.com

All 3 sites are being served from the same folder and using the same db, though they all have completely separate users and content.  I've configured them each with different skins to make it easy to tell them apart.

demo.mojoportal.com is the root and admin site where you can see how the host names for the other sites are configured by clicking the Admin menu after you log in. You can even change the skins on the other sites from demo.mojoportal.com.  I do have separate Virtual Hosts for each site configured in apache, but they all point to the same folder.  Having multiple Virtual Hosts in apache is not neccessary for it to work if you have the site configured to respond to all requests on the ip address, but I need them to host multiple sites on the same ip address including but not limited to these 3 demo sites.

Feel free to login as admin on these sites and play around, they all use admin@admin.com with the password admin