Advertisement
Guest User

Untitled

a guest
May 27th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. # This is a script to identify pages with identical (but differently cased) names in the main namespace
  2. # It's intended to be used before changing the mediawiki namespace to a case-insensitive collation
  3. #
  4. # Usage : ./find_wiki_dups.sh <database name> <namespace id> <URL path to wiki pages>
  5.  
  6. DBNAME=$1
  7. NAMESPACE=$2
  8. URL=$3
  9.  
  10. #!/bin/bash
  11. for page in `mysql $DBNAME -s -N -e "select page_title from mediawiki_page where page_namespace=$NAMESPACE group by lower(page_title) having count(lower(page_title)) > 1 order by page_touched asc;"`
  12. do
  13. echo "DUP FOUND [$page] - Bottom one is the more recent"
  14. for dup in `mysql $DBNAME -s -N -e "select page_title from mediawiki_page where lower(page_title) = lower('$page')order by page_touched asc;"`
  15. do
  16. echo "$URL?title=$dup&action=delete"
  17. done
  18.  
  19. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement