Revert "Watchlist grouping (not ready for review)"
authorAaron Pramana <aaron@sociotopia.com>
Wed, 4 Jul 2012 02:51:22 +0000 (02:51 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 4 Jul 2012 02:51:22 +0000 (02:51 +0000)
This reverts commit 9d1bb4f3e401786a86c12ae4b20b425c27ddcb91

includes/AutoLoader.php
includes/User.php
includes/WatchedItem.php
includes/WatchlistGroup.php [deleted file]
includes/specials/SpecialEditWatchlist.php

index 4d76f97..d29c4e3 100644 (file)
@@ -258,7 +258,6 @@ $wgAutoloadLocalClasses = array(
        'ViewCountUpdate' => 'includes/ViewCountUpdate.php',
        'WantedQueryPage' => 'includes/QueryPage.php',
        'WatchedItem' => 'includes/WatchedItem.php',
-       'WatchlistGroup' => 'includes/WatchlistGroup.php',
        'WebRequest' => 'includes/WebRequest.php',
        'WebRequestUpload' => 'includes/WebRequest.php',
        'WebResponse' => 'includes/WebResponse.php',
index 0d3d14d..01407b1 100644 (file)
@@ -2627,8 +2627,8 @@ class User {
         * Watch an article.
         * @param $title Title of the article to look at
         */
-       public function addWatch( $title, $group ) {
-               $wl = WatchedItem::fromUserTitle( $this, $title, $group );
+       public function addWatch( $title ) {
+               $wl = WatchedItem::fromUserTitle( $this, $title );
                $wl->addWatch();
                $this->invalidateCache();
        }
index cb27312..932af16 100644 (file)
@@ -27,7 +27,7 @@
  * @ingroup Watchlist
  */
 class WatchedItem {
-       var $mTitle, $mUser, $id, $gr, $ns, $ti;
+       var $mTitle, $mUser, $id, $ns, $ti;
        private $loaded = false, $watched, $timestamp;
 
        /**
@@ -36,7 +36,7 @@ class WatchedItem {
         * @param $title Title: the title we're going to (un)watch
         * @return WatchedItem object
         */
-       public static function fromUserTitle( $user, $title, $group = 0 ) {
+       public static function fromUserTitle( $user, $title ) {
                $wl = new WatchedItem;
                $wl->mUser = $user;
                $wl->mTitle = $title;
@@ -48,8 +48,6 @@ class WatchedItem {
                $wl->ns = $title->getNamespace();
 
                $wl->ti = $title->getDBkey();
-
-               $wl->gr = $group;
                return $wl;
        }
 
@@ -147,7 +145,6 @@ class WatchedItem {
                $dbw->insert( 'watchlist',
                  array(
                        'wl_user' => $this->id,
-                       'wl_group' => $this->gr,
                        'wl_namespace' => MWNamespace::getSubject($this->ns),
                        'wl_title' => $this->ti,
                        'wl_notificationtimestamp' => null
@@ -158,7 +155,6 @@ class WatchedItem {
                $dbw->insert( 'watchlist',
                  array(
                        'wl_user' => $this->id,
-                       'wl_group' => $this->gr,
                        'wl_namespace' => MWNamespace::getTalk($this->ns),
                        'wl_title' => $this->ti,
                        'wl_notificationtimestamp' => null
diff --git a/includes/WatchlistGroup.php b/includes/WatchlistGroup.php
deleted file mode 100644 (file)
index 0a58958..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/**
- * Accessor and mutator for watchlist groups.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-class WatchlistGroup {
-       public static function getGroups( $context ){
-               $dbr = wfGetDB( DB_SLAVE );
-               $res = $dbr->select( 'watchlist_groups', array( 'wg_id', 'wg_name' ),
-                       array( 'wg_user' => $context->getUser()->getId()), __METHOD__ 
-               );
-               $groups = array();
-               foreach ( $res as $s ) {
-                       $groups[$s->wg_id] = $s->wg_name;
-               }
-               return $groups;
-       }
-
-       public static function getGroupFromUserTitle( $title, $context ){
-               $dbr = wfGetDB( DB_SLAVE );
-               $res = $dbr->selectRow( 'watchlist', array( 'wl_group' ),
-                       array( 'wl_title' => $title, 'wl_user' => $context->getUser()->getId()), __METHOD__ 
-               );
-               $gid = intval($res->wl_group);
-
-               if($gid == 0){
-                       $gname = 'None';
-               } else {
-                       $res = $dbr->selectRow( 'watchlist_groups', array( 'wg_name' ),
-                               array( 'wg_id' => $gid ), __METHOD__ 
-                       );
-                       $gname = $res->wg_name;
-               }
-               $group = array( $gname, $gid );
-               return $group;
-       }
-
-       public static function regroupTitles( $titles, $group, $context ){
-               $dbw = wfGetDB( DB_MASTER );
-               $res = $dbw->update( 'watchlist', array( 'wl_group' => $group ),
-                       array( 'wl_title' => $titles), __METHOD__ );
-               return $res;
-       }
-}
\ No newline at end of file
index 55a15a4..67f6d68 100644 (file)
@@ -275,7 +275,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
 
                $res = $dbr->select(
                        array( 'watchlist' ),
-                       array( 'wl_namespace', 'wl_group', 'wl_title' ),
+                       array( 'wl_namespace',  'wl_title' ),
                        array( 'wl_user' => $this->getUser()->getId() ),
                        __METHOD__,
                        array( 'ORDER BY' => array( 'wl_namespace', 'wl_title' ) )
@@ -285,7 +285,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                foreach ( $res as $row ) {
                        $lb->add( $row->wl_namespace, $row->wl_title );
                        if ( !MWNamespace::isTalk( $row->wl_namespace ) ) {
-                               $titles[$row->wl_namespace][$row->wl_title] = intval($row->wl_group);
+                               $titles[$row->wl_namespace][$row->wl_title] = 1;
                        }
                }
 
@@ -436,17 +436,6 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
        public function submitNormal( $data ) {
                $removed = array();
 
-               // Regrouping submission
-               $group = intval( $data['group'] );
-               unset($data['group']);
-               if( $group > -1 ){
-                       foreach( $data as $titles ) {
-                               WatchlistGroup::regroupTitles( $titles, $group, $this->getContext() );
-                       }
-                       $this->successMessage = 'Titles were successfully regrouped!';
-                       return true;
-               }
-
                foreach( $data as $titles ) {
                        $this->unwatchTitles( $titles );
                        $removed = array_merge( $removed, $titles );
@@ -470,8 +459,6 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
        protected function getNormalForm(){
                global $wgContLang;
 
-               
-
                $fields = array();
                $count = 0;
 
@@ -514,19 +501,6 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                        $this->toc = false;
                }
 
-               $groups = WatchlistGroup::getGroups( $this->getContext() );
-               foreach( $groups as &$g ){
-                       $g = 'Change group to "' . $g . '"';
-               }
-
-               $gsOptions = array_merge( array( 'Remove titles' => -1, 'Ungroup' => 0 ), array_flip( $groups ) );
-
-               $fields['group'] = array(
-                       'type' => 'select',
-                       'options' => $gsOptions,
-                       'label' => "Action:"
-               );
-
                $form = new EditWatchlistNormalHTMLForm( $fields, $this->getContext() );
                $form->setTitle( $this->getTitle() );
                $form->setSubmitTextMsg( 'watchlistedit-normal-submit' );
@@ -566,12 +540,9 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                        );
                }
 
-               $wgroup = WatchlistGroup::getGroupFromUserTitle( $title, $this->getContext() );
-               $wgrouplink = $wgroup[0];
-
                wfRunHooks( 'WatchlistEditorBuildRemoveLine', array( &$tools, $title, $title->isRedirect(), $this->getSkin() ) );
 
-               return $link . " (" . $this->getLanguage()->pipeList( $tools ) . ") (Group: " . $wgrouplink . ")";
+               return $link . " (" . $this->getLanguage()->pipeList( $tools ) . ")";
        }
 
        /**