Jump to content

Kézikönyv:Lap találomra

From mediawiki.org
This page is a translated version of the page Manual:Random page and the translation is 36% complete.
Outdated translations are marked like this.

Egy véletlen lap a Special:Random segítségével tekinthető meg. Ez a wfRandom() függvényt használja, amely képes elkerülni a duplikált értékeket 4 611 686 014 132 420 609 (azaz ≈ $math) lapig, valamint a page.page_random értékeket a page táblázatból. A SpecialRandomGetRandomTitle hook használható a kiválasztási kritériumok módosításához.

Historically, MySQL's RAND() function sometimes was used to populate page_random, including during upgrades. (See task T5946.) This is no longer the case since 1.36. To reset missing or nonuniformly distributed values (as in task T208909), run the resetPageRandom.php script.

By default, selection will be limited to pages from namespaces in $wgContentNamespaces . The user can choose which namespace to look in. For example, if they wanted to view a random file they could go to Special:Random/file. If they wanted to view a random mainspace page they could go to Special:Random/main, etc.

The file that implements this feature is SpecialRandomPage.php. SpecialRandomRedirect.php (Special:RandomRedirect) directs the user to a random redirect page (minus the second redirect). There is an array, $extra, that allows for adding extra SQL statements to the query for selecting a random page from the database.

Lásd még