X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialRandompage.php;h=9f7ef6690e03846a01a7fba4e31da31b7367d9fc;hb=6b758fc982972ee60856af0b766383f3aae97f65;hp=6d8f59b5717e333011e31f178c8baa56e7e81986;hpb=8c6e9e5f2f50352b11671ac665b0889b5eb9799b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialRandompage.php b/includes/specials/SpecialRandompage.php index 6d8f59b571..9f7ef6690e 100644 --- a/includes/specials/SpecialRandompage.php +++ b/includes/specials/SpecialRandompage.php @@ -106,7 +106,7 @@ class RandomPage extends SpecialPage { $randstr = wfRandom(); $title = null; - if ( !wfRunHooks( + if ( !Hooks::run( 'SpecialRandomGetRandomTitle', array( &$randstr, &$this->isRedir, &$this->namespaces, &$this->extra, &$title ) ) ) { @@ -135,20 +135,26 @@ class RandomPage extends SpecialPage { protected function getQueryInfo( $randstr ) { $redirect = $this->isRedirect() ? 1 : 0; + $tables = array( 'page' ); + $conds = array_merge( array( + 'page_namespace' => $this->namespaces, + 'page_is_redirect' => $redirect, + 'page_random >= ' . $randstr + ), $this->extra ); + $joinConds = array(); + + // Allow extensions to modify the query + Hooks::run( 'RandomPageQuery', array( &$tables, &$conds, &$joinConds ) ); return array( - 'tables' => array( 'page' ), + 'tables' => $tables, 'fields' => array( 'page_title', 'page_namespace' ), - 'conds' => array_merge( array( - 'page_namespace' => $this->namespaces, - 'page_is_redirect' => $redirect, - 'page_random >= ' . $randstr - ), $this->extra ), + 'conds' => $conds, 'options' => array( 'ORDER BY' => 'page_random', 'LIMIT' => 1, ), - 'join_conds' => array() + 'join_conds' => $joinConds ); }