Test only against protection for deleting
[lhc/web/wiklou.git] / includes / Title.php
index 8e06087..c73550f 100644 (file)
@@ -2258,6 +2258,16 @@ class Title {
                                $errors[] = array( 'immobile-target-page' );
                        }
                } elseif ( $action == 'delete' ) {
+                       $tempErrors = $this->checkPageRestrictions( 'edit',
+                               $user, array(), $doExpensiveQueries, true );
+                       if( !$tempErrors ) {
+                               $tempErrors = $this->checkCascadingSourcesRestrictions( 'edit',
+                                       $user, $tempErrors, $doExpensiveQueries, true );
+                       }
+                       if ( $tempErrors ) {
+                               // If protection keeps them from editing, they shouldn't be able to delete.
+                               $errors[] = array( 'deleteprotected' );
+                       }
                        if ( $doExpensiveQueries && $wgDeleteRevisionsLimit
                                && !$this->userCan( 'bigdelete', $user ) && $this->isBigDeletion()
                        ) {