2016-06-11 21:03:17 +01:00
|
|
|
<?php
|
2016-06-16 15:34:00 +01:00
|
|
|
include_once "config/config.php";
|
|
|
|
function RemoveExpiredPastes(){
|
|
|
|
$time = time();
|
|
|
|
$stmt = $conn->prepare("DELETE from `pastes` where `expire`<:time and `expire`>0");
|
|
|
|
$stmt->bindValue(':time', $time);
|
|
|
|
$stmt->execute();
|
|
|
|
$conn = null; //close connection to database
|
|
|
|
echo 'OK! 200';
|
|
|
|
}
|
2016-06-11 21:03:17 +01:00
|
|
|
if (isset($_GET["key"])){
|
2016-06-16 15:34:00 +01:00
|
|
|
if($_GET["key"]==$CRON_ExpireKey){ //Delete expired pastes
|
|
|
|
RemoveExpiredPastes();
|
2016-06-11 21:03:17 +01:00
|
|
|
}
|
|
|
|
}
|
2016-06-16 15:34:00 +01:00
|
|
|
//Cron job example: */5 * * * * curl --silent http://127.0.0.1/paste/cronjob.php?key=fgd45fb5fb15gb > /dev/null
|
2016-06-11 21:03:17 +01:00
|
|
|
//More about cron jobs: http://www.shellhacks.com/en/Adding-Cron-Jobs-in-Linux-Crontab-Usage-and-Examples
|
|
|
|
?>
|