Skip to content

Commit

Permalink
nixos/mediawiki: change user in maintenance scripts, use maintenance/…
Browse files Browse the repository at this point in the history
…run.php script, add deleteUserEmail,importDump,run scripts

script initially copied from nextcloud and run with run.php as requested by this big warning:

*******************************************************************************
NOTE: Do not run maintenance scripts directly, use maintenance/run.php instead!
      Running scripts directly has been deprecated in MediaWiki 1.40.
      It may not work for some (or any) scripts in the future.
*******************************************************************************

(cherry picked from commit 7c1f9a0)
  • Loading branch information
SuperSandro2000 authored and github-actions[bot] committed Dec 25, 2024
1 parent 7b29fc1 commit 6802c42
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions nixos/modules/services/web-apps/mediawiki.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,26 @@ let
preferLocalBuild = true;
} ''
mkdir -p $out/bin
for i in changePassword.php createAndPromote.php resetUserEmail.php userOptions.php edit.php nukePage.php update.php; do
makeWrapper ${php}/bin/php $out/bin/mediawiki-$(basename $i .php) \
--set MEDIAWIKI_CONFIG ${mediawikiConfig} \
--add-flags ${pkg}/share/mediawiki/maintenance/$i
makeWrapper ${php}/bin/php $out/bin/mediawiki-maintenance \
--set MEDIAWIKI_CONFIG ${mediawikiConfig} \
--add-flags ${pkg}/share/mediawiki/maintenance/run.php
for i in changePassword createAndPromote deleteUserEmail resetUserEmail userOptions edit nukePage update importDump run; do
script="$out/bin/mediawiki-$i"
cat <<'EOF' >"$script"
#!${pkgs.runtimeShell}
become=(exec)
if [[ "$(id -u)" != ${user} ]]; then
become=(exec /run/wrappers/bin/sudo -u ${user} --)
fi
"${"$"}{become[@]}" ${placeholder "out"}/bin/mediawiki-maintenance \
EOF
if [[ "$i" != "run" ]]; then
echo " ${pkg}/share/mediawiki/maintenance/$i.php \"\$@\"" >>"$script"
else
echo " ${pkg}/share/mediawiki/maintenance/\$1.php \"\''${@:2}\"" >>"$script"
fi
chmod +x "$script"
done
'';

Expand Down

0 comments on commit 6802c42

Please sign in to comment.