TBA version x.x Lithium
+* Update information now included
+* Rewritten lifetime calculation
20191223 version 0.2-beta Helium
* First public beta release
* abstract storage to support different storage solutions
* config file for client script
* proxy setting for client script
+* Lifetimecheck as cronjob
# COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
# along with this program. If not, see http://www.sun.com/cddl/cddl.html
#
-# 2020 https://www.bananas-playground.net/projekt/selfpaste
+# 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste
command -v curl >/dev/null 2>&1 || { echo >&2 "I require curl (https://curl.haxx.se/) but it's not installed. Aborting."; exit 1; }
command -v jq >/dev/null 2>&1 || { echo >&2 "I require jq (https://stedolan.github.io/jq/) but it's not installed. Aborting."; exit 1; }
-The default lifetime of a paste is 7 days. Anything older will be deleted.
+The default lifetime of a paste is 30 days. Anything older will be deleted.
+The config value is on days.
The default flood prevention time maximum is 30 sec.
\ No newline at end of file
- Keep your secret a secret
- Do not use it publicly
- - Do not promote it as a new paste plattform
+ - Do not promote it as a new paste platform
- Change your secret often
--- /dev/null
+If you update from a previous version make sure every update step is done
+since your current used version.
\ No newline at end of file
* COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
* along with this program. If not, see http://www.sun.com/cddl/cddl.html
*
- * 2020 https://www.bananas-playground.net/projekt/selfpaste
+ * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste
*/
# this is your installation secret. Could be anything.
# needed to respond with the correct link for your paste
# please NO / at the end
define('SELFPASTE_URL','http://your.tld/path/selfpaste/webroot');
-# time in seconds how long a paste will be available. Default 7 days = 604800 sec
-define('SELFPASTE_PASTE_LIFETIME',604800);
+# time in days how long a paste will be available. Default 30 days
+define('SELFPASTE_PASTE_LIFETIME',30);
# time in seconds how long the flood protection should take action. Default 30sec
define('SELFPASTE_FLOOD_LIFETIME',30);
* COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
* along with this program. If not, see http://www.sun.com/cddl/cddl.html
*
- * 2020 https://www.bananas-playground.net/projekt/selfpaste
+ * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste
*/
# global debug setting
* COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
* along with this program. If not, see http://www.sun.com/cddl/cddl.html
*
- * 2020 https://www.bananas-playground.net/projekt/selfpaste
+ * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste
*/
/**
*/
private function _checkLifetime() {
$iterator = new RecursiveDirectoryIterator(SELFPASTE_UPLOAD_DIR);
- $now = time();
+ $datepointInThePastInSec = strtotime('-'.SELFPASTE_PASTE_LIFETIME.' days');
foreach (new RecursiveIteratorIterator($iterator) as $file) {
$fname = $file->getFilename();
|| Summoner::startsWith($file->getFilename(),'.')
|| isset($fname[4])
) continue;
- if ($now - $file->getCTime() >= SELFPASTE_PASTE_LIFETIME) {
- unlink(SELFPASTE_UPLOAD_DIR.'/'.$fname);
+ if ($file->getMTime() <= $datepointInThePastInSec) {
+ if(is_writable($file->getPathname())) {
+ unlink($file->getPathname());
+ }
}
}
}
* COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
* along with this program. If not, see http://www.sun.com/cddl/cddl.html
*
- * 2020 https://www.bananas-playground.net/projekt/selfpaste
+ * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste
*/
/**
* COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
* along with this program. If not, see http://www.sun.com/cddl/cddl.html
*
- * 2020 https://www.bananas-playground.net/projekt/selfpaste
+ * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste
*/
echo json_encode($contentBody)."\n";
\ No newline at end of file
* COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
* along with this program. If not, see http://www.sun.com/cddl/cddl.html
*
- * 2020 https://www.bananas-playground.net/projekt/selfpaste
+ * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste
*/
if (file_exists($contentBody)) {
header('Expires: 0');
* COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
* along with this program. If not, see http://www.sun.com/cddl/cddl.html
*
- * 2020 https://www.bananas-playground.net/projekt/selfpaste
+ * 2019 - 2020 https://://www.bananas-playground.net/projekt/selfpaste
*/
?>
<!DOCTYPE HTML>