Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Wikitech

SQL

 

 

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded


heldergeovane at gmail

Sep 5, 2009, 7:13 AM

Post #1 of 3 (200 views)
Permalink
SQL

Hello!

I was looking at this code
http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/intersection/DynamicPageList.php?view=markup

and trying to figure out how to change this piece of code
----
if ('lastedit' == $sOrderMethod)
$sSqlWhere .= ' ORDER BY page_touched ';
else
$sSqlWhere .= ' ORDER BY c1.cl_timestamp ';

$sSqlWhere .= $sSqlOrder;
----
in such way that the extension could order the list alphabetically.

I imagine it would be a simple change, like this:
----
switch ($sOrderMethod)
{
case 'lastedit':
$sSqlWhere .= ' ORDER BY page_touched ';
break;
case 'alphabetical':
$sSqlWhere .= ' ORDER BY WHAT? ';
break;
case 'categoryadd':
default:
$sSqlWhere .= ' ORDER BY c1.cl_timestamp ';
break;
}
----

But I don't know what to use in the SQL instead of the "WHAT?".
Does anybody knows what should it be?

Thanks in advance!

Helder
_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


roan.kattouw at gmail

Sep 5, 2009, 7:42 AM

Post #2 of 3 (183 views)
Permalink
Re: SQL [In reply to]

2009/9/5 Helder Geovane Gomes de Lima <heldergeovane[at]gmail.com>:
> But I don't know what to use in the SQL instead of the "WHAT?".
> Does anybody knows what should it be?
>
You should probably use "ORDER BY page_namespace, page_title" there,
which will sort by namespace, then by title.

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


gmane at kennel17

Sep 7, 2009, 4:23 AM

Post #3 of 3 (166 views)
Permalink
Re: SQL [In reply to]

"Roan Kattouw" <roan.kattouw[at]gmail.com> wrote in message
news:f154f3a80909050742i90f5949vf0fad7962a154935[at]mail.gmail.com...
> 2009/9/5 Helder Geovane Gomes de Lima <heldergeovane[at]gmail.com>:
>> But I don't know what to use in the SQL instead of the "WHAT?".
>> Does anybody knows what should it be?
>>
> You should probably use "ORDER BY page_namespace, page_title" there,
> which will sort by namespace, then by title.

However, it should be noted that page_namespace is the numeric index for the
namespace, NOT the textual representation of it, therefore in all languages
they will be ordered as follows (with the namespace names being the
appropriate ones for the language being used):

Foo
Talk:Foo
User:Foo
User talk:Foo
Project:Foo
Project talk:Foo
File:Foo.jpg
File talk:Foo.jpg
MediaWiki:Foo
MediaWiki talk:Foo
Template:Foo
Template talk:Foo
Help:Foo
Help talk:Foo
Category:Foo
Category talk:Foo

Rather than the following 'properly alphabetical' order (assuming
language=en):

Category talk:Foo
Category:Foo
File talk:Foo.jpg
File:Foo.jpg
Foo
Help talk:Foo
Help:Foo
MediaWiki talk:Foo
MediaWiki:Foo
Project talk:Foo
Project:Foo
Talk:Foo
Template talk:Foo
Template:Foo
User talk:Foo
User:Foo

This is probably desirable, but I thought it worth pointing out...

- Mark Clements (HappyDog)



_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.