* Remove Special:Randomincategory. Domas said that it will work slowly on big categor...
authorVictor Vasiliev <vasilievvv@users.mediawiki.org>
Mon, 12 Nov 2007 16:03:34 +0000 (16:03 +0000)
committerVictor Vasiliev <vasilievvv@users.mediawiki.org>
Mon, 12 Nov 2007 16:03:34 +0000 (16:03 +0000)
RELEASE-NOTES
includes/AutoLoader.php
includes/SkinTemplate.php
includes/SpecialPage.php
includes/SpecialRandomincategory.php [deleted file]
languages/messages/MessagesEn.php
languages/messages/MessagesRu.php
maintenance/language/messageTypes.inc
maintenance/language/messages.inc
skins/MonoBook.php

index 3a20a41..4d5d108 100644 (file)
@@ -61,8 +61,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * OutputPage::getRedirect public method added.
 * (bug 11848) Allow URL parameters 'editintro' and 'preload' in Special:Mypage 
   and Special:Mytalk
-* Add special page for getting random page from category
-* Add link on Special:Randomincategory to sidebar
 * Add ot=raw to Special:Allmessages
 
 === Bug fixes in 1.12 ===
index e1930c3..828be04 100644 (file)
@@ -207,7 +207,6 @@ function __autoload($className) {
                'PreferencesForm' => 'includes/SpecialPreferences.php',
                'SpecialPrefixindex' => 'includes/SpecialPrefixindex.php',
                'RandomPage' => 'includes/SpecialRandompage.php',
-               'RandomPageInCategory' => 'includes/SpecialRandomincategory.php',
                'PasswordResetForm' => 'includes/SpecialResetpass.php',
                'RevisionDeleteForm' => 'includes/SpecialRevisiondelete.php',
                'RevisionDeleter' => 'includes/SpecialRevisiondelete.php',
index 6145e9d..791137b 100644 (file)
@@ -893,13 +893,6 @@ class SkinTemplate extends Skin {
                                );
                }
 
-               if( $this->mTitle->getNamespace() == NS_CATEGORY || $this->mTitle->getNamespace() == NS_CATEGORY_TALK ) {
-                       $nav_urls['randomincategory'] = array(
-                               'text' => wfMsg( 'randomincategory-toolbox' ),
-                               'href' => self::makeSpecialUrlSubpage( 'Randomincategory', $this->mTitle->getText() ),
-                       );
-               }
-
                if( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) {
                        $id = User::idFromName($this->mTitle->getText());
                        $ip = User::isIP($this->mTitle->getText());
@@ -1204,3 +1197,4 @@ class QuickTemplate {
 }
 
 
+
index effea32..1676626 100644 (file)
@@ -90,7 +90,6 @@ class SpecialPage
                'Listusers'                 => array( 'SpecialPage', 'Listusers' ),
                'Statistics'                => array( 'SpecialPage', 'Statistics' ),
                'Randompage'                => array( 'SpecialPage', 'Randompage' ),
-               'Randomincategory'          => array( 'SpecialPage', 'Randomincategory' ),
                'Lonelypages'               => array( 'SpecialPage', 'Lonelypages' ),
                'Uncategorizedpages'        => array( 'SpecialPage', 'Uncategorizedpages' ),
                'Uncategorizedcategories'   => array( 'SpecialPage', 'Uncategorizedcategories' ),
diff --git a/includes/SpecialRandomincategory.php b/includes/SpecialRandomincategory.php
deleted file mode 100644 (file)
index 5d50c97..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-
-/**
- * Special page to direct the user to a random page in specified category
- *
- * @addtogroup SpecialPage
- * @author VasilievVV <vasilvv@gmail.com>, based on SpecialRandompage.php code
- * @license GNU General Public Licence 2.0 or later
- */
-
-/**
- * Main execution point
- * @param $par Category to select the page from
- */
-function wfSpecialRandomincategory( $par = null ) {
-       global $wgOut, $wgRequest;
-
-       if( is_null( $par ) ) {
-               if ( $requestCategory = $wgRequest->getVal( 'category' ) ) {
-                       $par = $requestCategory;
-               }
-               else {
-                       $wgOut->addHTML( RandomPageInCategory::getForm() );
-                       return;
-               }
-       }
-
-       $rnd = new RandomPageInCategory();
-       if( !$rnd->setCategory( $par ) ) {
-               $wgOut->addHTML( RandomPageInCategory::getForm( $par ) );
-               return;
-       }
-
-       $title = $rnd->getRandomTitle();
-
-       if( is_null( $title ) ) {
-               $wgOut->addWikiText( wfMsg( 'randomincategory-nocategory', $par ) );
-               $wgOut->addHTML( RandomPageInCategory::getForm( $par ) );
-               return;
-       }
-
-       $wgOut->reportTime();
-       $wgOut->redirect( $title->getFullUrl() );
-}
-
-
-/**
- * Special page to direct the user to a random page in specified category
- *
- * @addtogroup SpecialPage
- */
-class RandomPageInCategory {
-       private $category = null;
-
-       public function getCategory ( ) {
-               return $this->namespace;
-       }
-       public function setCategory ( $cat ) {
-               $category = Title::makeTitleSafe( NS_CATEGORY, $cat );
-               //Invalid title
-               if( !$category ) {
-                       return false;
-               }
-               $this->category = $category->getDBKey();
-               return true;
-       }
-
-       /**
-        * Choose a random title. Based on Special:Random
-        * @return Title object (or null if nothing to choose from)
-        */
-       public function getRandomTitle ( ) {
-               $randstr = wfRandom();
-               $row = $this->selectRandomPageFromDB( $randstr );
-
-               if( !$row )
-                       $row = $this->selectRandomPageFromDB( "0" );
-
-               if( $row )
-                       return Title::newFromText( $row->page_title, $row->page_namespace );
-               else
-                       return null;
-       }
-
-       private function selectRandomPageFromDB ( $randstr ) {
-               global $wgExtraRandompageSQL, $wgOut;
-               $fname = 'RandomPageInCategory::selectRandomPageFromDB';
-
-               $dbr = wfGetDB( DB_SLAVE );
-
-               $use_index = $dbr->useIndexClause( 'page_random' );
-               $page = $dbr->tableName( 'page' );
-               $categorylinks = $dbr->tableName( 'categorylinks' );
-               $category = $dbr->addQuotes( $this->category );
-
-               $extra = $wgExtraRandompageSQL ? "AND ($wgExtraRandompageSQL)" : "";
-               $sql = "SELECT page_namespace, page_title
-                       FROM $page $use_index JOIN $categorylinks ON page_id = cl_from
-                       WHERE page_is_redirect = 0
-                       AND page_random >= $randstr
-                       AND cl_to = $category
-                       $extra
-                       ORDER BY page_random";
-
-               $sql = $dbr->limitResult( $sql, 1, 0 );
-               $res = $dbr->query( $sql, $fname );
-               return $dbr->fetchObject( $res );
-       }
-       
-       public static function getForm( $par = null ) {
-               global $wgScript, $wgTitle, $wgRequest;
-
-               if( !( $category = $par ) ) {
-                       $category = $wgRequest->getVal( 'category' );
-               }
-
-               $f =
-                       Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
-                               Xml::openElement( 'fieldset' ) .
-                                       Xml::element( 'legend', array(), wfMsg( 'randomincategory' ) ) .
-                                       Xml::hidden( 'title', $wgTitle->getPrefixedText() ) .
-                                       Xml::openElement( 'p' ) .
-                                               Xml::label( wfMsg( 'randomincategory-label' ), 'category' ) . ' ' .
-                                               Xml::input( 'category', null, $category, array( 'id' => 'category' ) ) . ' ' .
-                                               Xml::submitButton( wfMsg( 'randomincategory-submit' ) ) .
-                                       Xml::closeElement( 'p' ) .
-                               Xml::closeElement( 'fieldset' ) .
-                       Xml::closeElement( 'form' );
-               return $f;
-       }
-}
-
-
-
index c87541b..dd108e7 100644 (file)
@@ -360,7 +360,6 @@ $specialPageAliases = array(
        'Listusers'                 => array( 'Listusers', 'Userlist' ),
        'Statistics'                => array( 'Statistics' ),
        'Randompage'                => array( 'Random', 'Randompage' ),
-       'Randomincategory'          => array( 'Randomincategory' ),
        'Lonelypages'               => array( 'Lonelypages', 'Orphanedpages' ),
        'Uncategorizedpages'        => array( 'Uncategorizedpages' ),
        'Uncategorizedcategories'   => array( 'Uncategorizedcategories' ),
@@ -1555,11 +1554,6 @@ PICT # misc.
 'randompage'                      => 'Random page',
 'randompage-nopages'              => 'There are no pages in this namespace.',
 'randompage-url'                  => 'Special:Random', # don't translate or duplicate this message to other languages
-'randomincategory'                => 'Random page in category',
-'randomincategory-toolbox'        => 'Random page',
-'randomincategory-nocategory'     => 'Category $1 doesn\'t exist or is empty',
-'randomincategory-label'          => 'Category:',
-'randomincategory-submit'         => 'Go',
 
 # Random redirect
 'randomredirect'                  => 'Random redirect',
@@ -2294,7 +2288,6 @@ All transwiki import actions are logged at the [[Special:Log/import|import log]]
 'accesskey-n-sitesupport'           => '', # don't translate or duplicate this message to other languages
 'accesskey-t-whatlinkshere'         => 'j', # don't translate or duplicate this message to other languages
 'accesskey-t-recentchangeslinked'   => 'k', # don't translate or duplicate this message to other languages
-'accesskey-t-random'                => '', # don't translate or duplicate this message to other languages
 'accesskey-feed-rss'                => '', # don't translate or duplicate this message to other languages
 'accesskey-feed-atom'               => '', # don't translate or duplicate this message to other languages
 'accesskey-t-contributions'         => '', # don't translate or duplicate this message to other languages
@@ -2356,7 +2349,6 @@ All transwiki import actions are logged at the [[Special:Log/import|import log]]
 'tooltip-n-sitesupport'           => 'Support us',
 'tooltip-t-whatlinkshere'         => 'List of all wiki pages that link here',
 'tooltip-t-recentchangeslinked'   => 'Recent changes in pages linked from this page',
-'tooltip-t-random'                => 'Random page in this category',
 'tooltip-feed-rss'                => 'RSS feed for this page',
 'tooltip-feed-atom'               => 'Atom feed for this page',
 'tooltip-t-contributions'         => 'View the list of contributions of this user',
index 45b43de..64d6369 100644 (file)
@@ -1215,13 +1215,6 @@ $3 указал следующую причину: ''$2''",
 # Random pages
 'randompage'                      => 'Случайная страница',
 'randompage-nopages'              => 'В данном пространстве имён отсутствуют страницы.',
-'randomincategory'                => 'Случайная страница в категории',
-'randomincategory-toolbox'        => 'Случайная страница',
-'randomincategory-nocategory'     => 'Категория "$1" пуста или не существует',
-'randomincategory-label'          => 'Категория:',
-'randomincategory-submit'         => 'Перейти',
-'randomredirect-nopages'          => 'В данном пространстве имён нет перенаправлений.',
-'randomredirect'                  => 'Случайное перенаправление',
 
 # Statistics
 'statistics'             => 'Статистика',
index de1d198..3cb8e90 100644 (file)
@@ -42,7 +42,6 @@ $wgIgnoredMessages = array(
        'accesskey-n-sitesupport',
        'accesskey-t-whatlinkshere',
        'accesskey-t-recentchangeslinked',
-       'accesskey-t-random',
        'accesskey-feed-rss',
        'accesskey-feed-atom',
        'accesskey-t-contributions',
index fc301ac..88984d1 100644 (file)
@@ -947,11 +947,6 @@ $wgMessageStructure = array(
                'randompage',
                'randompage-nopages',
                'randompage-url',
-               'randomincategory',
-               'randomincategory-toolbox',
-               'randomincategory-nocategory',
-               'randomincategory-label',
-               'randomincategory-submit',
        ),
        'randomredirect' => array(
                'randomredirect',
index 1ebe71d..d0148a7 100644 (file)
@@ -221,11 +221,6 @@ class MonoBookTemplate extends QuickTemplate {
                } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
                                <li id="t-ispermalink"<?php echo $skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
                }
-               
-               if(!empty($this->data['nav_urls']['randomincategory']['href'])) { ?>
-                               <li id="t-random"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['randomincategory']['href'])
-                               ?>"<?php echo $skin->tooltipAndAccesskey('t-random') ?>><?php $this->msg('randomincategory-toolbox') ?></a></li><?php
-               }
 
                wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
 ?>