Add scrutinizer checks, and attempt to create cache folders if they do not exist
This commit is contained in:
parent
5e126819e2
commit
24fb6b9815
10
.travis.yml
10
.travis.yml
@ -9,4 +9,12 @@ php:
|
||||
- 5.6
|
||||
- 7
|
||||
- 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";
|
||||
|
||||
$config = [
|
||||
/*'query' => [
|
||||
'username' => $this->config->hummingbird_username,
|
||||
],*/
|
||||
'allow_redirects' => false
|
||||
];
|
||||
|
||||
@ -207,6 +204,11 @@ class AnimeModel extends BaseApiModel {
|
||||
|
||||
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
|
||||
file_put_contents($cache_file, json_encode($output));
|
||||
}
|
||||
|
@ -111,6 +111,12 @@ class MangaModel extends BaseApiModel {
|
||||
// Reorganize data to be more usable
|
||||
$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
|
||||
file_put_contents($cache_file, json_encode($raw_data));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user