mirror of
https://github.com/daledavies/jump.git
synced 2026-02-26 08:10:47 +01:00
Refactor APIs to use routing
This commit is contained in:
23
jumpapp/classes/API/Unsplash.php
Normal file
23
jumpapp/classes/API/Unsplash.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user