summaryrefslogtreecommitdiff
path: root/update.c
diff options
context:
space:
mode:
Diffstat (limited to 'update.c')
-rw-r--r--update.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/update.c b/update.c
index 6c1bbe5..681bb25 100644
--- a/update.c
+++ b/update.c
@@ -2087,8 +2087,10 @@ int cUpdate::cleanupPictures()
if (!dbConnected(yes))
return fail;
+ tell(1, "Remove %s symlinks", fullreload ? "all" : "old");
+
// -----------------------
- // remove wasted symlinks
+ // remove unused symlinks
if (!(dir = opendir(epgimagedir)))
{
@@ -2096,15 +2098,37 @@ int cUpdate::cleanupPictures()
return done;
}
- tell(1, "Remove %s symlinks", fullreload ? "all" : "old");
-
while ((dirent = readdir(dir)))
{
- // check extension
+ asprintf(&pdir, "%s/%s", epgimagedir, dirent->d_name);
- if (strncmp(dirent->d_name + strlen(dirent->d_name) - strlen(ext), ext, strlen(ext)) != 0)
- continue;
+ if (isLink(pdir))
+ {
+ useeventsDb->setValue("USEID", atoi(dirent->d_name));
+
+ if (fullreload || !selectEventById->find())
+ {
+ if (!removeFile(pdir))
+ lCount++;
+ }
+ }
+
+ free(pdir);
+ }
+
+ closedir(dir);
+
+ // -----------------------
+ // remove wasted symlinks
+ if (!(dir = opendir(epgimagedir)))
+ {
+ tell(1, "Can't open directory '%s', '%s'", epgimagedir, strerror(errno));
+ return done;
+ }
+
+ while ((dirent = readdir(dir)))
+ {
asprintf(&pdir, "%s/%s", epgimagedir, dirent->d_name);
// fileExists use access() which dereference links!
@@ -2123,27 +2147,3 @@ int cUpdate::cleanupPictures()
return success;
}
-
-//***************************************************************************
-// Link Needed
-//***************************************************************************
-
-int cUpdate::pictureLinkNeeded(const char* linkName)
-{
- int found;
-
- if (!dbConnected())
- return yes;
-
- // we don't need to patch the linkname "123456_0.jpg"
- // since atoi() stops at the first non numerical character ...
-
- imageRefDb->clear();
- imageRefDb->setValue("LFN", 0L);
- imageRefDb->setBigintValue("EVENTID", atol(linkName));
-
- found = imageRefDb->find();
- imageRefDb->reset();
-
- return found;
-}