mirror of
https://github.com/daledavies/jump.git
synced 2026-01-08 08:22:07 +01:00
35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* ██ ██ ██ ███ ███ ██████
|
|
* ██ ██ ██ ████ ████ ██ ██
|
|
* ██ ██ ██ ██ ████ ██ ██████
|
|
* ██ ██ ██ ██ ██ ██ ██ ██
|
|
* █████ ██████ ██ ██ ██
|
|
*
|
|
* @author Dale Davies <dale@daledavies.co.uk>
|
|
* @copyright Copyright (c) 2022, Dale Davies
|
|
* @license MIT
|
|
*/
|
|
|
|
namespace Jump\API;
|
|
|
|
class Unsplash extends AbstractAPI {
|
|
|
|
public function get_output(): string {
|
|
|
|
$this->validate_token();
|
|
|
|
$unsplashdata = $this->cache->load(cachename: 'unsplash');
|
|
|
|
if ($unsplashdata == null) {
|
|
$unsplashdata = \Jump\Unsplash::load_cache_unsplash_data($this->config);
|
|
$this->cache->save(cachename: 'unsplash', data: $unsplashdata);
|
|
}
|
|
|
|
$toexec = '/usr/bin/nohup /usr/bin/php -f ' . $this->config->get('wwwroot') . '/cli/cacheunsplash.php >/dev/null 2>&1 &';
|
|
shell_exec($toexec);
|
|
|
|
return json_encode($unsplashdata);
|
|
}
|
|
}
|