Difference between revisions of "Collections"

From Freephile Wiki
Jump to navigation Jump to search
(corrected typo - user is outside the command string)
Line 3: Line 3:
 
Books (Collections is the formal software name, Books is the more User-friendly feature name) allows you to export any content you want from the wiki into formats more suitable for offline reading, sharing, printing etc.
 
Books (Collections is the formal software name, Books is the more User-friendly feature name) allows you to export any content you want from the wiki into formats more suitable for offline reading, sharing, printing etc.
  
Books is a feature of this wiki, added by [[mw:Extension:Collection]] which in turn relies on a host of other goodies such as Python's [http://pypi.python.org/pypi/setuptools setuptools], [http://pythonware.com/products/pil/ Imaging Library], and a whole render server which is supplied by PediaPress.
+
Books is a feature of this wiki, added by [[mw:Extension:Collection]] which in turn relies on a host of other goodies such as Python's [http://pypi.python.org/pypi/setuptools setuptools], [http://pythonware.com/products/pil/ Imaging Library]<ref>sudo yum install python-imaging or sudo apt-get install python-imaging should do the trick, but make sure you have a proper python</ref>, and a whole render server which is supplied by PediaPress. Because of the Python dependencies, you should make sure you have a proper Python, which at the time of this writing <ref>~~~~</ref> means 2.6 or 2.7 (maybe later a 3.x version?)
  
 
== Users ==
 
== Users ==
Line 15: Line 15:
 
* http://code.pediapress.com/wiki/wiki/WikiToPDF
 
* http://code.pediapress.com/wiki/wiki/WikiToPDF
  
 +
== Installation ==
 
To get the MediaWiki Document server going locally, follow the guide on pediapress.com
 
To get the MediaWiki Document server going locally, follow the guide on pediapress.com
 
+
<source lang="bash">
 +
cd
 +
MYENV=WIKI
 +
sudo easy_install pip
 +
pip install virtualenv
 +
virtualenv $MYENV
 +
cd $MYENV
 +
source WIKI/bin/activate
 +
./bin/pip install -i http://pypi.pediapress.com/simple/ mwlib
 +
./bin/pip install -i http://pypi.pediapress.com/simple/ mwlib.rl
 +
mw-zip -c :en -o test.zip Acdc Number
 +
mw-render -c test.zip -o test.pdf -w rl
 +
# view error messages and view pdf file for results
 +
wget http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-1.el6.x86_64.rpm
 +
sudo yum install libgcj
 +
sudo rpm -i pdftk-2.02-1.el6.x86_64.rpm
 +
</source>
 +
<pre>
 +
Successfully installed mwlib pyparsing timelib bottle pyPdf apipkg qserve lxml py sqlite3dbm simplejson roman gevent odfpy Pillow greenlet
 +
</pre>
 
{{Messagebox
 
{{Messagebox
 
| type = failure
 
| type = failure
Line 86: Line 106:
 
exit 0
 
exit 0
 
</source>
 
</source>
 +
 +
{{References}}

Revision as of 15:43, 3 June 2014

A single article or collection of pages can be output in a variety of formats; on-demand

Books (Collections is the formal software name, Books is the more User-friendly feature name) allows you to export any content you want from the wiki into formats more suitable for offline reading, sharing, printing etc.

Books is a feature of this wiki, added by mw:Extension:Collection which in turn relies on a host of other goodies such as Python's setuptools, Imaging Library[1], and a whole render server which is supplied by PediaPress. Because of the Python dependencies, you should make sure you have a proper Python, which at the time of this writing [2] means 2.6 or 2.7 (maybe later a 3.x version?)

Users[edit | edit source]

See the help page at Help:Books

For Developers and Admins[edit | edit source]

there is a

Installation[edit | edit source]

To get the MediaWiki Document server going locally, follow the guide on pediapress.com

cd
MYENV=WIKI
sudo easy_install pip
pip install virtualenv
virtualenv $MYENV
cd $MYENV
source WIKI/bin/activate
./bin/pip install -i http://pypi.pediapress.com/simple/ mwlib
./bin/pip install -i http://pypi.pediapress.com/simple/ mwlib.rl
mw-zip -c :en -o test.zip Acdc Number
mw-render -c test.zip -o test.pdf -w rl
# view error messages and view pdf file for results
wget http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-1.el6.x86_64.rpm
sudo yum install libgcj
sudo rpm -i pdftk-2.02-1.el6.x86_64.rpm
Successfully installed mwlib pyparsing timelib bottle pyPdf apipkg qserve lxml py sqlite3dbm simplejson roman gevent odfpy Pillow greenlet

Note that the --clean-cache option of mw-serve is meant to be used from a cron job to clean up, NOT as a configuration option in your --daemonize script.


I needed to create a script similar to the following so that the service would be available after system restarts (from http://svn.wikimedia.org/viewvc/mediawiki/trunk/tools/mw-serve/mw-serve.sh)

#! /bin/sh
# run this service automatically in run-levels 3 or 5
# see chkconfig for more detail
# on debian/ubuntu use sysv-rc-conf
# chkconfig: 35 90 10
# description: mediawiki-serve - does document conversion to PDF
#
# Script for running the MediaWiki collection server (which converts articles to PDF)
# See the wiki for more information
# Author: Greg Rundlett <greg@freephile.com>

case "$1" in
start)

echo "Starting mw-serve... "
# defaults to FastCGI, port 8899 on localhost, no daemonization
su -c "PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin \
PYTHON_EGG_CACHE=/var/cache/python-eggs \
/usr/bin/mw-serve \
--daemonize \
--cache-dir='/var/cache/pdfserver/' \
--mwrender-logfile='/var/log/mw-pdf.log' \
--mwzip-logfile='/var/log/mw-zip.log' \
--mwpost-logfile='/var/log/mw-post.log' \
--logfile='/var/log/mw-serve.log' \
--pid-file='/var/run/mw-serve.pid' \
--report-from-mail=greg@freephile.com \
--report-recipient=greg@freephile.com" www-data
;;

stop)
PIDFILE=/var/run/mw-serve.pid
if [ -e $PIDFILE ]; then
PID=`cat $PIDFILE`
echo -n "Stopping mw-serve, killing PID $PID..."
if ! kill $PID; then
echo "can't kill it."
else
echo "done."
rm -f $PIDFILE
fi
else
echo "mw-serve does not appear to be running."
fi
;;

reload|force-reload)
echo "Reload not supported for mw-serve yet."
;;

restart)
"$0" stop && "$0" start
;;

*)
echo "Usage: /etc/init.d/mw-serve {start|stop|restart}"
exit 1
esac

exit 0

References[edit source]

  1. sudo yum install python-imaging or sudo apt-get install python-imaging should do the trick, but make sure you have a proper python
  2. ~~~~