Page MenuHomePhabricator
Paste P35183

check_T312256.sh
ActivePublic

Authored by Deniz_WMDE on Sep 29 2022, 3:33 PM.
Tags
None
Referenced Files
F35540060: check_T312256.sh
Sep 29 2022, 3:33 PM
Subscribers
None
#!/bin/bash
# A small test to see if a wikibase.cloud wiki is affected by this problem https://phabricator.wikimedia.org/T312256
# based on https://github.com/wbstack/mediawiki/pull/275#issuecomment-1231626832
#
# input parameter: wiki url
#
# no output means the query didn't find any problematic values
set -euo pipefail
WIKI="$1"
RESULT=$(curl -s "https://$WIKI/query/sparql?query=SELECT%20%3Fitem%20WHERE%20%7B%0A%20%20%3Fproperty%20wikibase%3ApropertyType%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23Quantity%3E%20.%0A%20%20%3Fproperty%20wikibase%3AdirectClaim%20%3FdirectProperty%20.%0A%20%20%3Fitem%20%3FdirectProperty%20%3Fo%20.%0A%20%20%3Fvaluenode%20%20%20%20%20wikibase%3AquantityUnit%20%20%20%20%20%3Funit.%0A%20%20FILTER(CONTAINS(STR(%3Funit)%2C%20%22.wiki.opencura.com%22))%0A%7D%20LIMIT%2010")
CHECK=$(echo "$RESULT" | grep "<binding name='item'>")
if [[ ! -z "$CHECK" ]]; then
echo "$WIKI is affected"
fi