aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Category.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-03-10 23:04:17 +0100
committerGravatar GitHub <noreply@github.com> 2024-03-10 23:04:17 +0100
commitd0072b9fb73a6582c98c7b5a44daf2d6ca39636e (patch)
treebf1992ca2ca7c6ae65c5a63bdb66bf2f4b7850a6 /app/Models/Category.php
parent01eaaed9bb2268bc1d0509ca4f33d4b075634c9a (diff)
Refactor some cURL options and use CURLOPT_USERPWD (#6177)
* Refactor some cURL options and use CURLOPT_USERPWD fix https://github.com/FreshRSS/FreshRSS/issues/6176 * Fixes
Diffstat (limited to 'app/Models/Category.php')
-rw-r--r--app/Models/Category.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 6674b4e72..13bb184d5 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -94,6 +94,11 @@ class FreshRSS_Category extends Minz_Model {
return $this->nbNotRead;
}
+ /** @return array<int,mixed> */
+ public function curlOptions(): array {
+ return []; // TODO (e.g., credentials for Dynamic OPML)
+ }
+
/**
* @return array<int,FreshRSS_Feed>
* @throws Minz_ConfigurationNamespaceException
@@ -158,11 +163,10 @@ class FreshRSS_Category extends Minz_Model {
}
/**
- * @param array<string> $attributes
* @throws FreshRSS_Context_Exception
*/
- public static function cacheFilename(string $url, array $attributes): string {
- $simplePie = customSimplePie($attributes);
+ public function cacheFilename(string $url): string {
+ $simplePie = customSimplePie($this->attributes(), $this->curlOptions());
$filename = $simplePie->get_cache_filename($url);
return CACHE_PATH . '/' . $filename . '.opml.xml';
}
@@ -173,9 +177,8 @@ class FreshRSS_Category extends Minz_Model {
return false;
}
$ok = true;
- $attributes = []; //TODO
- $cachePath = self::cacheFilename($url, $attributes);
- $opml = httpGet($url, $cachePath, 'opml', $attributes);
+ $cachePath = $this->cacheFilename($url);
+ $opml = httpGet($url, $cachePath, 'opml', $this->attributes(), $this->curlOptions());
if ($opml == '') {
Minz_Log::warning('Error getting dynamic OPML for category ' . $this->id() . '! ' .
SimplePie_Misc::url_remove_credentials($url));