Merge "User: Avoid deprecated Linker::link()"
[lhc/web/wiklou.git] / includes / filerepo / file / LocalFile.php
index a90156f..a412250 100644 (file)
@@ -593,7 +593,7 @@ class LocalFile extends File {
                if ( $upgrade ) {
                        $this->upgrading = true;
                        // Defer updates unless in auto-commit CLI mode
-                       DeferredUpdates::addCallableUpdate( function() {
+                       DeferredUpdates::addCallableUpdate( function () {
                                $this->upgrading = false; // avoid duplicate updates
                                try {
                                        $this->upgradeRow();
@@ -716,6 +716,11 @@ class LocalFile extends File {
         * @return int
         */
        public function getWidth( $page = 1 ) {
+               $page = (int)$page;
+               if ( $page < 1 ) {
+                       $page = 1;
+               }
+
                $this->load();
 
                if ( $this->isMultipage() ) {
@@ -743,6 +748,11 @@ class LocalFile extends File {
         * @return int
         */
        public function getHeight( $page = 1 ) {
+               $page = (int)$page;
+               if ( $page < 1 ) {
+                       $page = 1;
+               }
+
                $this->load();
 
                if ( $this->isMultipage() ) {
@@ -1206,9 +1216,7 @@ class LocalFile extends File {
                                $metadata = [];
                        }
 
-                       $options['headers'] = $handler->getContentHeaders(
-                               $metadata, $props['width'], $props['height']
-                       );
+                       $options['headers'] = $handler->getContentHeaders( $metadata );
                } else {
                        $options['headers'] = [];
                }