## page was renamed from MoinMoin <> = MoinMoin = MoinMoin is an advanced, easy to use and extensible WikiEngine with a large community of users. Said in a few words, it is about collaboration on easily editable web pages. http://moinmo.in/ File list: * http://static.moinmo.in/files/ == MoinMoin backup wiki pages == Run the following commands {{{#!highlight sh yum install mutt #install as superuser, required to attach files with the mail su moin cd /home/moin/moin-1.9.7 vim backupWiki.sh }}} {{{#!highlight bash #!/bin/sh BACKUPFOLDER=/home/moin/moin-1.9.7/backups DATAFOLDER=/home/moin/moin-1.9.7/wiki/data/pages CURRDATE=`date -u "+%Y-%m-%dT%H:%m:%S.%Z"` SUBJECT="MoinMoin Backup" BODY="Backup from Wiki MoinMoin" MAILDESTINATION=xpto@example.org FILE=$BACKUPFOLDER/backup$CURRDATE.tar.gz #create backup folder mkdir -p $BACKUPFOLDER #compress the file with the current data tar cvzf $FILE $DATAFOLDER #sends the mail with attached file echo $BODY | mutt -a "$FILE" -s "$SUBJECT" -- $MAILDESTINATION }}} Set a cron job as user moin, to send the backup daily: {{{#!highlight sh crontab -e @daily /home/moin/moin-1.9.7/backupWiki.sh }}} == MoinMoin Default theme == MoinMoin has several default themes which are: * classic * modern * modernized * modernized_cms * rightsidebar To change the default theme edit the file '''/home/moin/moin-1.9.7/wikiconfig.py''' and change the variable theme_default. {{{#!highlight python #theme_default=u'classic' #theme_default=u'modern' #theme_default=u'modernized' theme_default=u'modernized_cms' #theme_default=u'rightsidebar' }}} == MoinMoin Init Script == Init script to start MoinMoin on RHEL 6.4 and CentOS 6.4. File is located in '''/etc/init.d/moinmoin'''. To register the service the command '''chkconfig --add moinmoin''' must be runned. Run '''chkconfig moinmoin on'''. To start run '''service moinmoin start'''. To stop run '''service moinmoin stop'''. To get status run '''service moinmoin status'''. To restart '''service moinmoin restart'''. File content: {{{#!highlight bash #!/bin/sh # chkconfig: 345 99 99 # description: Starts and stops the MoinMoin wiki process USER=moin PROG="wikiserver" PROGPATH=/home/moin/moin-1.9.7/wikiserver.py PIDFILE="/tmp/moin.pid" PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin" LOG=/home/moin/moin-1.9.7/log.txt start(){ echo "Start called" su $USER -c $PROGPATH >> $LOG 2>&1 & /bin/sleep 2 PID=`ps uax| grep python | grep $PROG | grep $USER | awk '{print $2}'` echo "Program PID: $PID" echo "$PID" > $PIDFILE } status(){ PID=`cat $PIDFILE` echo "Running with PID: $PID" } stop(){ echo "Stop called" PID=`cat $PIDFILE` echo "PID to kill $PID" kill -9 $PID rm $PIDFILE } # switch case "$1" in start) start ;; status) status ;; stop) stop ;; restart) stop start ;; *) echo "moinmoin start|status|stop|restart" exit 1 ;; esac }}} == MoinMoin to listen on all interfaces and use port 80 == Edit the file '''/home/moin/moin-1.9.7/wikiserverconfig.py''' . Change the hostname to '' and port to 80. {{{#!highlight python hostname = '' port = 80 }}} After the file is changed restart MoinMoin with '''service moinmoin restart'''. == MoinMoin Navigation Bar == To change the available Moin Moin navigation bar open the file '''/home/moin/moin-1.9.7/wikiconfig.py''' . Add or replace the variable '''navi_bar ''' with an array of the Wiki pages that should appear, inside the Python class LocalConfig. {{{#!highlight python navi_bar =[u'Wiki',u'SiteMap'] }}} After the file is changed restart MoinMoin with '''service moinmoin restart'''. == MoinMoin Sitemap Update == Shell script to update an Ad-Hoc Sitemap periodically. MoinMoin "filesystem power" !!!! Run the following commands: {{{#!highlight sh su moin cd /home/moin/moin-1.9.7 vim sitemap.sh }}} Fill '''sitemap.sh''' file with the following: {{{#!highlight bash #!/bin/sh WIKIPAGESLOCATION=/home/moin/moin-1.9.11/wiki/data/pages SITEMAP=$WIKIPAGESLOCATION/Sitemap/revisions/00000001 #create directories for Sitemap wiki page mkdir -p $WIKIPAGESLOCATION/Sitemap mkdir -p $WIKIPAGESLOCATION/Sitemap/revisions # sets the current page revision echo "00000001" > $WIKIPAGESLOCATION/Sitemap/current # find files with name current. current exists in "live" wiki pages find $WIKIPAGESLOCATION -name "current" > $SITEMAP #replace /current by empty string sed -i 's/\/current/]]/' $SITEMAP # replace ./wiki/data/pages by empty string sed -i 's/\/home\/moin\/moin-1.9.11\/wiki\/data\/pages\// * [[/' $SITEMAP # replace wiki/underlay/pages by empty string sed -i 's/\/home\/moin\/moin-1.9.11\/wiki\/underlay\/pages\// * [[/' $SITEMAP # replace 0x2f by / sed -i 's/(2f)/\//g' $SITEMAP # replace 0x2e by . sed -i 's/(2e)/./g' $SITEMAP sed -i 's/(20)/\ /g' $SITEMAP #sorts the pages by name sort $SITEMAP -o $SITEMAP #CURRDATE=`date` #echo $CURRDATE #add text at top, Sitemap with heading 1 sed -i '1s/^/= Sitemap =\n/' $SITEMAP }}} Set a cron job with: {{{#!highlight sh crontab -e * * * * * /home/moin/moin-1.9.11/sitemap.sh }}} Set the script as executable and setup the ownership {{{#!highlight sh chmod 755 sitemap.sh chown moin sitemap.sh chgrp moin sitemap.sh }}} The sitemap will be updated every minute. == Markup == {{{{ = Level 1 = == Level 2 == === Level 3 === ==== Level 4 ==== ===== Level 5 ===== ====== Level 6 ====== '''Bold Text''' ''Italic'' {{{#!highlight python Code }}} [[ItemName]] [[ItemName|Named Item]] [[https://moinmo.in/]] [[https://moinmo.in/|MoinMoin Wiki]] {{https://static.moinmo.in/logos/moinmoin.png}} # comment * item 1 * item 2 (preceding white space) * item 2.1 * item 2.1.1 ||Head A ||Head B ||Head C || ============================= ||a ||b ||c || ||x ||y ||z || }}}} == Cleanup pages without current or revisions == * cleanup_bad_moinmoin_pages.py * cd /home/moin/moin-1.9.7/ {{{#!highlight python #!/usr/bin/python """ python cleanup_bad_moinmoin_pages.py > res.sh """ import os for root, dirs, files in os.walk("./wiki/data/pages", topdown=False): for name in files: if name.endswith("edit-log"): name = name.replace("edit-log","current") fullname = os.path.join(root, name) try: os.stat( fullname ) except Exception as ex: print "rm -rf \"%s\""%( fullname.replace("/current","") ) }}} == Install memodump theme - twitter bootstrap == * https://github.com/dossist/moinmoin-memodump {{{#!highlight bash git clone https://github.com/dossist/moinmoin-memodump.git sudo bash cd moinmoin-memodump/ cp memodump.py /home/moin/moin-1.9.7/wiki/data/plugin/theme/ cd /home/moin/moin-1.9.7/MoinMoin/web/static/htdocs cp /home/userx/moinmoin-memodump/memodump -R . chgrp www-data * -R chown moin * -R cd /home/moin/moin-1.9.7/wiki/data/plugin/theme/ chgrp www-data * -R chown moin * -R # Edit wikiconfig.py to change theme_default. # theme_default = 'memodump' cd /home/moin/moin-1.9.7 vi wikiconfig.py chgrp www-data wikiconfig.py chown moin wikiconfig.py service apache2 restart }}} == Log page edits == Change action '''MoinMoin/action/edit.py''' with syslog to log the user that is editing a page. * tail /var/log/syslog {{{#!highlight python import syslog def execute(...) syslog.syslog(syslog.LOG_INFO, "MoinMoin edit request: %s "%( str(request.user) ) ) }}} == Quick setup == {{{#!highlight bash cd ~/tmp wget https://github.com/moinwiki/moin-1.9/releases/download/1.9.11/moin-1.9.11.tar.gz tar xvzf moin-1.9.11.tar.gz cd moin-1.9.11/ vi wikiconfig.py # superuser=[u"userx"] # page_front_page = u'FrontPage' # acl_rights_default = u"userx:read,write,delete,revert,admin All:read" python2.7 wikiserver.py # http://localhost:8080/ #?action=newaccount #user: userx #pwd: ???????? (use secure pass) #email: userx@gmail.com http://localhost:8080/FrontPage }}}