Last modified: 2013-07-03 02:44:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T26911, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 24911 - $wgSelectCategoryRoot ignored on Special:Upload
$wgSelectCategoryRoot ignored on Special:Upload
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SelectCategory (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Leon Weber
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-23 08:03 UTC by Christian Boltz
Modified: 2013-07-03 02:44 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
patch: honor $wgSelectCategoryRoot on Special:Upload (1.30 KB, patch)
2010-08-23 08:21 UTC, Christian Boltz
Details
patch (for current SVN version) to honor $wgSelectCategoryRoot on Special:Upload (854 bytes, patch)
2012-07-12 22:35 UTC, Christian Boltz
Details

Description Christian Boltz 2010-08-23 08:03:03 UTC
I'm using SelectCategory with:

$wgSelectCategoryRoot = array(
    NS_MEDIA                => false, # NS_MEDIA = -2
    NS_MAIN                 => "Gartenbau",
    NS_TALK                 => false,
    NS_USER                 => false,
    NS_USER_TALK            => false,
    NS_PROJECT              => "Hortipendium",
    NS_PROJECT_TALK         => false,
    NS_IMAGE                => "Bilder",
    NS_IMAGE_TALK           => false,
    NS_MEDIAWIKI            => false,
    NS_MEDIAWIKI_TALK       => false,
    NS_TEMPLATE             => false,
    NS_TEMPLATE_TALK        => false,
    NS_HELP                 => "Hortipendium",
    NS_HELP_TALK            => false,
    NS_CATEGORY             => false, # alle
    NS_CATEGORY_TALK        => false,
    NS_PORTAL               => "Portal",
    NS_PORTAL_TALK          => false,
);

This works on editing pages and images, but does not work when uploading images on Special:Upload or, in my case, the german version of it (Spezial:Hochladen). On the upload page, SelectCategory offers _all_ categories.

I'm using SelectCategory from SVN, 1.16 branch, r71217.

According to one of my users it worked before I updated Mediawiki from 1.15 to 1.16 (with SelectCategory from 1.15 branch, r66002). However, I don't see a relevant code change in SelectCategory - maybe the behaviour of Mediawiki changed?
Comment 1 Christian Boltz 2010-08-23 08:20:41 UTC
I just added some debugging code in fnSelectCategoryGetAllCategories after $wgTitle->getNamespace to print out the result.

Results (Mediawiki 1.16):
- Special:Upload:     $m_namespace = -1
- Edit a File:* page: $m_namespace = 6

That explains it ;-) and makes the fix quite easy - if we are on the upload page, hardcode $m_namespace to NS_IMAGE. I'll attach a patch in a minute.
Comment 2 Christian Boltz 2010-08-23 08:21:57 UTC
Created attachment 7646 [details]
patch: honor $wgSelectCategoryRoot on Special:Upload
Comment 3 Christian Boltz 2010-11-08 01:10:56 UTC
This is indeed caused by a change in MediaWiki. You'll need to edit a MediaWiki core file if you need CategorySelect on upload - see bug 25833 for details.

When done, you have to do a small additional change in SelectCategoryFunctions.php that is not covered by the patch from comment #2:

--- SelectCategoryFunctions.php (Revision 71464)
+++ SelectCategoryFunctions.php (Arbeitskopie)
@@ -125,6 +125,7 @@
     # If it is an upload we have to call a different method:
     if ( $m_isUpload ) {
       $m_pageObj->mUploadDescription .= $m_text;
+      $m_pageObj->mComment .= $m_text;
       $m_pageObj->textbox1 .= $m_text;
     }

Maybe you can remove the line with mUploadDescription. However I didn't test that and want to be on the save side (and backward compatible) for now. Additionally, I requested to revert the name change back to mUploadComment in bug 25833 ;-)
Comment 4 p858snake 2011-04-30 00:08:55 UTC
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Comment 5 Sumana Harihareswara 2011-12-23 18:13:36 UTC
Adding "need-review" keyword to indicate patch awaits review.  I'm sorry for the wait, Christian.
Comment 6 Christian Boltz 2012-01-19 13:48:35 UTC
Mark, can you please check this patch and commit it to SVN?
Comment 7 Mark A. Hershberger 2012-01-19 15:22:47 UTC
Please check the new version of SelectCategory.  As of last June, there is no SelectCategoryFunctions.php and it looks like changes similar to the one you suggest has been made.
Comment 8 Christian Boltz 2012-07-12 22:34:37 UTC
Unfortunately the new version (current SVN) still has this bug :-(

The problem is this line:

$allCats = self::getAllCategories( $isUpload ? NS_SPECIAL : $pageObj->mTitle->getNamespace() );

For Special:Upload ($isUpload), NS_IMAGE instead of NS_SPECIAL namespace should be used.

Reason:
With NS_IMAGE, SelectCategory will use the root category for the File: namespace
With NS_SPECIAL, it will display _all_ categories - which doesn't make sense for file uploads

I'll attach an updated one-line patch for current SVN that fixes the issue.
Comment 9 Christian Boltz 2012-07-12 22:35:37 UTC
Created attachment 10845 [details]
patch (for current SVN version) to honor $wgSelectCategoryRoot on Special:Upload
Comment 10 Sumana Harihareswara 2012-09-20 20:06:44 UTC
Daniel, looks like you were the last one to work with this extension; could you look at this patch? Thanks.
Comment 11 Daniel Kinzler 2012-09-21 10:23:15 UTC
I know nothing about SelectCategory. I looked at it briefly together with Daniel Werner during the last triage. I think we concluded that the extension is unmaintained and probably not worth the hassle.
Comment 12 Sumana Harihareswara 2012-09-21 13:08:57 UTC
Am cc'ing Manuel Schneider who is listed as one of the authors at https://www.mediawiki.org/wiki/Extension:SelectCategory .  Manuel, are you maintaining this extension?  If not, perhaps we should encourage Christian to start maintaining it?

I also suggest we move the extension into Git/Gerrit.  Christian, you can use https://www.mediawiki.org/wiki/Git/Conversion/Extensions_queue to request that.
Comment 13 Manuel Schneider 2012-09-21 19:08:57 UTC
I am still around and I use this extension on many wikis, as do some of my customers.
As this is just my hobby I haven't put much time in it after the initial development.

If Christian is willing to maintain or if anyone wants to merge her or his patches I would be very happy. That stuff is open source and I made it because someone needed such a feature and I shared it with everyone so everyone can use and improve it.
Comment 14 Sumana Harihareswara 2012-09-21 21:31:25 UTC
Christian, sounds like you should request Subversion access to extensions via https://www.mediawiki.org/wiki/Developer_access/Subversion#Requesting_commit_access and start merging your own patches in.  I also recommend that you move the extension into Git since the Wikimedia Subversion server is on its way out: https://www.mediawiki.org/wiki/Git/Conversion
Comment 15 Christian Boltz 2012-09-22 16:57:52 UTC
I was afraid of that offer ;-)

My situation is similar to Manuel's - I'm using the extension on a customer wiki, and my patches are bugfixes requested by that customer. Besides that, SelectCategory just works[tm], and I'm not planning to do big changes on it.

I'm not sure if getting a handful of patches in is worth the hassle of creating an account, and as I said, I can't and won't promise to do anything besides commiting my own patches.

If you still think I should request an account, I'll do it. Otherwise just commit my patches ;-)
Comment 16 Christian Boltz 2013-03-02 20:18:29 UTC
I finally have commit access since some days, and just commited the fix to git.
Comment 17 Sumana Harihareswara 2013-07-03 02:39:34 UTC
Great! Can you link to the patchset in a BZ comment, just so we have the record?  Thank you!
Comment 18 Matthew Flaschen 2013-07-03 02:44:18 UTC
The fix is c0190e0dd65be5859d2e8b71e9d236826ef26b6d .

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links