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

Commit

Permalink
Better feature detection according to Craft license version
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Olde Hampsink committed Feb 5, 2015
1 parent 7560e23 commit 8dde236
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion controllers/Import_HistoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public function actionRevert()
{

// If entry revisions are supported
if(isset(craft()->entryRevisions)) {
if(craft()->getEdition() == Craft::Pro) {

// Get history id
$history = craft()->request->getParam('id');
Expand Down
13 changes: 10 additions & 3 deletions records/Import_EntriesRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ public function getTableName()

public function defineRelations()
{
return array(
$relations = array(
'history' => array(static::BELONGS_TO, 'Import_HistoryRecord'),
'entry' => array(static::BELONGS_TO, 'EntryRecord', 'onDelete' => static::CASCADE),
'version' => array(static::BELONGS_TO, 'EntryVersionRecord', 'onDelete' => static::CASCADE)
'entry' => array(static::BELONGS_TO, 'EntryRecord', 'onDelete' => static::CASCADE)
);

// If entry revisions are supported
if (craft()->getEdition() == Craft::Pro)
{
$relations['version'] = array(static::BELONGS_TO, 'EntryVersionRecord', 'onDelete' => static::CASCADE);
}

return $relations;
}

}
2 changes: 1 addition & 1 deletion services/Import_EntryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function save(EntryModel &$element, $settings)
if(craft()->entries->saveEntry($element)) {

// If entry revisions are supported
if(isset(craft()->entryRevisions)) {
if(craft()->getEdition() == Craft::Pro) {

// Log element id's when successful
craft()->import_history->version($settings['history'], $element->id);
Expand Down
2 changes: 1 addition & 1 deletion services/Import_UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function getGroups()
{

// Check if usergroups are allowed in this installation
if(isset(craft()->userGroups)) {
if(craft()->getEdition() == Craft::Pro) {

// Get usergroups
$groups = craft()->userGroups->getAllGroups();
Expand Down

0 comments on commit 8dde236

Please sign in to comment.