if rss script is in read-only directory, skip file generation and diff calculations.

This commit is contained in:
Piotr KUCHARSKI 2014-11-26 22:43:51 +01:00
parent 78122f16b6
commit ba387e0c47

16
rss.php
View file

@ -92,13 +92,17 @@ function print_array($array_to_display)
/*===================*/ /*===================*/
require("config-default.php"); require("config-default.php");
include("config.php"); include("config.php");
#$content = "";
$content = "";
$folder = "photos";
$content = listFiles($gallery_link, $content, $folder, $SkipExts, $SkipObjects);
if (is_writeable(".")) {
$to_store = "";
$old_files_list = "db_old_files"; //list of files in ./photos $old_files_list = "db_old_files"; //list of files in ./photos
$db_feed_source = "db_feed_source"; $db_feed_source = "db_feed_source";
$db_rss_timestamp = "db_rss_timestamp"; $db_rss_timestamp = "db_rss_timestamp";
$Folder = 'photos';
$content = ListFiles($gallery_link, $content, $Folder, $SkipExts, $SkipObjects);
$to_store = "";
// Init files // Init files
if (!file_exists($old_files_list)) { if (!file_exists($old_files_list)) {
file_put_contents($old_files_list, ""); file_put_contents($old_files_list, "");
@ -142,11 +146,13 @@ if (($current_time - $last_rss_gen) > $rss_refresh_interval && file_exists("rss.
file_put_contents($old_files_list, $content); file_put_contents($old_files_list, $content);
unlink("rss.locker"); unlink("rss.locker");
} }
$content = $temp;
}
/*===================*/ /*===================*/
/* XML Gen */ /* XML Gen */
/*===================*/ /*===================*/
$temp = explode("\n", $temp); $temp = explode("\n", $content);
echo "<rss version='2.0'>\n<channel>"; echo "<rss version='2.0'>\n<channel>";
echo "<title>$title</title>"; echo "<title>$title</title>";
echo "<link>$gallery_link</link>"; echo "<link>$gallery_link</link>";