diff --git a/campcaster/src/modules/htmlUI/etc/Makefile.in b/campcaster/src/modules/htmlUI/etc/Makefile.in index 26f42c5a3..428546c7c 100644 --- a/campcaster/src/modules/htmlUI/etc/Makefile.in +++ b/campcaster/src/modules/htmlUI/etc/Makefile.in @@ -227,6 +227,11 @@ install: configure_apache ln -sf ${USR_VAR_DIR}/Campcaster ${WWW_DOCROOT}/campcaster -cd var/install && php -q install.php + +uninstall: + -cd var/install && php -q uninstall.php + ${RM} ${WWW_DOCROOT}/campcaster + ${RMDIR} ${USR_VAR_DIR}/Campcaster/htmlUI configure_apache: ifeq (@CONFIGURE_APACHE@,yes) diff --git a/campcaster/src/modules/htmlUI/var/install/install.php b/campcaster/src/modules/htmlUI/var/install/install.php index 895f5ae8b..63ba403e5 100644 --- a/campcaster/src/modules/htmlUI/var/install/install.php +++ b/campcaster/src/modules/htmlUI/var/install/install.php @@ -8,11 +8,20 @@ if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) { exit(1); } +?> + //------------------------------------------------------------------------ // Install twitter Cron job //------------------------------------------------------------------------ +/dev/null 2>&1'; +$old_regex = '/ui_twitterCron\.php/'; $cron = new Cron(); $access = $cron->openCrontab('write'); @@ -22,15 +31,14 @@ if ($access != 'write') { } while ($r); } -foreach ($cron->ct->getByType(CRON_CMD) as $line) { - if (preg_match('/ui_twitterCron\.php/', $line['command'])) { - $cron->closeCrontab(); - echo " * Twitter cron job already exists.\n"; - exit; +foreach ($cron->ct->getByType(CRON_CMD) as $id => $line) { + if (preg_match($old_regex, $line['command'])) { + echo " removing old entry\n"; + $cron->ct->delEntry($id); } } -echo " * Adding twitter cron job..."; -$cron->ct->addCron('*', '*', '*', '*', '*', $command); +echo " adding new entry\n"; +$cron->ct->addCron($m, $h, $dom, $mon, $dow, $command); $cron->closeCrontab(); -echo "Done\n"; +echo "Done.\n"; ?> diff --git a/campcaster/src/modules/htmlUI/var/install/uninstall.php b/campcaster/src/modules/htmlUI/var/install/uninstall.php new file mode 100644 index 000000000..bd6f3d86b --- /dev/null +++ b/campcaster/src/modules/htmlUI/var/install/uninstall.php @@ -0,0 +1,37 @@ + + +//------------------------------------------------------------------------ +// Uninstall twitter Cron job +//------------------------------------------------------------------------ +openCrontab('write'); +if ($access != 'write') { + do { + $r = $cron->forceWriteable(); + } while ($r); +} + +foreach ($cron->ct->getByType(CRON_CMD) as $id => $line) { + if (preg_match($old_regex, $line['command'])) { + echo " removing cron entry\n"; + $cron->ct->delEntry($id); + } +} + +$cron->closeCrontab(); +echo "Done.\n"; +?> \ No newline at end of file