Add scrutinizer checks, and attempt to create cache folders if they do not exist
This commit is contained in:
parent
5e126819e2
commit
24fb6b9815
@ -10,3 +10,11 @@ php:
|
|||||||
- 7
|
- 7
|
||||||
- hhvm
|
- hhvm
|
||||||
- nightly
|
- nightly
|
||||||
|
|
||||||
|
script:
|
||||||
|
- mkdir -p build/logs
|
||||||
|
- phpunit --coverage-clover=coverage.clover
|
||||||
|
|
||||||
|
after_script:
|
||||||
|
- wget https://scrutinizer-ci.com/ocular.phar
|
||||||
|
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
|
@ -174,9 +174,6 @@ class AnimeModel extends BaseApiModel {
|
|||||||
$cache_file = "{$this->config->data_cache_path}/anime-{$status}.json";
|
$cache_file = "{$this->config->data_cache_path}/anime-{$status}.json";
|
||||||
|
|
||||||
$config = [
|
$config = [
|
||||||
/*'query' => [
|
|
||||||
'username' => $this->config->hummingbird_username,
|
|
||||||
],*/
|
|
||||||
'allow_redirects' => false
|
'allow_redirects' => false
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -207,6 +204,11 @@ class AnimeModel extends BaseApiModel {
|
|||||||
|
|
||||||
if (( ! file_exists($cache_file)) || file_get_contents($cache_file) !== $output_json)
|
if (( ! file_exists($cache_file)) || file_get_contents($cache_file) !== $output_json)
|
||||||
{
|
{
|
||||||
|
// Attempt to create the cache folder if it doesn't exist
|
||||||
|
if ( ! is_dir($this->config->data_cache_path))
|
||||||
|
{
|
||||||
|
mkdir($this->config->data_cache_path);
|
||||||
|
}
|
||||||
// Cache the call in case of downtime
|
// Cache the call in case of downtime
|
||||||
file_put_contents($cache_file, json_encode($output));
|
file_put_contents($cache_file, json_encode($output));
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,12 @@ class MangaModel extends BaseApiModel {
|
|||||||
// Reorganize data to be more usable
|
// Reorganize data to be more usable
|
||||||
$raw_data = $response->json();
|
$raw_data = $response->json();
|
||||||
|
|
||||||
|
// Attempt to create the cache dir if it doesn't exist
|
||||||
|
if ( ! is_dir($config->data_cache_path))
|
||||||
|
{
|
||||||
|
mkdir($config->data_cache_path);
|
||||||
|
}
|
||||||
|
|
||||||
// Cache data in case of downtime
|
// Cache data in case of downtime
|
||||||
file_put_contents($cache_file, json_encode($raw_data));
|
file_put_contents($cache_file, json_encode($raw_data));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user