Extension talk:CategoryTests/Archive

From mediawiki.org
Latest comment: 6 years ago by Valerio Bozzolan in topic Has Lua?

invalidtitle: bad title[edit]

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)Reply

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)Reply
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)Reply

Bug in $data array variable?[edit]

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

$ 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']) {

How to use the update code[edit]

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)Reply

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

Working on it[edit]

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)Reply

The patches above are running OK on a MediaWiki 1.11 site... -Jlerner 20:41, 21 May 2008 (UTC)Reply
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)Reply

Extension maintenance[edit]

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)Reply

New version[edit]

For all of you who have this page on your watchlist, just letting you know that a new version 1.2 is available. The extension is now located in the Wikimedia Subversion repository, so you will need to grab it from there. Many thanks to Jlerner for the patches, and please let me know if there are any other bugs. I've gotten my main project out of the way (GroupPermissionsManager), so I can now focus on updating and fixing other extensions. --Skizzerz 17:08, 16 July 2008 (UTC)Reply

Fatal Error if page does not exist[edit]

For {{#ifcategory:category|then|else|page}}, if 'page' does not exist (say you misspelt the name), then PHP throws the following fatal error:

Fatal error: Call to a member function exists() on a non-object in ./extensions/CategoryTests/CategoryTests.php on line 61

--Agrestis 12:57, 25 October 2009 (UTC)Reply

Fixed in version 1.4, grab it from the "Download snapshot" link on the extension page's infobox. Select the "Development version (trunk)" version as the one to download. --Skizzerz 20:15, 25 October 2009 (UTC)Reply

Has Lua?[edit]

Does this extension provide also a Lua entry point? --Valerio Bozzolan (talk) 08:51, 4 July 2017 (UTC)Reply