summaryrefslogtreecommitdiff
path: root/app/Models/Feed.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/Feed.php')
-rw-r--r--app/Models/Feed.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index e94ae2b3a..73f9c32fb 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -281,4 +281,22 @@ class FreshRSS_Feed extends Minz_Model {
$this->entries = $entries;
}
+
+ function lock() {
+ $lock = TMP_PATH . '/' . md5(Minz_Configuration::salt() . $this->url) . '.freshrss.lock';
+ if (file_exists($lock) && ((time() - @filemtime($lock)) > 3600)) {
+ @unlink($lock);
+ }
+ if (($handle = @fopen($lock, 'x')) === false) {
+ return false;
+ }
+ //register_shutdown_function('unlink', $lock);
+ @fclose($handle);
+ return true;
+ }
+
+ function unlock() {
+ $lock = TMP_PATH . '/' . md5(Minz_Configuration::salt() . $this->url) . '.freshrss.lock';
+ @unlink($lock);
+ }
}