Skip to content

Commit

Permalink
[K5.2] Check before install template that are compatible (Part 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
xillibit committed Dec 22, 2020
1 parent 5b9bc53 commit 13769ab
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/libraries/kunena/template/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ public static function parseKunenaInstallFile($path)

$data = new stdClass;
$data->name = (string) $xml->name;
$data->targetversion = (string) $xml->targetversion->attributes()->version;
if ($xml->targetversion->attributes()!==null)
{
$data->targetversion = (string) $xml->targetversion->attributes()->version;
}

$data->type = (string) $xml->attributes()->type;
$data->creationdate = (string) $xml->creationDate;
$data->author = (string) $xml->author;
Expand Down Expand Up @@ -193,8 +197,13 @@ public static function parseKunenaInstallFile($path)
* @return boolean
* @since Kunena 5.2
*/
public static function templateIsKunenaCompatible($targetversion)
public static function templateIsKunenaCompatible($targetversion = null)
{
if ($targetversion === null)
{
return true;
}

// Get the Kunena version family (e.g. 5.2)
$kVersion = KunenaForum::version();
$kVersionParts = explode('.', $kVersion);
Expand All @@ -215,6 +224,8 @@ public static function templateIsKunenaCompatible($targetversion)
{
return false;
}

return true;
}

/**
Expand Down

0 comments on commit 13769ab

Please sign in to comment.