From: Aaron Pramana Date: Wed, 4 Jul 2012 02:51:22 +0000 (+0000) Subject: Revert "Watchlist grouping (not ready for review)" X-Git-Tag: 1.31.0-rc.0~23138^2 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=52a9bc081eb5ae2167928f4f2f2a50110eeb0996;p=lhc%2Fweb%2Fwiklou.git Revert "Watchlist grouping (not ready for review)" This reverts commit 9d1bb4f3e401786a86c12ae4b20b425c27ddcb91 --- diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 4d76f976cf..d29c4e35b6 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -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', diff --git a/includes/User.php b/includes/User.php index 0d3d14d47d..01407b1d8e 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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(); } diff --git a/includes/WatchedItem.php b/includes/WatchedItem.php index cb27312264..932af1692e 100644 --- a/includes/WatchedItem.php +++ b/includes/WatchedItem.php @@ -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 index 0a58958ff9..0000000000 --- a/includes/WatchlistGroup.php +++ /dev/null @@ -1,61 +0,0 @@ -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 diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index 55a15a47c7..67f6d688c2 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -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 ) . ")"; } /**