Refactor APIs to use routing

This commit is contained in:
Dale Davies
2022-07-18 14:29:49 +01:00
parent 4b5d51ee52
commit 42568ff66c
16 changed files with 227 additions and 209 deletions

View 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);
}
}