timestamp update
This commit is contained in:
parent
6e9d448e96
commit
5b93dc9c2b
3 changed files with 12 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,5 +2,6 @@ photos/
|
||||||
thumbs/
|
thumbs/
|
||||||
db_feed_source
|
db_feed_source
|
||||||
db_old_files
|
db_old_files
|
||||||
|
db_rss_timestamp
|
||||||
rss.locker
|
rss.locker
|
||||||
new_files_list
|
new_files_list
|
||||||
|
|
|
@ -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"
|
$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";
|
$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
|
$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
|
$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
|
$SkipObjects = array('UnDossier', 'UnFichier'); //Those files and folders will not be displayed on the RSS feed
|
||||||
//ADVANCED SETTINGS
|
//ADVANCED SETTINGS
|
||||||
|
|
14
rss.php
14
rss.php
|
@ -62,8 +62,8 @@
|
||||||
require("config.php");
|
require("config.php");
|
||||||
#$content = "";
|
#$content = "";
|
||||||
$old_files_list = "db_old_files"; //list of files in ./photos
|
$old_files_list = "db_old_files"; //list of files in ./photos
|
||||||
$new_files_list = "new_files_list";
|
|
||||||
$db_feed_source = "db_feed_source";
|
$db_feed_source = "db_feed_source";
|
||||||
|
$db_rss_timestamp = "db_rss_timestamp";
|
||||||
$Folder = 'photos';
|
$Folder = 'photos';
|
||||||
$content = ListFiles($gallery_link, $content, $Folder, $SkipExts, $SkipObjects);
|
$content = ListFiles($gallery_link, $content, $Folder, $SkipExts, $SkipObjects);
|
||||||
$to_store = "";
|
$to_store = "";
|
||||||
|
@ -76,17 +76,23 @@
|
||||||
{
|
{
|
||||||
file_put_contents($db_feed_source, "");
|
file_put_contents($db_feed_source, "");
|
||||||
}
|
}
|
||||||
|
if (!file_exists($db_rss_timestamp))
|
||||||
|
{
|
||||||
|
file_put_contents($db_rss_timestamp, "");
|
||||||
|
}
|
||||||
|
|
||||||
/*===================*/
|
/*===================*/
|
||||||
/*Computing*/
|
/*Computing*/
|
||||||
/*===================*/
|
/*===================*/
|
||||||
#Todo : ajouter une condition : dois-je regénérer le flux ou utiliser les anciens fichiers ?
|
#Todo : ajouter une condition : dois-je regénérer le flux ou utiliser les anciens fichiers ?
|
||||||
$temp = file_get_contents($db_feed_source);
|
$temp = file_get_contents($db_feed_source);
|
||||||
|
$last_rss_gen = file_get_contents($db_rss_timestamp);
|
||||||
//If the RSS generation is already launched, don't do à second generation at the same time
|
$current_time = time();
|
||||||
if (file_exists("rss.locker") == false)
|
//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("rss.locker", "");
|
||||||
|
file_put_contents($db_rss_timestamp, time());
|
||||||
// Load the list from files.
|
// Load the list from files.
|
||||||
$old_files_list_content = explode("\n", file_get_contents($old_files_list));
|
$old_files_list_content = explode("\n", file_get_contents($old_files_list));
|
||||||
$new_files_list_content = explode("\n", $content); #debug
|
$new_files_list_content = explode("\n", $content); #debug
|
||||||
|
|
Loading…
Reference in a new issue