Page MenuHomePhabricator
Authored By
mmodell
Feb 10 2020, 11:27 PM
Size
1 KB
Referenced Files
None
Subscribers
None
#!/bin/bash
arc="arc call-conduit --conduit-uri https://phabricator.wikimedia.org/"
BASENAME=$0
BASENAME=$(basename $BASENAME)
if [ "$1" == "" ]
then
echo "$BASENAME: Mark all uris for a given repository as read-only."
echo ""
echo "Usage: $BASENAME repo-name"
exit 1
fi
QUERY="{ \"constraints\": { \"shortNames\" : [ \"$1\" ] }, \"attachments\": { \"uris\": true } } "
#echo $QUERY
JSON=$($arc diffusion.repository.search <<< "$QUERY")
IDS=$(jq -j '[.response.data[].attachments.uris.uris[] | select( .fields.io.raw == "readwrite") | .id] | join(" ")' <<< "$JSON")
URIS=$(jq -r '.response.data[].attachments.uris.uris[] | select( .fields.io.raw == "readwrite") | [.id, .fields.uri.normalized ]|join(": ")' <<< "$JSON")
echo "Found the following writable URIs:"
echo "$URIS"
read -p "Mark these URIs read-only? " -n 1
if [[ $REPLY =~ ^[Yy]$ ]]
then
set -e
for ID in $IDS
do
echo "Marking URI $ID read-only"
$arc diffusion.uri.edit << EOF
{
"transactions": [
{ "type": "io", "value": "read" }
], "objectIdentifier": "$ID"
}
EOF
done
fi

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8314923
Default Alt Text
raw.txt (1 KB)

Event Timeline