It's cache because when i wait more (3mn mini), it's ok Great.
With my new extension, i can find, with hazard, some pages from category i choose.
just my first. So no complicated, but i can understand more mediawiki. And for my wiki, it's usefull
Thank's for all john and bartosz. You are very kind.
Just if you have an idea for my cache ?
yonnel
2016-07-30 19:21 GMT+02:00 yonnel kurtz yonnel.kurtz@gmail.com:
so, it's very kind to help me to understand (sorry for my english, i'm french)
for rand(), i'm agree; But my problem is to have for example 5 pages in the return of perhaps 50. tag extension : <liste articles nombre=5 />
page_random is not possible, because if i want 5, the code could find only one (page_ramdom just limit of the last for example)
So 50 pages is not heavy, and rand() is possible.
But i find always the same with :
[...]
array( 'ORDER BY' => 'rand()', 'LIMIT' => ($nombre+1) ), Perhaps cache ? But i put in LocalSettings.php : NO_CACHE
yonnel
2016-07-30 18:44 GMT+02:00 Bartosz Dziewoński matma.rex@gmail.com:
You have to do it like this:
'ORDER BY' => 'rand()',Note that 'rand()' is in quotes, to send this string to MySQL and call the SQL rand() function – otherwise, you'd call the rand() function in PHP and send a random number to MySQL.
In general this is a bad idea, though, since this doesn't mean "select a random row and return it" – it means "select all rows, order them randomly, then return the first one", which is going to quickly become slow if you have more than a couple thousand of rows.
The page_random column John suggested in used for MediaWiki's built-in random page functionality, and a much better idea. You would use something like:
'page_random >= ' . wfRandom(),…in the WHERE condition. See how it's used in MediaWiki:
https://phabricator.wikimedia.org/diffusion/MW/browse/master/includes/specia...
-- Bartosz Dziewoński
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
-- adresse mail : yonnel.kurtz@gmail.com mobile : 07 61 72 79 12
Identifiant de société : Siren : 501 161 384 Code NAF : 722C Siret : 501 161 384 00018 Code Insee : C75017862440