Page MenuHomeMiraheze

mass use assignImportedEdits.php with bash script and two lists of users

Authored By
Reception123
Jan 19 2023, 13:02
Size
1 KB
Referenced Files
None
Subscribers
None

mass use assignImportedEdits.php with bash script and two lists of users

#!/bin/bash
# Set the path to the assignImportedEdits.php script
script_path="/srv/mediawiki/w/extensions/MirahezeMagic/maintenance/assignImportedEdits.php"
# Set the path to the "from" usernames list
from_list="/home/reception/from_usernames.txt"
# Set the path to the "to" usernames list
to_list="/home/reception/to_usernames.txt"
# Read the "from" usernames into an array
IFS=$'\n' read -d '' -r -a from_usernames < $from_list
# Read the "to" usernames into an array
IFS=$'\n' read -d '' -r -a to_usernames < $to_list
# Loop through the "from" usernames array
for ((i=0; i<${#from_usernames[@]}; i++)); do
from_username=${from_usernames[i]}
# Check if the "from" username contains an "&" character
if [[ $from_username == *"&"* ]]; then
# Split the "from" username on the "&" character
IFS='&' read -ra usernames <<< "$from_username"
# Loop through the split "from" usernames
for username in "${usernames[@]}"; do
to_username=${to_usernames[i]}
sudo -u www-data php $script_path --from $username --to $to_username --wiki hangoverswiki --no-run
done
else
to_username=${to_usernames[i]}
sudo -u www-data php $script_path --from $from_username --to $to_username --wiki hangoverswiki --no-run
fi
done

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
282975
Default Alt Text
mass use assignImportedEdits.php with bash script and two lists of users (1 KB)

Event Timeline