From c0c2ebe662db2a54b2bf4e80073d254100f9b310 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Thu, 19 Feb 2015 09:23:12 +0100 Subject: Add php script that builds the xslt pipeline On servers we often dont have make and xsltproc available so we should issue stuff directly from php. --- update.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 update.php diff --git a/update.php b/update.php new file mode 100755 index 0000000..1a5233b --- /dev/null +++ b/update.php @@ -0,0 +1,37 @@ +#!/usr/bin/env php +load($input); + +/* TODO Check whether the input xml is valid – if not it is probably changed currently. + * Add 5min timeout and try again */ + +$preprocess = new DOMDocument(); +$preprocess->load('convert-style-to-html.xsl'); + +$process = new DOMDocument(); +$process->load('endnote-to-dbxml.xsl'); + +$proc1 = new XSLTProcessor(); +$proc1->importStyleSheet($preprocess); + +$proc2 = new XSLTProcessor(); +$proc2->importStyleSheet($process); + +$step1 = $proc1->transformToDoc($xml); +$step2 = $proc2->transformToXML($step1); +$step3 = preg_replace('#<([^>]*)/>#', '<\1>', $step2); + +file_put_contents($output, $step3); + +/* TODO: Issue the mysql command directly from php */ + +/* TODO: Write mail, add exception handler and write mail on error as well */ -- cgit