mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-16 21:58:21 +01:00
fix(arstechnica): plus a few unrelated tweaks (#3829)
This commit is contained in:
parent
0b67544f86
commit
f01729c86f
@ -31,6 +31,7 @@ final class FrontpageAction implements ActionInterface
|
||||
}
|
||||
}
|
||||
|
||||
// todo: cache this renderered template
|
||||
return render(__DIR__ . '/../templates/frontpage.html.php', [
|
||||
'messages' => $messages,
|
||||
'admin_email' => Configuration::getConfig('admin', 'email'),
|
||||
|
@ -37,7 +37,14 @@ class ArsTechnicaBridge extends FeedExpander
|
||||
{
|
||||
$item_html = getSimpleHTMLDOMCached($item['uri'] . '&');
|
||||
$item_html = defaultLinkTo($item_html, self::URI);
|
||||
$item['content'] = $item_html->find('.amp-wp-article-content', 0);
|
||||
|
||||
$item_content = $item_html->find('.article-content.post-page', 0);
|
||||
if (!$item_content) {
|
||||
// The dom selector probably broke. Let's just return the item as-is
|
||||
return $item;
|
||||
}
|
||||
|
||||
$item['content'] = $item_content;
|
||||
|
||||
// remove various ars advertising
|
||||
$item['content']->find('#social-left', 0)->remove();
|
||||
|
@ -523,7 +523,7 @@ class VkBridge extends BridgeAbstract
|
||||
}
|
||||
|
||||
if (!preg_match('#^https?://vk.com/#', $uri)) {
|
||||
returnServerError('Unexpected redirect location');
|
||||
returnServerError('Unexpected redirect location: ' . $uri);
|
||||
}
|
||||
|
||||
$redirects++;
|
||||
|
@ -49,8 +49,8 @@ class FileCache implements CacheInterface
|
||||
{
|
||||
$item = [
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
'expiration' => $ttl === null ? 0 : time() + $ttl,
|
||||
'value' => $value,
|
||||
];
|
||||
$cacheFile = $this->createCacheFile($key);
|
||||
$bytes = file_put_contents($cacheFile, serialize($item), LOCK_EX);
|
||||
|
@ -6,7 +6,11 @@ if (version_compare(\PHP_VERSION, '7.4.0') === -1) {
|
||||
|
||||
require_once __DIR__ . '/lib/bootstrap.php';
|
||||
|
||||
Configuration::verifyInstallation();
|
||||
$errors = Configuration::checkInstallation();
|
||||
if ($errors) {
|
||||
die('<pre>' . implode("\n", $errors) . '</pre>');
|
||||
}
|
||||
|
||||
$customConfig = [];
|
||||
if (file_exists(__DIR__ . '/config.ini.php')) {
|
||||
$customConfig = parse_ini_file(__DIR__ . '/config.ini.php', true, INI_SCANNER_TYPED);
|
||||
|
@ -15,15 +15,7 @@ final class Configuration
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies the current installation of RSS-Bridge and PHP.
|
||||
*
|
||||
* Returns an error message and aborts execution if the installation does
|
||||
* not satisfy the requirements of RSS-Bridge.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function verifyInstallation()
|
||||
public static function checkInstallation(): array
|
||||
{
|
||||
$errors = [];
|
||||
|
||||
@ -57,10 +49,7 @@ final class Configuration
|
||||
if (!extension_loaded('json')) {
|
||||
$errors[] = 'json extension not loaded';
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
throw new \Exception(sprintf('Configuration error: %s', implode(', ', $errors)));
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
public static function loadConfiguration(array $customConfig = [], array $env = [])
|
||||
|
Loading…
x
Reference in New Issue
Block a user