Extension talk:CategoryTests

From MediaWiki.org

Jump to: navigation, search

Contents

[edit] invalidtitle: bad title

Hi Ryan.
It seem to this extension don't allow using Chinese like following:

{{#ifcategory:首頁|then|else|首頁}}

It will show the following message

invalidtitle: bad title

--Roc michael 06:13, 6 May 2008 (UTC)

That would then be a bug with MediaWiki's API and not this extension, you may want to create a bug on bugzilla (product: MediaWiki, component: API, issue: non-English characters are not being checked correctly as titles in queries or something along that matter). --Skizzerz talk - contribs 23:51, 6 May 2008 (UTC)
I also encountered this message, when viewing an article that contained an apostrophe. In function ifcategory(), using $getText() instead of getPartialURL() seemed to help. -Jlerner 14:05, 15 May 2008 (UTC)

[edit] Bug in $data array variable?

I made the following code changes in order to get ifcategory() to cooperate. Jlerner 04:33, 15 May 2008 (UTC)

$ diff CategoryTests.php CategoryTests.php.orig 
53d52
<                    $page_id = $title->getArticleID();
59d57
<                    $page_id = $title->getArticleID();
65c63
<            if(!array_key_exists('categories', $data['query']['pages'][$page_id])) {
---
>            if(!array_key_exists('categories', $data['query']['pages']['1'])) {
68,69c66,67
<            foreach( $data['query']['pages'][$page_id]['categories'] as $key => $value ) {
<                    if("Category:{$category}" == $data['query']['pages'][$page_id]['categories'][$key]['title']) {
---
>            foreach( $data['query']['pages']['1']['categories'] as $key => $value ) {
>                    if("Category:{$category}" == $data['query']['pages']['1']['categories'][$key]['title']) {

[edit] How to use the update code

Is there somebody giving me the detail of how to use the update code or make the using more easier. Thanks! :-)--Roc michael 11:14, 20 May 2008 (UTC)

You want me to send you a copy of the code that is working for me? -Jlerner 13:26, 20 May 2008 (UTC)
Thank you, My email is roc.no1 at gmail.com--Roc michael 23:37, 20 May 2008 (UTC)

[edit] Working on it

I'm currently working on a method that will work for each version of mediawiki (since it appears the API is slightly different for each one), and this will take some time. While the patch above may work (I honestly haven't had enough time to test it out or anything), it will also make the extension incompatible with 1.11, so just give me some time to figure out how to modify the code to work with each version. --Skizzerz 20:35, 21 May 2008 (UTC)

The patches above are running OK on a MediaWiki 1.11 site... -Jlerner 20:41, 21 May 2008 (UTC)
Thank you, Jlerner. It works fine.
  • MediaWiki: 1.11.0
  • Win XP
  • The AppServ Open Project - 2.5.7 for Windows
    • Apache Web Server Version 2.2.3
    • PHP Script Language Version 5.1.6
    • MySQL Database Version 5.0.24a
--Roc michael 21:17, 21 May 2008 (UTC)

[edit] Extension maintenance

Hi Skizzerz

Since you are too busy to maintain this extension, would you like to find a new parent for it?--Roc michael 22:13, 11 June 2008 (UTC)

Personal tools