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.
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.