aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2023-09-24 20:53:07 +0200
committerGravatar GitHub <noreply@github.com> 2023-09-24 20:53:07 +0200
commit857e908929ef26da41646c04804cbd4aa106ec52 (patch)
treec3c13fae4ef0adaa2861a2fe8abf9aad1c8b53ff
parentf321f000c170c45aadd750bddd25d5074b4e281f (diff)
downloadrss-bridge-857e908929ef26da41646c04804cbd4aa106ec52.tar.gz
rss-bridge-857e908929ef26da41646c04804cbd4aa106ec52.tar.zst
rss-bridge-857e908929ef26da41646c04804cbd4aa106ec52.zip
chore: prepare 2023-09-24 release (#3703)2023-09-24
-rw-r--r--caches/FileCache.php4
-rw-r--r--caches/SQLiteCache.php4
-rw-r--r--contrib/prepare_release/fetch_contributors.php53
-rw-r--r--contrib/prepare_release/rssbridge-log-helper.el151
-rw-r--r--contrib/prepare_release/template.md23
-rw-r--r--lib/Configuration.php2
-rw-r--r--lib/RssBridge.php2
-rw-r--r--templates/frontpage.html.php12
8 files changed, 19 insertions, 232 deletions
diff --git a/caches/FileCache.php b/caches/FileCache.php
index 703fb6db..1ae88704 100644
--- a/caches/FileCache.php
+++ b/caches/FileCache.php
@@ -36,7 +36,7 @@ class FileCache implements CacheInterface
$this->delete($key);
return $default;
}
- $expiration = $item['expiration'];
+ $expiration = $item['expiration'] ?? time();
if ($expiration === 0 || $expiration > time()) {
return $item['value'];
}
@@ -92,7 +92,7 @@ class FileCache implements CacheInterface
unlink($cacheFile);
continue;
}
- $expiration = $item['expiration'];
+ $expiration = $item['expiration'] ?? time();
if ($expiration === 0 || $expiration > time()) {
continue;
}
diff --git a/caches/SQLiteCache.php b/caches/SQLiteCache.php
index 94f6e289..becedde4 100644
--- a/caches/SQLiteCache.php
+++ b/caches/SQLiteCache.php
@@ -37,10 +37,14 @@ class SQLiteCache implements CacheInterface
$this->db = new \SQLite3($config['file']);
$this->db->enableExceptions(true);
$this->db->exec("CREATE TABLE storage ('key' BLOB PRIMARY KEY, 'value' BLOB, 'updated' INTEGER)");
+ // Consider uncommenting this to add an index on expiration
+ //$this->db->exec('CREATE INDEX idx_storage_updated ON storage (updated)');
}
$this->db->busyTimeout($config['timeout']);
+
// https://www.sqlite.org/pragma.html#pragma_journal_mode
$this->db->exec('PRAGMA journal_mode = wal');
+
// https://www.sqlite.org/pragma.html#pragma_synchronous
$this->db->exec('PRAGMA synchronous = NORMAL');
}
diff --git a/contrib/prepare_release/fetch_contributors.php b/contrib/prepare_release/fetch_contributors.php
deleted file mode 100644
index dd99229f..00000000
--- a/contrib/prepare_release/fetch_contributors.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-/* Generate the "Contributors" list for README.md automatically utilizing the GitHub API */
-
-require __DIR__ . '/../../lib/bootstrap.php';
-
-$url = 'https://api.github.com/repos/rss-bridge/rss-bridge/contributors';
-$contributors = [];
-$next = true;
-
-while ($next) { /* Collect all contributors */
- $headers = [
- 'Accept' => 'application/json',
- 'Content-Type' => 'application/json',
- 'User-Agent' => 'RSS-Bridge',
- ];
- $httpClient = new CurlHttpClient();
- $response = $httpClient->request($url, ['headers' => $headers]);
-
- $json = $response->getBody();
- $json_decode = Json::decode($json, false);
- foreach ($json_decode as $contributor) {
- $contributors[] = $contributor;
- }
-
- // Extract links to "next", "last", etc...
- $link1 = $response->getHeader('link');
- $links = explode(',', $link1);
- $next = false;
-
- // Check if there is a link with 'rel="next"'
- foreach ($links as $link) {
- [$url, $type] = explode(';', $link, 2);
-
- if (trim($type) === 'rel="next"') {
- $url = trim(preg_replace('/([<>])/', '', $url));
- $next = true;
- break;
- }
- }
-}
-
-/* Example JSON data: https://api.github.com/repos/rss-bridge/rss-bridge/contributors */
-
-// We want contributors sorted by name
-usort($contributors, function ($a, $b) {
- return strcasecmp($a->login, $b->login);
-});
-
-// Export as Markdown list
-foreach ($contributors as $contributor) {
- echo " * [{$contributor->login}]({$contributor->html_url})\n";
-}
diff --git a/contrib/prepare_release/rssbridge-log-helper.el b/contrib/prepare_release/rssbridge-log-helper.el
deleted file mode 100644
index a4b28226..00000000
--- a/contrib/prepare_release/rssbridge-log-helper.el
+++ /dev/null
@@ -1,151 +0,0 @@
-;;; rssbridge-log-helper.el --- A helper for preparing RSS-Bridge releases -*- lexical-binding:t; coding:utf-8 -*-
-
-;;; Commentary:
-
-;; Keyboard abbreviations used below:
-;; C-x == Ctrl + x
-;; M-x == Alt + x
-
-;; How to use this helper?
-;; 1. Run "git log --reverse 2021-04-25..master > tmp.md" (2021-04-25 is an example tag of a previous version)
-;; 2. Copy the contents of template.md to the start of tmp.md
-;; 3. Open Emacs. Type M-x load-file <ENTER>
-;; 4. Enter in the path to rssbridge-log-helper.el then <ENTER>
-;; 5. Type M-x find-file <ENTER>
-;; 6. Enter the path to tmp.md then <ENTER>
-;; 7. Type M-x rssbridge-log-transient-state <ENTER>
-;; 8. You can now use the following shortcuts to organize the commits:
-;; x: Delete commit
-;; g: Copy as general change
-;; n: Copy as new bridge
-;; m: Copy as modified bridge
-;; r: Copy as removed bridge
-;; <any key>: Quit
-;; 9. Once you are done with all the commits, type C-x then C-s
-;; 10. Exit Emacs with C-x then C-c
-
-;;; Code:
-
-(defun rssbridge-log--get-commit-block ()
- "Select a commit block that begins before the cursor."
- (re-search-backward "^commit ") ;; (move-beginning-of-line nil)
- (set-mark-command nil)
- (right-char)
- (re-search-forward "^commit ")
- (move-end-of-line 1))
-
-(defun rssbridge-log--goto-first-commit ()
- "Find the first commit in the file."
- (goto-char (point-min))
- (re-search-forward "^commit "))
-
-(defun rssbridge-log--remove-until-prev-commit-block ()
- "Remove from start of current line to previous commit block."
- (move-beginning-of-line nil)
- (set-mark-command nil)
- (re-search-backward "^commit ")
- (delete-region (region-beginning) (region-end)))
-
-(defun rssbridge-log--remove-until-next-commit-block ()
- "Remove from start of current line to next commit block."
- (move-beginning-of-line nil)
- (set-mark-command nil)
- (re-search-forward "^commit ")
- (move-beginning-of-line nil)
- (delete-region (region-beginning) (region-end)))
-
-(defun rssbridge-log--cut-paste (arg)
- "Copy current line to header that matches ARG."
- (kill-whole-line 0)
- (rssbridge-log--remove-until-next-commit-block)
- (goto-char (point-min))
- (re-search-forward arg)
- (move-end-of-line 1)
- (newline)
- (yank)
- (set-mark-command 1)
- (re-search-forward "^commit ")
- (recenter))
-
-(defun rssbridge-log-remove ()
- "Remove the current commit block.
-
-You can bind this function or use `rssbridge-log-transient-state'
-to access the function."
- (interactive)
- (rssbridge-log--get-commit-block)
- (rssbridge-log--remove-until-prev-commit-block)
- (set-mark-command 1)
- (re-search-forward "^commit "))
-
-(defun rssbridge-log-copy-as-new ()
- "Copy the current commit block as a new bridge.
-
-You can bind this function or use `rssbridge-log-transient-state'
-to access the function."
- (interactive)
- (rssbridge-log--get-commit-block)
- (re-search-backward "^.*\\[\\(.*\\)\\].*\\((.*)\\)" (region-beginning))
- (replace-match "* \\1 () \\2")
- (rssbridge-log--remove-until-prev-commit-block)
- (rssbridge-log--cut-paste "## New bridges"))
-
-(defun rssbridge-log-copy-as-mod ()
- "Copy the current commit block as a modified bridge.
-
-You can bind this function or use `rssbridge-log-transient-state'
-to access the function."
- (interactive)
- (rssbridge-log--get-commit-block)
- (re-search-backward "^.*\\[\\(.*\\)\\]" (region-beginning))
- (replace-match "* \\1:")
- (rssbridge-log--remove-until-prev-commit-block)
- (rssbridge-log--cut-paste "## Modified bridges"))
-
-(defun rssbridge-log-copy-as-gen ()
- "Copy the current commit block as a general change.
-
-You can bind this function or use `rssbridge-log-transient-state'
-to access the function."
- (interactive)
- (rssbridge-log--get-commit-block)
- (re-search-backward "^.*\\[\\(.*\\)\\]" (region-beginning))
- (replace-match "* \\1:")
- (rssbridge-log--remove-until-prev-commit-block)
- (rssbridge-log--cut-paste "## General changes"))
-
-(defun rssbridge-log-copy-as-rem ()
- "Copy the current commit block as a removed bridge.
-
-You can bind this function or use `rssbridge-log-transient-state'
-to access the function."
- (interactive)
- (rssbridge-log--get-commit-block)
- (re-search-backward "^.*\\[\\(.*\\)\\]" (region-beginning))
- (replace-match "* \\1:")
- (rssbridge-log--remove-until-prev-commit-block)
- (rssbridge-log--cut-paste "## Removed bridges"))
-
-
-(defun rssbridge-log-transient-state ()
- "Create a transient map for convienience.
-x: Delete commit
-g: Copy as general change
-n: Copy as new bridge
-m: Copy as modified bridge
-r: Copy as removed bridge
-<any key>: Quit"
- (interactive)
- (rssbridge-log--goto-first-commit)
- (set-transient-map
- (let ((map (make-sparse-keymap)))
- (define-key map "x" 'rssbridge-log-remove)
- (define-key map "g" 'rssbridge-log-copy-as-gen)
- (define-key map "n" 'rssbridge-log-copy-as-new)
- (define-key map "m" 'rssbridge-log-copy-as-mod)
- (define-key map "r" 'rssbridge-log-copy-as-rem)
- map)
- t))
-
-(provide 'rssbridge-log-helper)
-;;; rssbridge-log-helper.el ends here
diff --git a/contrib/prepare_release/template.md b/contrib/prepare_release/template.md
deleted file mode 100644
index 7314113d..00000000
--- a/contrib/prepare_release/template.md
+++ /dev/null
@@ -1,23 +0,0 @@
-<!-- Checklist (hidden in release)
-
-- [ ] List all changes
-- [ ] Update list of contributors (see README.md)
-- [ ] Update release date in Configuration.php
-- [ ] Set tag version to current date (YYYY-mm-dd)
-- [ ] Change release title to current date (RSS-Bridge YYYY-mm-dd)
-
--->
-
-## General changes
-
-
-## New bridges
-
-
-## Modified bridges
-
-
-## Removed bridges
-
-
-<!-- Template: No bridges were removed in this release! -->
diff --git a/lib/Configuration.php b/lib/Configuration.php
index 7ef97fa7..c38d7cc9 100644
--- a/lib/Configuration.php
+++ b/lib/Configuration.php
@@ -19,7 +19,7 @@
*/
final class Configuration
{
- private const VERSION = 'dev.2023-07-11';
+ private const VERSION = '2023-09-24';
private static $config = [];
diff --git a/lib/RssBridge.php b/lib/RssBridge.php
index da093cab..6ba952eb 100644
--- a/lib/RssBridge.php
+++ b/lib/RssBridge.php
@@ -30,6 +30,8 @@ final class RssBridge
if ((error_reporting() & $code) === 0) {
return false;
}
+ // In the future, uncomment this:
+ //throw new \ErrorException($message, 0, $code, $file, $line);
$text = sprintf(
'%s at %s line %s',
sanitize_root($message),
diff --git a/templates/frontpage.html.php b/templates/frontpage.html.php
index 99e2ffd9..a0d274da 100644
--- a/templates/frontpage.html.php
+++ b/templates/frontpage.html.php
@@ -29,8 +29,16 @@
<?= raw($bridges) ?>
<section class="footer">
- <a href="https://github.com/rss-bridge/rss-bridge">RSS-Bridge ~ Public Domain</a><br>
- <p class="version"><?= e(Configuration::getVersion()) ?></p>
+ <a href="https://github.com/RSS-Bridge/rss-bridge">
+ https://github.com/RSS-Bridge/rss-bridge
+ </a>
+
+ <br>
+ <br>
+
+ <p class="version">
+ <?= e(Configuration::getVersion()) ?>
+ </p>
<?= $active_bridges ?>/<?= $total_bridges ?> active bridges.<br>