Skip to content

Commit

Permalink
version 1.4.0
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Crawford <[email protected]>
  • Loading branch information
engram-design committed Nov 26, 2015
1 parent d6b3a6f commit 7ae5ed6
Show file tree
Hide file tree
Showing 28 changed files with 397 additions and 641 deletions.
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
## Changelog

#### 1.4.0

- Craft 2.5 support, including release feed and icons.
- Code cleanup and refactoring field-mapping logic for performance and sanity.
- Rewritten Matrix/Table mapping and processing logic. **Matrix and Table fields will need to be re-mapped**.
- Fix for mapping multiple Matrix blocks being out of order from original feed.
- Removed Super Table native support - please ensure you have the 0.3.9 release of Super Table. **Super Table fields will need to be re-mapped**.
- Modified third-party hooks `prepForFeedMeFieldType` so it actually works! Thanks go to [@lindseydiloreto](https://github.com/lindseydiloreto).
- Added `registerFeedMeMappingOptions` for third-party fieldtypes to control the options for mapping feed nodes to field data.
- Added `postForFeedMeFieldType` for third-party fieldtypes to modify entry data before being saved to entry.
- Added documentation for hooks. Refer to [Wiki](https://github.com/engram-design/FeedMe/wiki/Hooks).
- Less strict user matching - should match against almost any value related to user.
- Allow for Environment Variables to be used in the feed url.

#### 1.3.6

- Removed `file_get_contents` as default method of fetching feed data in favour of Curl.
- Better error logging when trying to consume feed data.
- Fix for when mapping to Matrix field, commas were escaping content into new blocks.
- Ensure fields within Matrix and SuperTable are parsed through necessary field processing functions.
- Added `prepForFeedMeFieldType` hook for other plugins to handle their own fields.

#### 1.3.5

- Minor fix for logging. When Delete duplication option was set, import success was never recorded in the logs.
Expand Down Expand Up @@ -104,4 +126,3 @@
#### 1.0

- Initial release.

39 changes: 24 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ A common use-case for this plugin is to consume external feeds (news, events), b
- Database backups before each feed processing.
- Troubleshoot feed processing issues with logs.
- Grab feed data directly from your twig templates.
- Craft 2.5 compatible.


## Install
Expand All @@ -28,6 +29,7 @@ A common use-case for this plugin is to consume external feeds (news, events), b

- Change the plugin name as it appear in the CP navigation.
- Set the default cache (for calls using the template tag only).
- Enable or disable specific tabs for Feed Me.


## Usage
Expand All @@ -47,6 +49,8 @@ Enter the required details to configure your feed:

Then, select what data from the feed you wish to capture, and what fields to map it to, depending on your Section and Entry Type selection. Here you'll be able to choose which fields (can be more than one) you'd like to compare to determine if a feed item is a duplicate.

You must map data to at least the Title field, or any other required field for your entry.

<img src="https://raw.githubusercontent.com/engram-design/FeedMe/master/screenshots/mapping_2.png" />

Save the feed for later, or start the import.
Expand Down Expand Up @@ -77,22 +81,31 @@ Feed Me supports mapping data from your feeds to the following Fieldtypes:
- Tags
- Users

**Third-Party**

- Super Table
- SmartMap


###Element Creation

For certain elements, it may be benefitial to create the element's data, if not already created. Like if an Asset doesn't exist in your Assets collection, upload it. Similarly with Categories, and other fields.

Currently, Feed Me handles the following applicable fields in these ways:

**Assets:** Only supports mapping existing assets to this entry. Must provide filename (without extension) to successfully map.
**Assets:** Only supports mapping existing assets to this entry.

**Categories:** Are created if they do not exist, or mapped if they do. The value provided in the feed data must be the Name for the category.
**Categories:** Are created if they do not exist, or mapped if they do.

**Entries:** Only supports mapping existing entries to this entry. The feed field must contain either the Title or Slug of the entry to successfully map.

**Tags:** Are always created.

**Users:** Only supports mapping existing users to this entry. The feed field must contain either the users email or username to successfully map.
**Users:** Only supports mapping existing users to this entry.

Internally, Feed Me uses Craft's element search to match against the value in your feed for an element. For example, if you have `my_filename.png` as a value in your feed, and you are mapping to an Asset, ensure that searching through the Assets index screen actually returns what you expect.

For troubleshooting, ensure you have completed the Rebuild Search Indexes task.

We plan to include options for whether you would like to do this on a per-field basis.

Expand Down Expand Up @@ -194,6 +207,11 @@ For XML-based feeds, you will also have access to all attributes for a particula
If you're looking to consume REST feeds, APIs or other third-party platforms (Facebook, Twitter, etc), I would highly recommend using [alecritson's Placid](https://github.com/alecritson/Placid) plugin, which supports a great deal more than this plugin offers.


## Hooks

For third-party field type integration, consult the [Wiki](https://github.com/engram-design/FeedMe/wiki/Hooks).


## Roadmap

- Improve mapping by:
Expand All @@ -208,7 +226,7 @@ If you're looking to consume REST feeds, APIs or other third-party platforms (Fa
- Allow feed processing to be reverted
- Support authentication for feed access (Basic, OAuth, Token)
- Organise documentation into Wiki
- Fix issue with mapping of Assets and the source not being set to All.
- Fix issue with mapping of Assets and the source not being set to All (not reproducible).

Have a suggestion? We'd love to hear about it! [Make a suggestion](https://github.com/engram-design/FeedMe/issues)

Expand All @@ -224,20 +242,11 @@ Otherwise, either [Submit an issue](https://github.com/engram-design/FeedMe/issu

## Thanks / Contributions

A massive thanks to [Bob Olde Hampsink](https://github.com/boboldehampsink) and his amazing work on the [Import](https://github.com/boboldehampsink/import) plugin, which this plugin is clearly influenced by, and [Clearbold](https://github.com/clearbold) for [Craft Import](https://github.com/clearbold/craftimport).
A massive thanks to [Bob Olde Hampsink](https://github.com/boboldehampsink) and his amazing work on the [Import](https://github.com/boboldehampsink/import) plugin, which this plugin is clearly influenced by, and [Clearbold](https://github.com/clearbold) for [Craft Import](https://github.com/clearbold/craftimport), along with all the great users who have helped provide feedback, testing and bug reports.

[Pixel & Tonic](https://github.com/pixelandtonic) for their amazing support, assistance, and of course for creating Craft.


## Changelog

#### 1.3.6

- Removed `file_get_contents` as default method of fetching feed data in favour of Curl.
- Better error logging when trying to consume feed data.
- Fix for when mapping to Matrix field, commas were escaping content into new blocks.
- Ensure fields within Matrix and SuperTable are parsed through necessary field processing functions.
- Added `prepForFeedMeFieldType` hook for other plugins to handle their own fields.


[View Full Changelog](https://github.com/engram-design/FeedMe/blob/master/CHANGELOG.md)
[View JSON Changelog](https://github.com/engram-design/FeedMe/blob/master/changelog.json)
24 changes: 24 additions & 0 deletions changelog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"version": "1.4.0",
"downloadUrl": "https://github.com/engram-design/FeedMe/archive/1.4.0.zip",
"date": "2015-11-26 00:00:00",
"notes": [
"[Added] Craft 2.5 support, including release feed and icons.",
"[Improved] Code cleanup and refactoring field-mapping logic for performance and sanity.",
"[Improved] Rewritten Matrix/Table mapping and processing logic. **Matrix and Table fields will need to be re-mapped**.",
"[Improved] Removed Super Table native support - please ensure you have the 0.3.9 release of Super Table. **Super Table fields will need to be re-mapped**.",
"[Improved] Less strict user matching - should match against almost any value related to user.",
"[Improved] Allow for Environment Variables to be used in the feed url."
"[Improved] Better feedback on feed failure. Will fail task if _any_ feed node encounters an issue, and will show the red failed task indicator (prompting you to look at the logs)."
"[Fixed] Fix for mapping multiple Matrix blocks being out of order from original feed.",
"[Fixed] Fix issue with task not firing when running from Control Panel. In some cases, this meant not even logging information was being recorded if something went wrong. This did not effect running directly.",

"# Third-Party Hooks",
"[Added] Added `registerFeedMeMappingOptions` for third-party fieldtypes to control the options for mapping feed nodes to field data.",
"[Added] Added `postForFeedMeFieldType` for third-party fieldtypes to modify entry data before being saved to entry.",
"[Added] Added documentation for hooks. Refer to [Wiki](https://github.com/engram-design/FeedMe/wiki/Hooks).",
"[Improved] Modified third-party hooks `prepForFeedMeFieldType` so it actually works! Thanks go to [@lindseydiloreto](https://github.com/lindseydiloreto).",
]
}
]
16 changes: 0 additions & 16 deletions composer.json

This file was deleted.

51 changes: 31 additions & 20 deletions feedme/FeedMePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

class FeedMePlugin extends BasePlugin
{
/* --------------------------------------------------------------
* PLUGIN INFO
* ------------------------------------------------------------ */
// =========================================================================
// PLUGIN INFO
// =========================================================================

public function getName()
{
Expand All @@ -22,9 +22,18 @@ public function getName()
return ($pluginNameOverride) ? $pluginNameOverride : $pluginName;
}

public function getDescription(){
return '';
}

public function getVersion()
{
return '1.3.6';
return '1.4.0';
}

public function getSchemaVersion()
{
return '1.0.0';
}

public function getDeveloper()
Expand All @@ -42,6 +51,16 @@ public function getPluginUrl()
return 'https://github.com/engram-design/FeedMe';
}

public function getDocumentationUrl()
{
return $this->getPluginUrl() . '/blob/master/README.md';
}

public function getReleaseFeedUrl()
{
return $this->getPluginUrl() . '/blob/master/changelog.json';
}

public function hasCpSection()
{
return true;
Expand Down Expand Up @@ -76,26 +95,18 @@ public function registerCpRoutes()
);
}

public function onAfterInstall()
{
$minBuild = '2636';

if (craft()->getBuild() < $minBuild) {
craft()->plugins->disablePlugin($this->getClassHandle());

craft()->plugins->uninstallPlugin($this->getClassHandle());

craft()->userSession->setError(Craft::t('{plugin} only works on Craft build {build} or higher', array(
'plugin' => $this->getName(),
'build' => $minBuild,
)));
public function onBeforeInstall()
{
// Craft 2.3.2636 fixed an issue with BaseEnum::getConstants()
if (version_compare(craft()->getVersion() . '.' . craft()->getBuild(), '2.3.2636', '<')) {
throw new Exception($this->getName() . ' requires Craft CMS 2.3.2636+ in order to run.');
}
}


/* --------------------------------------------------------------
* HOOKS
* ------------------------------------------------------------ */
// =========================================================================
// HOOKS
// =========================================================================

public function addTwigExtension()
{
Expand Down
3 changes: 3 additions & 0 deletions feedme/controllers/FeedMeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

class FeedMeController extends BaseController
{
// Public Methods
// =========================================================================

public function actionGetEntryTypes()
{
// Only ajax post requests
Expand Down
36 changes: 29 additions & 7 deletions feedme/controllers/FeedMe_FeedsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@

class FeedMe_FeedsController extends BaseController
{
// Properties
// =========================================================================

protected $allowAnonymous = array('actionRunTask');


// Public Methods
// =========================================================================

public function actionFeedsIndex()
{
$variables['feeds'] = craft()->feedMe_feeds->getFeeds();
Expand Down Expand Up @@ -152,6 +159,9 @@ public function runImportTask($feedId) {
// Create the import task
craft()->tasks->createTask('FeedMe', $feed->name, $settings);

// Trigger the task to run right now!
$this->_runPendingTasks();

// if not using the direct param for this request, so UI stuff
craft()->userSession->setNotice(Craft::t('Feed processing started.'));

Expand All @@ -165,20 +175,32 @@ public function runImportTask($feedId) {
craft()->tasks->createTask('FeedMe', $feed->name, $settings);

// Trigger the task to run right now!
if (!craft()->tasks->isTaskRunning()) {
$task = craft()->tasks->getNextPendingTask();

if ($task) {
craft()->tasks->runPendingTasks();
}
}
$this->_runPendingTasks();

// Let the requester know whats going on.
$this->returnJson(array('success' => 'Feed ID: '.$feed['id'].' - Task started'));
} else {
$this->returnJson(array('error' => 'Invalid Passkey'));
}
}


}



// Private Methods
// =========================================================================

private function _runPendingTasks()
{
if (!craft()->tasks->isTaskRunning()) {
$task = craft()->tasks->getNextPendingTask();

if ($task) {
craft()->tasks->runPendingTasks();
}
}
}

}
3 changes: 3 additions & 0 deletions feedme/controllers/FeedMe_LogsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

class FeedMe_LogsController extends BaseController
{
// Public Methods
// =========================================================================

public function actionLogs()
{
craft()->config->maxPowerCaptain();
Expand Down
3 changes: 3 additions & 0 deletions feedme/controllers/FeedMe_SupportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

class FeedMe_SupportController extends BaseController
{
// Public Methods
// =========================================================================

public function actionSendSupportRequest()
{
$this->requirePostRequest();
Expand Down
18 changes: 18 additions & 0 deletions feedme/resources/icon-mask.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7ae5ed6

Please sign in to comment.