timestamp update

This commit is contained in:
tmos 2014-05-04 17:28:32 +02:00
parent 6e9d448e96
commit 5b93dc9c2b
3 changed files with 12 additions and 4 deletions

1
.gitignore vendored
View File

@ -2,5 +2,6 @@ photos/
thumbs/
db_feed_source
db_old_files
db_rss_timestamp
rss.locker
new_files_list

View File

@ -41,6 +41,7 @@ $label_loading = "Loading..."; //Thumbnail loading text
$gallery_link = substr("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 0, strlen("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])-7); // the -7 is to remove "rss.php"
$description = "MiniGal Nano";
$nb_items_rss = 25; //number ef elements to display in the feed. If you add a lot of pictures at the time, consider increasing this number
$rss_refresh_interval = 60;//time, in seconds, between two RSS refresh. for example, 3600 = 1update max per hour, 86400 = 1/day.
$SkipExts = array('html', 'txt', 'php', "gitignore"); //Files with one of this extension will not be displayed on the RSS feed
$SkipObjects = array('UnDossier', 'UnFichier'); //Those files and folders will not be displayed on the RSS feed
//ADVANCED SETTINGS

14
rss.php
View File

@ -62,8 +62,8 @@
require("config.php");
#$content = "";
$old_files_list = "db_old_files"; //list of files in ./photos
$new_files_list = "new_files_list";
$db_feed_source = "db_feed_source";
$db_rss_timestamp = "db_rss_timestamp";
$Folder = 'photos';
$content = ListFiles($gallery_link, $content, $Folder, $SkipExts, $SkipObjects);
$to_store = "";
@ -76,17 +76,23 @@
{
file_put_contents($db_feed_source, "");
}
if (!file_exists($db_rss_timestamp))
{
file_put_contents($db_rss_timestamp, "");
}
/*===================*/
/*Computing*/
/*===================*/
#Todo : ajouter une condition : dois-je regénérer le flux ou utiliser les anciens fichiers ?
$temp = file_get_contents($db_feed_source);
//If the RSS generation is already launched, don't do à second generation at the same time
if (file_exists("rss.locker") == false)
$last_rss_gen = file_get_contents($db_rss_timestamp);
$current_time = time();
//If the RSS generation is already launched, don't do a second generation at the same time
if (($current_time - $last_rss_gen) > $rss_refresh_interval && file_exists("rss.locker") == false)
{
file_put_contents("rss.locker", "");
file_put_contents($db_rss_timestamp, time());
// Load the list from files.
$old_files_list_content = explode("\n", file_get_contents($old_files_list));
$new_files_list_content = explode("\n", $content); #debug