Merge "Use camel case for variable names in Article.php"
[lhc/web/wiklou.git] / includes / Title.php
index 2481178..a1b2352 100644 (file)
@@ -74,6 +74,9 @@ class Title {
        /** @var string Interwiki prefix */
        public $mInterwiki = '';
 
+       /** @var bool Was this Title created from a string with a local interwiki prefix? */
+       private $mLocalInterwiki = false;
+
        /** @var string Title fragment (i.e. the bit after the #) */
        public $mFragment = '';
 
@@ -823,6 +826,15 @@ class Title {
                return $this->mInterwiki;
        }
 
+       /**
+        * Was this a local interwiki link?
+        *
+        * @return bool
+        */
+       public function wasLocalInterwiki() {
+               return $this->mLocalInterwiki;
+       }
+
        /**
         * Determine whether the object refers to a page within
         * this project and is transcludable.
@@ -2246,6 +2258,12 @@ class Title {
                                $errors[] = array( 'immobile-target-page' );
                        }
                } elseif ( $action == 'delete' ) {
+                       if ( count( $this->getUserPermissionsErrorsInternal( 'edit',
+                               $user, $doExpensiveQueries, true ) )
+                       ) {
+                               // If they can't edit, they shouldn't delete.
+                               $errors[] = array( 'delete-cantedit' );
+                       }
                        if ( $doExpensiveQueries && $wgDeleteRevisionsLimit
                                && !$this->userCan( 'bigdelete', $user ) && $this->isBigDeletion()
                        ) {
@@ -3291,6 +3309,7 @@ class Title {
                # Fill fields
                $this->setFragment( '#' . $parts['fragment'] );
                $this->mInterwiki = $parts['interwiki'];
+               $this->mLocalInterwiki = $parts['local_interwiki'];
                $this->mNamespace = $parts['namespace'];
                $this->mUserCaseDBKey = $parts['user_case_dbkey'];