mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-25 10:03:45 +00:00
Fix missing Cache namespace
This commit is contained in:
parent
191e298504
commit
8f49ff2054
1 changed files with 3 additions and 2 deletions
|
@ -10,6 +10,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
use Friendica\Core\Cache\Duration;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\Hook;
|
use Friendica\Core\Hook;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
@ -36,7 +37,7 @@ function curweather_uninstall()
|
||||||
function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cachetime = 0)
|
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";
|
$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 = DI::cache()->get('curweather'.md5($url));
|
||||||
$now = new DateTime();
|
$now = new DateTime();
|
||||||
|
|
||||||
if (!is_null($cached)) {
|
if (!is_null($cached)) {
|
||||||
|
@ -90,7 +91,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
|
||||||
];
|
];
|
||||||
|
|
||||||
DI::pConfig()->set(local_user(), 'curweather', 'last', $now->getTimestamp());
|
DI::pConfig()->set(local_user(), 'curweather', 'last', $now->getTimestamp());
|
||||||
Cache::set('curweather'.md5($url), serialize($r), Cache::HOUR);
|
DI::cache()->set('curweather'.md5($url), serialize($r), Duration::HOUR);
|
||||||
|
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue