Skip to content
This repository has been archived by the owner on Apr 13, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/3.0.9' into v3
Browse files Browse the repository at this point in the history
* release/3.0.9:
  added 3.0.9 change info
  v 3.0.9 checks for missinig "meta" obj Instagram feed
  • Loading branch information
johnfmorton committed Apr 3, 2018
2 parents c396e58 + 02c8a3e commit e8ea75d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 3.0.9 - 2018-04-04
### Fixed
- Instagram feed has been missinig "meta" object for some users. This update is fixed to check for the presence of "meta". If missing it will attempt to serve stale cache if available.

## 3.0.8 - 2018-03-15
### Fixed
- License text fix.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jmx2/pic-puller",
"description": "Integrate Instagram into Craft CMS.",
"type": "craft-plugin",
"version": "3.0.8",
"version": "3.0.9",
"keywords": [
"craft",
"cms",
Expand Down
3 changes: 3 additions & 0 deletions src/PicPuller.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class PicPuller extends Plugin
*/
public static $plugin;

// The actual version number is iin the composer.json file
// This is only the schema version. A change in scheme versioni
// trigger a database change.
public $schemaVersion = '3.0.5';
public $hasCpSettings = true;
public $hasCpSection = true;
Expand Down
9 changes: 8 additions & 1 deletion src/services/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,14 @@ private function _fetch_data ($url , $use_stale_cache)

private function _validate_data ($data , $url , $use_stale_cache)
{
$meta = $data['meta'];
if ( array_key_exists('meta', $data) ){
$meta = $data['meta'];
} else {
// Sometimes the Instagram returns a malformed JSON object
// without the expected meta object
$meta['code'] = false;
}

// meta > code equal to 200 means we have a successful request returned
if ($meta['code'] == 200) {
// There is an outlying chance that IG says 200, but the data array is empty.
Expand Down

0 comments on commit e8ea75d

Please sign in to comment.