Commit 3184fda9 authored by Richard Mansfield's avatar Richard Mansfield

Run .pot file generator in crontab and copy output to web root

parent fead8592
...@@ -2,4 +2,5 @@ ...@@ -2,4 +2,5 @@
# Regular cron jobs for the custom-site-mahara-langpacks package # Regular cron jobs for the custom-site-mahara-langpacks package
# #
22 * * * * root [ -x /usr/lib/mahara-langpacks/langpacks.sh ] && /usr/lib/mahara-langpacks/langpacks.sh >> /var/log/mahara-langpacks.log 22 * * * * root [ -x /usr/lib/mahara-langpacks/langpacks.sh ] && /usr/lib/mahara-langpacks/langpacks.sh >> /var/log/mahara-langpacks.log
52 * * * * root [ -x /usr/lib/mahara-langpacks/update-pot.sh ] && /usr/lib/mahara-langpacks/update-pot.sh >> /var/log/mahara-langpacks.log
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Update .pot files # Update .pot files
# this is expected to define DATA, and SCRIPTS # this is expected to define DATA, SCRIPTS, DOCROOT
. /etc/mahara-langpacks.conf . /etc/mahara-langpacks.conf
if [ ! -w ${DATA} ]; then if [ ! -w ${DATA} ]; then
...@@ -10,14 +10,20 @@ if [ ! -w ${DATA} ]; then ...@@ -10,14 +10,20 @@ if [ ! -w ${DATA} ]; then
exit 1 exit 1
fi fi
if [ ! -w ${DOCROOT} ]; then
echo "${DOCROOT} not writable"
exit 1
fi
WORK=${DATA}/templates WORK=${DATA}/templates
GITDIR=${WORK}/git GITDIR=${WORK}/git
TEMP=${WORK}/temp TEMP=${WORK}/temp
OUT=${DATA}/pot OUT=${DATA}/po
[ ! -d ${WORK} ] && mkdir ${WORK} [ ! -d ${WORK} ] && mkdir ${WORK}
[ ! -d ${TEMP} ] && mkdir ${TEMP} [ ! -d ${TEMP} ] && mkdir ${TEMP}
[ ! -d ${OUT} ] && mkdir ${OUT} [ ! -d ${OUT} ] && mkdir ${OUT}
[ ! -d ${DOCROOT}/po ] && mkdir ${DOCROOT}/po
remote='git://gitorious.org/mahara/mahara.git' remote='git://gitorious.org/mahara/mahara.git'
...@@ -84,6 +90,11 @@ for branch in ${branches} ; do ...@@ -84,6 +90,11 @@ for branch in ${branches} ; do
[ -f ${outputfile} ] && rm ${outputfile} [ -f ${outputfile} ] && rm ${outputfile}
/usr/bin/php ${SCRIPTS}/php-po.php ${langpack} ${langpack} ${outputfile} /usr/bin/php ${SCRIPTS}/php-po.php ${langpack} ${langpack} ${outputfile}
if [ -f ${outputfile} ]; then
chmod 755 ${outputfile}
cp ${outputfile} ${DOCROOT}/po
fi
echo "${remotecommit}" > ${last} echo "${remotecommit}" > ${last}
fi fi
done done
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment