Skip to content

Commit

Permalink
Dev: check extended template is installed before importing manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Nov 14, 2017
1 parent c8c2f84 commit 7385eaa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions application/models/TemplateManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ public static function importManifest($sTemplateName, $aDatas=array() )
$oTemplate = Template::getTemplateConfiguration($sTemplateName, null, null, true);
$aDatas['extends'] = $bExtends = (string) $oTemplate->config->metadatas->extends;

if ($bExtends && !Template::model()->findByPk($bExtends)){
Yii::app()->setFlashMessage(sprintf(gT("You can't import template '%s' because '%s' is not installed."), $sTemplateName, $bExtends ), 'error');
Yii::app()->getController()->redirect(array("admin/templateoptions"));
}

// Metadas is never inherited
$aDatas['api_version'] = (string) $oTemplate->config->metadatas->apiVersion;
$aDatas['author_email'] = (string) $oTemplate->config->metadatas->authorEmail;
Expand Down

0 comments on commit 7385eaa

Please sign in to comment.