Revision [17053]

This is an old revision of UpdateCategoryActionInfo made by MasinAlDujaili on 2007-06-06 12:52:14.

 

Category Update Action Documentation

Not included in Wikka

See also
Development: UpdateCategoryAction.
This is the documentation page for the category update action.
 


Documentation


Short description

This action is for converting categorizations to the scheme used in PageAndCategoryDivisioninACategory

Parameters

This action takes no parameters

Long description

Wikka has a very flexible category system -- with one major drawback: You cannot link to a category without putting the linking page into this category. Besides some other issues, PageAndCategoryDivisioninACategory solves this problem by an explicit categorization of pages using the linking pattern [[(cat)NameOfCategoryPage]]. Just typing NameOfCategoryPage just links to this page.

The problem now is that any Wikka already in use for some time might have a more or less complete categorization of all pages -- so how do we get this new category system? Search and replace is the answer.

The great thing about it is: I need SQL queries and regular expressions -- two topics of programming I never had any chance to develop some skills, so this might be buggy after all.

Step 1: Acquire list of categories
First, we need a list of all categories. This is because we need to know which links to convert. Currently, we know every link to a category is a categorization. Done

Step 2: Process each page
Second, we need to acquire a list of all pages. Every page will be loaded single (LoadSingle) and processed by its own to keep memory usage low. Done

Step 3: Ensuring not to convert new syntax to newnew syntax
After extending Wikka with PageAndCategoryDivisioninACategory, there might already be some new categorizations. These have to be preserved. I think, the code for this step might be dropped as soon as the action works fully and is linked by PageAndCategoryDivisioninACategory so that anyone extending an existing Wikka with it immediately uses this action. This might be better as part of step 4. Or I need a regex which does exclude any links like [[(cat)...

Step 4: Conversion from original syntax to new syntax
I guess, preg_replace_callback will be my friend.

Step 5: Storing page
I hope, there's a function to simply store any page.

Usage
{{updatecategory}}


Because of some unknown limitations, the action might time out. On my installation it did about 40 to 60 pages per run, so I had to run it about ten times to get all my pages converted -- I am thankful that not all pages were categorized, because any one run of this action took about 5 minutes.

Author

MasinAlDujaili
 

CategoryUsercontributions
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki