#2365 htmlUI install/uninstall
This commit is contained in:
parent
7b22d9da20
commit
d822e15219
|
@ -227,6 +227,11 @@ install: configure_apache
|
||||||
ln -sf ${USR_VAR_DIR}/Campcaster ${WWW_DOCROOT}/campcaster
|
ln -sf ${USR_VAR_DIR}/Campcaster ${WWW_DOCROOT}/campcaster
|
||||||
|
|
||||||
-cd var/install && php -q install.php
|
-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:
|
configure_apache:
|
||||||
ifeq (@CONFIGURE_APACHE@,yes)
|
ifeq (@CONFIGURE_APACHE@,yes)
|
||||||
|
|
|
@ -8,11 +8,20 @@ if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Install twitter Cron job
|
// Install twitter Cron job
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
<?php
|
||||||
require_once(dirname(__FILE__).'/../../../storageServer/var/cron/Cron.php');
|
require_once(dirname(__FILE__).'/../../../storageServer/var/cron/Cron.php');
|
||||||
$command = '/usr/bin/php '.realpath(dirname(__FILE__).'/../html/ui_twitterCron.php');
|
$m = '*';
|
||||||
|
$h ='*';
|
||||||
|
$dom = '*';
|
||||||
|
$mon = '*';
|
||||||
|
$dow = '*';
|
||||||
|
$command = '/usr/bin/php '.realpath(dirname(__FILE__).'/../html/ui_twitterCron.php').' >/dev/null 2>&1';
|
||||||
|
$old_regex = '/ui_twitterCron\.php/';
|
||||||
|
|
||||||
$cron = new Cron();
|
$cron = new Cron();
|
||||||
$access = $cron->openCrontab('write');
|
$access = $cron->openCrontab('write');
|
||||||
|
@ -22,15 +31,14 @@ if ($access != 'write') {
|
||||||
} while ($r);
|
} while ($r);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($cron->ct->getByType(CRON_CMD) as $line) {
|
foreach ($cron->ct->getByType(CRON_CMD) as $id => $line) {
|
||||||
if (preg_match('/ui_twitterCron\.php/', $line['command'])) {
|
if (preg_match($old_regex, $line['command'])) {
|
||||||
$cron->closeCrontab();
|
echo " removing old entry\n";
|
||||||
echo " * Twitter cron job already exists.\n";
|
$cron->ct->delEntry($id);
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo " * Adding twitter cron job...";
|
echo " adding new entry\n";
|
||||||
$cron->ct->addCron('*', '*', '*', '*', '*', $command);
|
$cron->ct->addCron($m, $h, $dom, $mon, $dow, $command);
|
||||||
$cron->closeCrontab();
|
$cron->closeCrontab();
|
||||||
echo "Done\n";
|
echo "Done.\n";
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
// Do not allow remote execution
|
||||||
|
$arr = array_diff_assoc($_SERVER, $_ENV);
|
||||||
|
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
|
||||||
|
header("HTTP/1.1 400");
|
||||||
|
header("Content-type: text/plain; charset=UTF-8");
|
||||||
|
echo "400 Not executable\r\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Uninstall twitter Cron job
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
<?php
|
||||||
|
require_once(dirname(__FILE__).'/../../../storageServer/var/cron/Cron.php');
|
||||||
|
$old_regex = '/ui_twitterCron\.php/';
|
||||||
|
|
||||||
|
$cron = new Cron();
|
||||||
|
$access = $cron->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";
|
||||||
|
?>
|
Loading…
Reference in New Issue