Merge "Declare dynamic properties"
[lhc/web/wiklou.git] / includes / page / ImagePage.php
index 2e43e8c..bb15532 100644 (file)
@@ -27,6 +27,9 @@ use Wikimedia\Rdbms\ResultWrapper;
  * Class for viewing MediaWiki file description pages
  *
  * @ingroup Media
+ *
+ * @property WikiFilePage $mPage Set by overwritten newPage() in this class
+ * @method WikiFilePage getPage()
  */
 class ImagePage extends Article {
        /** @var File|false */
@@ -41,11 +44,6 @@ class ImagePage extends Article {
        /** @var bool */
        protected $mExtraDescription = false;
 
-       /**
-        * @var WikiFilePage
-        */
-       protected $mPage;
-
        /**
         * @param Title $title
         * @return WikiFilePage
@@ -605,7 +603,10 @@ EOT
                                );
                        }
 
-                       if ( $wgEnableUploads && $user->isAllowed( 'upload' ) ) {
+                       if ( $wgEnableUploads && MediaWikiServices::getInstance()
+                                       ->getPermissionManager()
+                                       ->userHasRight( $user, 'upload' )
+                       ) {
                                // Only show an upload link if the user can upload
                                $uploadTitle = SpecialPage::getTitleFor( 'Upload' );
                                $nofile = [
@@ -989,6 +990,7 @@ EOT
                        parent::delete();
                        return;
                }
+               '@phan-var LocalFile $file';
 
                $deleter = new FileDeleteForm( $file );
                $deleter->execute();