mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-15 21:08:49 +00:00
Fixing remaining "Cache::"
This commit is contained in:
parent
b72e56c2c6
commit
c7ce4a9672
5 changed files with 18 additions and 14 deletions
|
@ -42,11 +42,11 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Registry\Core;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
@ -114,7 +114,7 @@ function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
|
|||
$vars[str_replace('-', '_', $key)] = $value;
|
||||
}
|
||||
|
||||
$rules = DI::cache()->get('rules_' . local_user());
|
||||
$rules = Core::cache()->get('rules_' . local_user());
|
||||
if (!isset($rules)) {
|
||||
$rules = DBA::toArray(DBA::select(
|
||||
'advancedcontentfilter_rules',
|
||||
|
@ -122,7 +122,7 @@ function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
|
|||
['uid' => local_user(), 'active' => true]
|
||||
));
|
||||
|
||||
DI::cache()->set('rules_' . local_user(), $rules);
|
||||
Core::cache()->set('rules_' . local_user(), $rules);
|
||||
}
|
||||
|
||||
if ($rules) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Cache\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -18,6 +18,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Registry\App as A;
|
||||
use Friendica\Registry\Core;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
|
||||
|
@ -39,7 +40,7 @@ function curweather_uninstall()
|
|||
function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cachetime = 0)
|
||||
{
|
||||
$url = "http://api.openweathermap.org/data/2.5/weather?q=" . $loc . "&appid=" . $appid . "&lang=" . $lang . "&units=" . $units . "&mode=xml";
|
||||
$cached = Cache::get('curweather'.md5($url));
|
||||
$cached = Core::cache()->get('curweather'.md5($url));
|
||||
$now = new DateTime();
|
||||
|
||||
if (!is_null($cached)) {
|
||||
|
@ -93,7 +94,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
|
|||
];
|
||||
|
||||
PConfig::set(local_user(), 'curweather', 'last', $now->getTimestamp());
|
||||
Cache::set('curweather'.md5($url), serialize($r), Cache::HOUR);
|
||||
Core::cache()->set('curweather'.md5($url), serialize($r), Cache::HOUR);
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Registry\Core;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -48,7 +49,7 @@ function geocoordinates_resolve_item(&$item)
|
|||
$coords[0] = round($coords[0], 5);
|
||||
$coords[1] = round($coords[1], 5);
|
||||
|
||||
$result = Cache::get("geocoordinates:".$language.":".$coords[0]."-".$coords[1]);
|
||||
$result = Core::cache()->get("geocoordinates:".$language.":".$coords[0]."-".$coords[1]);
|
||||
if (!is_null($result)) {
|
||||
$item["location"] = $result;
|
||||
return;
|
||||
|
@ -78,7 +79,7 @@ function geocoordinates_resolve_item(&$item)
|
|||
Logger::log("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], Logger::DEBUG);
|
||||
|
||||
if ($item["location"] != "")
|
||||
Cache::set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]);
|
||||
Core::cache()->set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]);
|
||||
}
|
||||
|
||||
function geocoordinates_post_hook($a, &$item)
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Smilies;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Cache\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Registry\App as A;
|
||||
use Friendica\Registry\Core;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
|
||||
|
@ -74,12 +75,12 @@ function mastodoncustomemojis_get_custom_emojis_for_author($author_link)
|
|||
|
||||
$cache_key = 'mastodoncustomemojis:' . $api_base_url;
|
||||
|
||||
$return = Cache::get($cache_key);
|
||||
$return = Core::cache()->get($cache_key);
|
||||
|
||||
if (empty($return) || Config::get('system', 'ignore_cache')) {
|
||||
$return = mastodoncustomemojis_fetch_custom_emojis_for_url($api_base_url);
|
||||
|
||||
Cache::set($cache_key, $return, empty($return['texts']) ? Cache::QUARTER_HOUR : Cache::HOUR);
|
||||
Core::cache()->set($cache_key, $return, empty($return['texts']) ? Cache::QUARTER_HOUR : Cache::HOUR);
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Cache\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Registry\App;
|
||||
use Friendica\Registry\Core;
|
||||
use Friendica\Util\ConfigFileLoader;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -131,13 +132,13 @@ function openstreetmap_get_coordinates($a, &$b)
|
|||
$args = '?q=' . urlencode($b['location']) . '&format=json';
|
||||
|
||||
$cachekey = "openstreetmap:" . $b['location'];
|
||||
$j = Cache::get($cachekey);
|
||||
$j = Core::cache()->get($cachekey);
|
||||
|
||||
if (is_null($j)) {
|
||||
$curlResult = Network::curl($nomserver . $args);
|
||||
if ($curlResult->isSuccess()) {
|
||||
$j = json_decode($curlResult->getBody(), true);
|
||||
Cache::set($cachekey, $j, Cache::MONTH);
|
||||
Core::cache()->set($cachekey, $j, Cache::MONTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue