From 45d4ffe847d5bc39b58d758d4b8cedd32bb49791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 4 Nov 2023 19:30:54 +0100 Subject: [PATCH] mediawiki: fix api --- ...Stream-write-add-missing-return-type.patch | 2 +- .../0002-StringStream-add-missing-types.patch | 113 ++++++++++++++++++ modules/nixos-wiki/default.nix | 5 +- 3 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 modules/nixos-wiki/0002-StringStream-add-missing-types.patch diff --git a/modules/nixos-wiki/0001-MWCallbackStream-write-add-missing-return-type.patch b/modules/nixos-wiki/0001-MWCallbackStream-write-add-missing-return-type.patch index 6f6da2f..c55d1e5 100644 --- a/modules/nixos-wiki/0001-MWCallbackStream-write-add-missing-return-type.patch +++ b/modules/nixos-wiki/0001-MWCallbackStream-write-add-missing-return-type.patch @@ -1,7 +1,7 @@ From c88ac02c0ef24025f00d359e0bec96dbf2583357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 4 Nov 2023 18:28:03 +0000 -Subject: [PATCH] MWCallbackStream::write: add missing return type +Subject: [PATCH 1/2] MWCallbackStream::write: add missing return type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/modules/nixos-wiki/0002-StringStream-add-missing-types.patch b/modules/nixos-wiki/0002-StringStream-add-missing-types.patch new file mode 100644 index 0000000..884e9da --- /dev/null +++ b/modules/nixos-wiki/0002-StringStream-add-missing-types.patch @@ -0,0 +1,113 @@ +From fb19bb8089981c5fc56c9532f5ab19bde98446aa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= +Date: Sat, 4 Nov 2023 18:39:57 +0000 +Subject: [PATCH 2/2] StringStream: add missing types +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Jörg Thalheim +--- + includes/Rest/StringStream.php | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +diff --git a/includes/Rest/StringStream.php b/includes/Rest/StringStream.php +index bd7295c28b5..1131dfa8d0c 100644 +--- a/includes/Rest/StringStream.php ++++ b/includes/Rest/StringStream.php +@@ -36,34 +36,34 @@ public function copyToStream( $stream ) { + fwrite( $stream, $this->getContents() ); + } + +- public function __toString() { ++ public function __toString(): string { + return $this->contents; + } + +- public function close() { ++ public function close(): void { + } + + public function detach() { + return null; + } + +- public function getSize() { ++ public function getSize(): ?int { + return strlen( $this->contents ); + } + +- public function tell() { ++ public function tell(): int { + return $this->offset; + } + +- public function eof() { ++ public function eof(): bool { + return $this->offset >= strlen( $this->contents ); + } + +- public function isSeekable() { ++ public function isSeekable(): bool { + return true; + } + +- public function seek( $offset, $whence = SEEK_SET ) { ++ public function seek( int $offset, int $whence = SEEK_SET ): void { + switch ( $whence ) { + case SEEK_SET: + $this->offset = $offset; +@@ -88,15 +88,15 @@ public function seek( $offset, $whence = SEEK_SET ) { + } + } + +- public function rewind() { ++ public function rewind(): void { + $this->offset = 0; + } + +- public function isWritable() { ++ public function isWritable(): bool { + return true; + } + +- public function write( $string ) { ++ public function write( string $string ): int { + if ( $this->offset === strlen( $this->contents ) ) { + $this->contents .= $string; + } else { +@@ -107,11 +107,11 @@ public function write( $string ) { + return strlen( $string ); + } + +- public function isReadable() { ++ public function isReadable(): bool { + return true; + } + +- public function read( $length ) { ++ public function read( int $length ): string { + if ( $this->offset === 0 && $length >= strlen( $this->contents ) ) { + $ret = $this->contents; + } elseif ( $this->offset >= strlen( $this->contents ) ) { +@@ -123,7 +123,7 @@ public function read( $length ) { + return $ret; + } + +- public function getContents() { ++ public function getContents() : string { + if ( $this->offset === 0 ) { + $ret = $this->contents; + } elseif ( $this->offset >= strlen( $this->contents ) ) { +@@ -135,7 +135,7 @@ public function getContents() { + return $ret; + } + +- public function getMetadata( $key = null ) { ++ public function getMetadata( ?string $key = null ) { + return null; + } + } +-- +2.42.0 + diff --git a/modules/nixos-wiki/default.nix b/modules/nixos-wiki/default.nix index b10e03e..1436bc1 100644 --- a/modules/nixos-wiki/default.nix +++ b/modules/nixos-wiki/default.nix @@ -24,7 +24,10 @@ uploadsDir = "/var/lib/mediawiki-uploads/"; passwordFile = config.sops.secrets."nixos-wiki".path; package = pkgs.mediawiki.overrideAttrs (old: { - patches = [ ./0001-MWCallbackStream-write-add-missing-return-type.patch ]; + patches = [ + ./0001-MWCallbackStream-write-add-missing-return-type.patch + ./0002-StringStream-add-missing-types.patch + ]; }); extensions.SyntaxHighlight_GeSHi = null; # provides tags