Record in mp_friendlyurls table

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
2/10/2009 8:37:39 AM
Gravatar
Total Posts 30

Record in mp_friendlyurls table

Hi everybody,
I have a problem since twice weeks. Every time I insert a new content in a page I see the content correctly.
If I visit that page later (when I say later I mean a random time: after two hours or the next day or after two days) I see the message:
----------------------------------------------------------
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /pagename.aspx

Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
----------------------------------------------------------
I notice that there isn't the record related to that page in the table mp_friendlyurls (but only in mp_pages table), so I have to execute insert query to add that page to the db.

What does it happen?

Thanks
 

 

2/10/2009 1:17:00 PM
Gravatar
Total Posts 18439

Re: Record in mp_friendlyurls table

Hi,

When pages are deleted or renamed is the only time friendly urls are deleted. I can't think of any reason why they would get deleted randomly and no-one else has reported this. I might make sure your pages all have guids in the mp_Pages table and the page guids should also be on the rows in mp_FriendlyUrls.

What OS, what db platform, what version of mojoPortal?

Do you have any custom code of your own that could do this?

If using MS SQL you could do some logging to see what is deleting fromthe table.

Hope it helps,

Joe

2/10/2009 2:58:59 PM
Gravatar
Total Posts 30

Re: Record in mp_friendlyurls table

Hi Joe,
the version I'm using is 2.2.7.8, db Postgres, OS is windows server 2003 and I have no script that could do this (in fact I descovered that table only searching for a solution, I have never used it before!!!)

2/11/2009 4:57:26 AM
Gravatar
Total Posts 18439

Re: Record in mp_friendlyurls table

Can you verify that the mp_pages table has unique pageguid on each row and that they correspond to pageguid in the mp_friendlyurls table?

Are you sure that a user is not renaming pages or changing friendly urls?

2/11/2009 5:54:26 AM
Gravatar
Total Posts 30

Re: Record in mp_friendlyurls table

Hi Joe,
Yesterday I activated a pgLog so now I can see all the queries executed.
In the morning I tested to create a new page, add an html content, then change the module name and at the end change the name of the page. These are the actions my colleagues did yesterday when the error appeared.
At the moment everything seems ok in the site and in the db log file too.

So now I verify if the mp_pages table has unique pageguid on each row and that they correspond to pageguid in the mp_friendlyurls table..

wait for a news!!!
 

2/11/2009 5:59:50 AM
Gravatar
Total Posts 30

Re: Record in mp_friendlyurls table

Ok Joe,
I executed this query:

select * from mp_pages where pageguid not in (select pageguid from mp_friendlyurls)

and the result is a recordset of 15 rows!!!

2/11/2009 7:02:32 AM
Gravatar
Total Posts 18439

Re: Record in mp_friendlyurls table

Was this a very old installation that has been upgraded but originally installed quite a long time ago?

There was a point at which we added the guids to those tables and since pgsql has no native guid type I had write something to generate the guids in .NET and update the columns in the db as part of the upgrade. Its possible they didn't all get updated, new pages should always have the guid because we pass it in from .NET code when creating new pages.

At any rate, the only theory I have of how friendly urls could get deleted is if more than one page has the empty guid 00000000-0000-0000-0000-000000000000 as its guid, then if one of those pages is deleted it may delete the friendly url for other pages if they all have the same guid or empty guid, because when a page is deleted it will delete friendly urls with its own page guid.

If you can generate unique guids for any rows in mp_pages that have empty guid and then re-create the friendly urls with the correct guids it should be fine going forward.

Guids can be generated in MS SQL by SELECT newid() and can be generated in .NET code by Guid.NewGuid().ToString();

Anyway, thats my best theory, hope it helps.

Joe

2/11/2009 10:25:55 AM
Gravatar
Total Posts 30

Re: Record in mp_friendlyurls table

It isn't an old installation, I installed it in November and there are no records in the table mp_pages with guid 00000000-0000-0000-0000-000000000000.
In any case at the moment there is no problem for the new page I created in the morning..I'm curious to know the actions my colleagues did yesterday to generate the error for 6 pages!!! The 6 pages are new pages created just yesterday, initially running well and then (after what action???) not running!!
I can't reproduce it!!

If I give you the log, the date and the name of the pages not running, can you tell me the exact steps they did?

2/11/2009 11:07:51 AM
Gravatar
Total Posts 18439

Re: Record in mp_friendlyurls table

The mojoportal log isn't going to show anything unless there's an error happening related to it. If you have a way to log sql statements executed against the mp_friendlyurls table and can capture it when it happens then the logged sql statements may give a clue. Its like you'd have to log for a week and see if it happens and if it does then perhaps the log will have clues. MS SQL has ways of doing this with the profiler but I'm not sure how to do it with pgsql.

Best,

Joe

2/11/2009 11:15:04 AM
Gravatar
Total Posts 30

Re: Record in mp_friendlyurls table

Sure!! Now the log is active (My db is Postgres). So I have to log for some days and verify if the error occurs again.

Thanks a lot

4/2/2009 2:42:33 AM
Gravatar
Total Posts 30

Re: Record in mp_friendlyurls table

Dear Joe,
Since yesterday I have this problem again!! There are in my portal 4 or 5 pages generating the error described in my first post, I visited those pages two days ago without problems.
Like the last time, if I see the records in mp_friendlyurls table, there aren't the records corresponding to the pages giving the error (but they are correctly written in mp_pages table).

Please can you tell me what are the pages or the functions in which there is a "delete form mp_frindlyurls" query?
I want to detect them.

I want also to know the exact meaning of the fields of mp_friendlyurls table, because now I have to execute an insert query to solve my problem and I'm not sure about some fields:

siteid = in my case is always 1
friendlyurl = mynamepage.aspx
realurl = ~/Default.aspx?pageid=id from mp_pages table
ispattern = in my case is always FALSE --> what is the meaning?
siteguid = it is always the same (taken from the other correct records)
itemguid = what have I put in?
pageguid = what have I put in?

I hope in your help!!

Thanks very much

4/2/2009 6:36:36 AM
Gravatar
Total Posts 18439

Re: Record in mp_friendlyurls table

Hi,

friendly urls are deleted when pages are deleted or blog posts are deleted or a site is deleted

ispattern is not used

itemguid is autogenerated

pageguid is either the pageguid from mp_Pages or the  BlogGuid or a guid from any other feature that uses friendly urls (like Event Calendar Pro)

Hope it helps,

Joe

4/2/2009 7:20:44 AM
Gravatar
Total Posts 30

Re: Record in mp_friendlyurls table

1. Can you tell me the name of the pages in which there is a "delete from mp_friendlyurls" code?

2. The autogenerated itemguid is then used in another place?

Thanks

4/2/2009 7:55:47 AM
Gravatar
Total Posts 18439

Re: Record in mp_friendlyurls table

Just open the soultion and search for FriendlyUrl.Delete and you will find them.

The itemGuid is a surrogate primary key much like pageGuid vs pageId. Its main purpose is to facillitate the possibility to import data in the future from one site/installation to another.

Hope it helps,

Joe

4/3/2009 5:00:21 AM
Gravatar
Total Posts 30

Re: Record in mp_friendlyurls table

Dear Joe,
After a lot of tests, I think I have found a bug in the sql function: mp_friendlyurls_deletebypageid(character varying)

In this function in fact there is a delete query using a like:
delete from mp_friendlyurls where realurl like _pageid

and in my db log I notice that the like is a '%word%' like, so when I delete for example a page having id=10 the query is
delete from mp_friendlyurls where realurl like '%pageid=10%'

But this query deletes also all the records having pageid=100, 101, 102, etc.

I think the solution is to delete the second % so the query becomes
delete from mp_friendlyurls where realurl like '%pageid=10'

What do you think? Is this a bug?

 

4/3/2009 7:08:42 AM
Gravatar
Total Posts 18439

Re: Record in mp_friendlyurls table

Hi,

I agree with your diagnosis.  You are using pgsql right? I believe this bug was fixed long ago in MS SQL and other dbs but somehow I missed it in the pgsql version. I have fixed it in my copy and will have the fix in svn trunk by later today. Unfortunately the extra % is not in the stored proc but in the code that assigns to the parameter value so its not possible to fix it by just editing the stored procedure.

Its really a funky way to delete, I think I should change it now to delete by pageguid instead, but originally the table did not ahve the pageguid column so in really old versions of mojoPortal that have been upgraded over time, some rows in the table may not have the pageguid populated, so I continued to use this old method.

Best,

Joe

4/3/2009 9:10:27 AM
Gravatar
Total Posts 30

Re: Record in mp_friendlyurls table

I solved the problem directly in the stored procedure declaring a new variable --pageidnew-- and giving it this value:

_pageidnew=replace(_pageid, '%', '');
_pageidnew='%' || _pageidnew;

Bye!!!

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