Two new hooks to EditPage.php, EditPage::AfterEdit:Form and EditPage:BeforeDisplaying...
[lhc/web/wiklou.git] / includes / WatchlistEditor.php
index f442b04..fcfdb78 100644 (file)
@@ -19,10 +19,10 @@ class WatchlistEditor {
        /**
         * Main execution point
         *
-        * @param User $user
-        * @param OutputPage $output
-        * @param WebRequest $request
-        * @param int $mode
+        * @param $user User
+        * @param $output OutputPage
+        * @param $request WebRequest
+        * @param $mode int
         */
        public function execute( $user, $output, $request, $mode ) {
                global $wgUser;
@@ -81,8 +81,8 @@ class WatchlistEditor {
        /**
         * Check the edit token from a form submission
         *
-        * @param WebRequest $request
-        * @param User $user
+        * @param $request WebRequest
+        * @param $user User
         * @return bool
         */
        private function checkToken( $request, $user ) {
@@ -93,7 +93,7 @@ class WatchlistEditor {
         * Extract a list of titles from a blob of text, returning
         * (prefixed) strings; unwatchable titles are ignored
         *
-        * @param mixed $list
+        * @param $list mixed
         * @return array
         */
        private function extractTitles( $list ) {
@@ -120,9 +120,9 @@ class WatchlistEditor {
         * $titles can be an array of strings or Title objects; the former
         * is preferred, since Titles are very memory-heavy
         *
-        * @param array $titles An array of strings, or Title objects
-        * @param OutputPage $output
-        * @param Skin $skin
+        * @param $titles An array of strings, or Title objects
+        * @param $output OutputPage
+        * @param $skin Skin
         */
        private function showTitles( $titles, $output, $skin ) {
                $talk = wfMsgHtml( 'talkpagelinktext' );
@@ -153,12 +153,12 @@ class WatchlistEditor {
        /**
         * Count the number of titles on a user's watchlist, excluding talk pages
         *
-        * @param User $user
+        * @param $user User
         * @return int
         */
        private function countWatchlist( $user ) {
                $dbr = wfGetDB( DB_MASTER );
-               $res = $dbr->select( 'watchlist', 'COUNT(*) AS count', array( 'wl_user' => $user->getID() ), __METHOD__ );
+               $res = $dbr->select( 'watchlist', 'COUNT(*) AS count', array( 'wl_user' => $user->getId() ), __METHOD__ );
                $row = $dbr->fetchObject( $res );
                return ceil( $row->count / 2 ); // Paranoia
        }
@@ -167,7 +167,7 @@ class WatchlistEditor {
         * Prepare a list of titles on a user's watchlist (excluding talk pages)
         * and return an array of (prefixed) strings
         *
-        * @param User $user
+        * @param $user User
         * @return array
         */
        private function getWatchlist( $user ) {
@@ -177,7 +177,7 @@ class WatchlistEditor {
                        'watchlist',
                        '*',
                        array(
-                               'wl_user' => $user->getID(),
+                               'wl_user' => $user->getId(),
                        ),
                        __METHOD__
                );
@@ -197,13 +197,13 @@ class WatchlistEditor {
         * and return as a two-dimensional array with namespace, title and
         * redirect status
         *
-        * @param User $user
+        * @param $user User
         * @return array
         */
        private function getWatchlistInfo( $user ) {
                $titles = array();
                $dbr = wfGetDB( DB_MASTER );
-               $uid = intval( $user->getID() );
+               $uid = intval( $user->getId() );
                list( $watchlist, $page ) = $dbr->tableNamesN( 'watchlist', 'page' );
                $sql = "SELECT wl_namespace, wl_title, page_id, page_len, page_is_redirect
                        FROM {$watchlist} LEFT JOIN {$page} ON ( wl_namespace = page_namespace
@@ -233,8 +233,8 @@ class WatchlistEditor {
         * Show a message indicating the number of items on the user's watchlist,
         * and return this count for additional checking
         *
-        * @param OutputPage $output
-        * @param User $user
+        * @param $output OutputPage
+        * @param $user User
         * @return int
         */
        private function showItemCount( $output, $user ) {
@@ -250,11 +250,11 @@ class WatchlistEditor {
        /**
         * Remove all titles from a user's watchlist
         *
-        * @param User $user
+        * @param $user User
         */
        private function clearWatchlist( $user ) {
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->delete( 'watchlist', array( 'wl_user' => $user->getID() ), __METHOD__ );
+               $dbw->delete( 'watchlist', array( 'wl_user' => $user->getId() ), __METHOD__ );
        }
 
        /**
@@ -263,8 +263,8 @@ class WatchlistEditor {
         * $titles can be an array of strings or Title objects; the former
         * is preferred, since Titles are very memory-heavy
         *
-        * @param array $titles An array of strings, or Title objects
-        * @param User $user
+        * @param $titles An array of strings, or Title objects
+        * @param $user User
         */
        private function watchTitles( $titles, $user ) {
                $dbw = wfGetDB( DB_MASTER );
@@ -274,13 +274,13 @@ class WatchlistEditor {
                                $title = Title::newFromText( $title );
                        if( $title instanceof Title ) {
                                $rows[] = array(
-                                       'wl_user' => $user->getID(),
+                                       'wl_user' => $user->getId(),
                                        'wl_namespace' => ( $title->getNamespace() & ~1 ),
                                        'wl_title' => $title->getDBkey(),
                                        'wl_notificationtimestamp' => null,
                                );
                                $rows[] = array(
-                                       'wl_user' => $user->getID(),
+                                       'wl_user' => $user->getId(),
                                        'wl_namespace' => ( $title->getNamespace() | 1 ),
                                        'wl_title' => $title->getDBkey(),
                                        'wl_notificationtimestamp' => null,
@@ -296,8 +296,8 @@ class WatchlistEditor {
         * $titles can be an array of strings or Title objects; the former
         * is preferred, since Titles are very memory-heavy
         *
-        * @param array $titles An array of strings, or Title objects
-        * @param User $user
+        * @param $titles An array of strings, or Title objects
+        * @param $user User
         */
        private function unwatchTitles( $titles, $user ) {
                $dbw = wfGetDB( DB_MASTER );
@@ -308,7 +308,7 @@ class WatchlistEditor {
                                $dbw->delete(
                                        'watchlist',
                                        array(
-                                               'wl_user' => $user->getID(),
+                                               'wl_user' => $user->getId(),
                                                'wl_namespace' => ( $title->getNamespace() & ~1 ),
                                                'wl_title' => $title->getDBkey(),
                                        ),
@@ -317,7 +317,7 @@ class WatchlistEditor {
                                $dbw->delete(
                                        'watchlist',
                                        array(
-                                               'wl_user' => $user->getID(),
+                                               'wl_user' => $user->getId(),
                                                'wl_namespace' => ( $title->getNamespace() | 1 ),
                                                'wl_title' => $title->getDBkey(),
                                        ),
@@ -330,8 +330,8 @@ class WatchlistEditor {
        /**
         * Show the standard watchlist editing form
         *
-        * @param OutputPage $output
-        * @param User $user
+        * @param $output OutputPage
+        * @param $user User
         */
        private function showNormalForm( $output, $user ) {
                global $wgUser;
@@ -360,7 +360,7 @@ class WatchlistEditor {
        /**
         * Get the correct "heading" for a namespace
         *
-        * @param int $namespace
+        * @param $namespace int
         * @return string
         */
        private function getNamespaceHeading( $namespace ) {
@@ -373,9 +373,9 @@ class WatchlistEditor {
         * Build a single list item containing a check box selecting a title
         * and a link to that title, with various additional bits
         *
-        * @param Title $title
-        * @param bool $redirect
-        * @param Skin $skin
+        * @param $title Title
+        * @param $redirect bool
+        * @param $skin Skin
         * @return string
         */
        private function buildRemoveLine( $title, $redirect, $skin ) {
@@ -397,8 +397,8 @@ class WatchlistEditor {
        /**
         * Show a form for editing the watchlist in "raw" mode
         *
-        * @param OutputPage $output
-        * @param User $user
+        * @param $output OutputPage
+        * @param $user User
         */
        public function showRawForm( $output, $user ) {
                global $wgUser;
@@ -426,8 +426,8 @@ class WatchlistEditor {
         * Determine whether we are editing the watchlist, and if so, what
         * kind of editing operation
         *
-        * @param WebRequest $request
-        * @param mixed $par
+        * @param $request WebRequest
+        * @param $par mixed
         * @return int
         */
        public static function getMode( $request, $par ) {
@@ -448,7 +448,7 @@ class WatchlistEditor {
         * Build a set of links for convenient navigation
         * between watchlist viewing and editing modes
         *
-        * @param Skin $skin Skin to use
+        * @param $skin Skin to use
         * @return string
         */
        public static function buildTools( $skin ) {