Download og udpak Atalssian CLI fra https://studio.plugins.atlassian.com/wiki/display/ACLI/Atlassian+Command+Line+Interface
Opsæt confluence.sh med username, password og url
Exporter fra Joomla's MySQL
Det er meget vigtigt at begge exports bruger samme ORDER BY, for at matche rækker
Først exporteres alt body (introtext) til en fil via
select introtext from jos_content where catid=7 order by created,id
Derefter oprettet dato ogtitel (created,title)
select created,title from jos_content where catid=7 order by created,id
Indholdet af de 2 filer skal nu ind i Confluence....
Importer i Confluence
Script 1 til oprettelse af Blog Posts:
IFS=$(echo -en "\n\b") x=0 for text in `cat introtext.csv` do text=$(echo "$text"|sed 's/\"\"/\"/g') #Transform text #Put a slash before image text=$(echo "$text"|sed 's/\images/\/images/g') #Remove old thumbs text=$(echo "$text"|sed 's/images\/thumbs/images/g') #Remove first quote text=$(echo "$text"| cut -c2-) #Remove last quote text=$(echo "$text"|sed -e 's/.$//g') #Correct Images text=$(echo "$text"|sed -e 's/_w//g') text=$(echo "$text"|sed -e 's/_JPG.jpg/.jpg/g') #Remove paragraph tags text=$(echo "$text"|sed -e 's/<p>//g') text=$(echo "$text"|sed -e 's/<\/p>//g') #Remove DIV tags text=$(echo "$text"|sed 's/<div class=[A-Za-z0-9]*>//g') text=$(echo "$text"|sed 's/<div>//g') text=$(echo "$text"|sed 's/<\/div>//g') #Replace img with wiki markup #text=$(echo "$text"|sed 's/\"image//image/g') #text=$(echo "$text"|sed 's/<src //image/g') echo $text x=$(( $x + 1 )) echo $x ./confluence.sh --action addNews --space "familieblog" --title "Nyhed $x" --content "{html}$text{html}" done
Opdatering af content ved inject direkte i MySQL databasen:
x er den første side der skal opdateres
IFS=$(echo -en "\n\b") x=2686981 for text in `cat created_title.csv` do #Remove illegal chars in title text=$(echo "$text"|sed 's/\"//g') text=$(echo "$text"|sed "s/'/\\\'/g") text=$(echo "$text"|sed "s/\//-/g") text=$(echo "$text"|sed "s/?//g") text=$(echo "$text"|sed "s/@/(at)/g") cdate=$(echo $text | awk -F',' '{ print $1 }' ) title=$(echo $text | awk -F',' '{ print $2 }' ) sql="update CONTENT set title='$title',creationdate='$cdate',lastmoddate='$cdate' where contentid=$x" echo $sql echo "SET NAMES 'utf8';$sql" > /tmp/insert.sql mysql --user=cadmin --password=******* confluence < /tmp/insert.sql rm /tmp/insert.sql x=$(( $x + 1 )) done