Don't manually quote stuff
[lhc/web/wiklou.git] / includes / Title.php
index 046fadb..4f7984e 100644 (file)
@@ -1516,6 +1516,7 @@ class Title {
        /**
         * Is $wgUser watching this page?
         *
+        * @deprecated in 1.20; use User::isWatched() instead.
         * @return Bool
         */
        public function userIsWatching() {
@@ -2858,7 +2859,7 @@ class Title {
         * @return Int or 0 if the page doesn't exist
         */
        public function getLatestRevID( $flags = 0 ) {
-               if ( $this->mLatestID !== false ) {
+               if ( !( $flags & Title::GAID_FOR_UPDATE ) && $this->mLatestID !== false ) {
                        return intval( $this->mLatestID );
                }
                # Calling getArticleID() loads the field from cache as needed
@@ -2877,7 +2878,7 @@ class Title {
         *
         * - This is called from WikiPage::doEdit() and WikiPage::insertOn() to allow
         * loading of the new page_id. It's also called from
-        * WikiPage::doDeleteArticle()
+        * WikiPage::doDeleteArticleReal()
         *
         * @param $newid Int the new Article ID
         */
@@ -3284,16 +3285,14 @@ class Title {
         * @return Array of String the URLs
         */
        public function getSquidURLs() {
-               global $wgContLang;
-
                $urls = array(
                        $this->getInternalURL(),
                        $this->getInternalURL( 'action=history' )
                );
 
-               // purge variant urls as well
-               if ( $wgContLang->hasVariants() ) {
-                       $variants = $wgContLang->getVariants();
+               $pageLang = $this->getPageLanguage();
+               if ( $pageLang->hasVariants() ) {
+                       $variants = $pageLang->getVariants();
                        foreach ( $variants as $vCode ) {
                                $urls[] = $this->getInternalURL( '', $vCode );
                        }
@@ -3475,6 +3474,10 @@ class Title {
                        $wgUser->spreadAnyEditBlock();
                        return $err;
                }
+               // Check suppressredirect permission
+               if ( $auth && !$wgUser->isAllowed( 'suppressredirect' ) ) {
+                       $createRedirect = true;
+               }
 
                // If it is a file, move it first.
                // It is done before all other moving stuff is done because it's hard to revert.
@@ -3571,8 +3574,8 @@ class Title {
         *
         * @param $nt Title the page to move to, which should be a redirect or nonexistent
         * @param $reason String The reason for the move
-        * @param $createRedirect Bool Whether to leave a redirect at the old title.  Ignored
-        *   if the user doesn't have the suppressredirect right
+        * @param $createRedirect Bool Whether to leave a redirect at the old title. Does not check
+        *   if the user has the suppressredirect right
         * @throws MWException
         */
        private function moveToInternal( &$nt, $reason = '', $createRedirect = true ) {
@@ -3586,7 +3589,7 @@ class Title {
                        $logType = 'move';
                }
 
-               $redirectSuppressed = !$createRedirect && $wgUser->isAllowed( 'suppressredirect' );
+               $redirectSuppressed = !$createRedirect;
 
                $logEntry = new ManualLogEntry( 'move', $logType );
                $logEntry->setPerformer( $wgUser );