ref: 4138bf3cc011ad73282550d2f3afa78d91131199
dir: /handlers/get-article-by-uuid/
#!/bin/rc
. log.rc
group_name=$1
article_uuid=$2
if (~ $group_name '' || ~ $article_uuid '')
exit 500
group_path=`{echo -n $group_name | sed 's/\./\//'}
group_path=$news/$group_path
for (article_path in `{walk -f $group_path}) {
article_found=`{cat $article_path | \
gunzip | \
grep -i 'message-id: ' | \
grep $article_uuid }
if (! ~ $article_found '') {
article_id=`{basename $article_path}
echo $article_id
exit
}
}
exit 430