aboutsummaryrefslogtreecommitdiff
path: root/modules/pkgs/mediawiki
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2016-09-29 13:51:44 +0300
committerIgor Pashev <pashev.igor@gmail.com>2016-09-29 13:51:44 +0300
commit62f28d30a069135f9c48678507203958adfc334f (patch)
tree7f38af0c8d3f445ee8cc50906a639baec7011127 /modules/pkgs/mediawiki
parent1af9e6589bdd18e6ba7eeabf073aa7d710020cdd (diff)
downloadnixsap-62f28d30a069135f9c48678507203958adfc334f.tar.gz
Moved everything into ./modules
Diffstat (limited to 'modules/pkgs/mediawiki')
-rw-r--r--modules/pkgs/mediawiki/T122487.patch16
-rw-r--r--modules/pkgs/mediawiki/default.nix59
-rw-r--r--modules/pkgs/mediawiki/file-backend-default-mode.patch52
3 files changed, 127 insertions, 0 deletions
diff --git a/modules/pkgs/mediawiki/T122487.patch b/modules/pkgs/mediawiki/T122487.patch
new file mode 100644
index 0000000..7b868a8
--- /dev/null
+++ b/modules/pkgs/mediawiki/T122487.patch
@@ -0,0 +1,16 @@
+Description: fix warning on upload page
+Bug: https://phabricator.wikimedia.org/T122487
+Index: mediawiki-1.23.13/includes/User.php
+===================================================================
+--- mediawiki-1.23.13.orig/includes/User.php
++++ mediawiki-1.23.13/includes/User.php
+@@ -3806,6 +3806,9 @@ class User {
+ * @return boolean: Whether the token matches
+ */
+ public function matchEditToken( $val, $salt = '', $request = null ) {
++ if ($val === null) {
++ return false;
++ }
+ $sessionToken = $this->getEditToken( $salt, $request );
+ $equals = hash_equals( $sessionToken, $val );
+ if ( !$equals ) {
diff --git a/modules/pkgs/mediawiki/default.nix b/modules/pkgs/mediawiki/default.nix
new file mode 100644
index 0000000..ef606f0
--- /dev/null
+++ b/modules/pkgs/mediawiki/default.nix
@@ -0,0 +1,59 @@
+{ lib, pkgs }:
+
+let
+ inherit (builtins) elemAt;
+ inherit (lib) splitString concatMapStrings;
+
+ bundled = [
+ "Cite" "ConfirmEdit" "Gadgets" "ImageMap" "InputBox" "Interwiki"
+ "LocalisationUpdate" "Nuke" "ParserFunctions" "PdfHandler" "Poem"
+ "Renameuser" "SpamBlacklist" "SyntaxHighlight_GeSHi" "TitleBlacklist"
+ "WikiEditor"
+ ];
+
+in pkgs.stdenv.mkDerivation rec {
+ version = "1.23.13";
+ name = "mediawiki-${version}";
+
+ src = let
+ v = splitString "." version;
+ minor = "${elemAt v 0}.${elemAt v 1}";
+ in pkgs.fetchurl {
+ url = "https://releases.wikimedia.org/mediawiki/${minor}/${name}.tar.gz";
+ sha256 = "168wpf53n4ksj2g5q5r0hxapx6238dvsfng5ff9ixk6axsn0j5d0";
+ };
+
+ patches = [
+ ./T122487.patch
+ ./file-backend-default-mode.patch
+ ];
+
+ outputs = [ "out" ] ++ bundled;
+
+ installPhase = ''
+ cp -a . $out
+
+ rm -rf $out/tests
+ rm -rf $out/mw-config
+ rm -rf $out/maintenance/dev
+ rm -rf $out/maintenance/hiphop
+
+ sed -i \
+ -e 's|/bin/bash|${pkgs.bash}/bin/bash|g' \
+ -e 's|/usr/bin/timeout|${pkgs.coreutils}/bin/timeout|g' \
+ $out/includes/limit.sh \
+ $out/includes/GlobalFunctions.php
+
+ cat <<'EOF' > $out/LocalSettings.php
+ <?php
+ if (isset($_ENV['MEDIAWIKI_LOCAL_SETTINGS'])) {
+ require_once ($_ENV['MEDIAWIKI_LOCAL_SETTINGS']);
+ };
+ ?>
+ EOF
+
+ ${concatMapStrings (e: ''
+ mv $out/extensions/${e} ''${${e}}
+ '') bundled}
+ '';
+}
diff --git a/modules/pkgs/mediawiki/file-backend-default-mode.patch b/modules/pkgs/mediawiki/file-backend-default-mode.patch
new file mode 100644
index 0000000..2bd303c
--- /dev/null
+++ b/modules/pkgs/mediawiki/file-backend-default-mode.patch
@@ -0,0 +1,52 @@
+Index: mediawiki-1.23.13/includes/DefaultSettings.php
+===================================================================
+--- mediawiki-1.23.13.orig/includes/DefaultSettings.php
++++ mediawiki-1.23.13/includes/DefaultSettings.php
+@@ -429,7 +429,7 @@ $wgImgAuthUrlPathMap = array();
+ * leave the paths in unchanged, or 'simple' to replace paths with
+ * placeholders. Default for LocalRepo is 'simple'.
+ * - fileMode This allows wikis to set the file mode when uploading/moving files. Default
+- * is 0644.
++ * is 0640.
+ * - directory The local filesystem directory where public files are stored. Not used for
+ * some remote repos.
+ * - thumbDir The base thumbnail directory. Defaults to "<directory>/thumb".
+Index: mediawiki-1.23.13/includes/filerepo/FSRepo.php
+===================================================================
+--- mediawiki-1.23.13.orig/includes/filerepo/FSRepo.php
++++ mediawiki-1.23.13/includes/filerepo/FSRepo.php
+@@ -50,7 +50,7 @@ class FSRepo extends FileRepo {
+ : "{$directory}/transcoded";
+ $fileMode = isset( $info['fileMode'] )
+ ? $info['fileMode']
+- : 0644;
++ : 0640;
+
+ $repoName = $info['name'];
+ // Get the FS backend configuration
+Index: mediawiki-1.23.13/includes/filebackend/FSFileBackend.php
+===================================================================
+--- mediawiki-1.23.13.orig/includes/filebackend/FSFileBackend.php
++++ mediawiki-1.23.13/includes/filebackend/FSFileBackend.php
+@@ -82,7 +82,7 @@ class FSFileBackend extends FileBackendS
+ }
+ }
+
+- $this->fileMode = isset( $config['fileMode'] ) ? $config['fileMode'] : 0644;
++ $this->fileMode = isset( $config['fileMode'] ) ? $config['fileMode'] : 0640;
+ if ( isset( $config['fileOwner'] ) && function_exists( 'posix_getuid' ) ) {
+ $this->fileOwner = $config['fileOwner'];
+ $info = posix_getpwuid( posix_getuid() );
+Index: mediawiki-1.23.13/includes/filebackend/FileBackendGroup.php
+===================================================================
+--- mediawiki-1.23.13.orig/includes/filebackend/FileBackendGroup.php
++++ mediawiki-1.23.13/includes/filebackend/FileBackendGroup.php
+@@ -88,7 +88,7 @@ class FileBackendGroup {
+ : "{$directory}/transcoded";
+ $fileMode = isset( $info['fileMode'] )
+ ? $info['fileMode']
+- : 0644;
++ : 0640;
+ // Get the FS backend configuration
+ $autoBackends[] = array(
+ 'name' => $backendName,