Skip to content

Commit

Permalink
Merge branch 'release/v2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
amazeika committed Jan 20, 2015
2 parents ed8b6fd + 18e6a91 commit 9b47274
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 0 deletions.
88 changes: 88 additions & 0 deletions install.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php
/**
* @package LOGman
* @copyright Copyright (C) 2011 - 2014 Timble CVBA. (http://www.timble.net)
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://www.joomlatools.com
*/

/**
* LOGman - K2 installer
*
* @author Arunas Mazeika <https://github.com/amazeika>
* @package Joomlatools\Component\LOGman
*/
class plgLogmanK2InstallerScript
{
/**
* @var string The current installed LOGman version.
*/
protected $_logman_ver = null;

public function preflight($type, $installer)
{
$return = true;
$errors = array();

if (!class_exists('Koowa') || !class_exists('ComExtmanControllerExtension'))
{
if (file_exists(JPATH_ADMINISTRATOR.'/components/com_extman/extman.php') && !JPluginHelper::isEnabled('system', 'koowa')) {
$errors[] = sprintf(JText::_('This component requires System - Nooku Framework plugin to be installed and enabled. Please go to <a href=%s>Plugin Manager</a>, enable <strong>System - Nooku Framework</strong> and try again'), JRoute::_('index.php?option=com_plugins&view=plugins&filter_folder=system'));
}
else $errors[] = JText::_('This component requires EXTman to be installed on your site. Please download this component from <a href=http://joomlatools.com target=_blank>joomlatools.com</a> and install it');

$return = false;
}

// Check LOGman version.
if ($return === true)
{
if (version_compare($this->getLogmanVersion(), '2.0.2', '<'))
{
$errors[] = JText::_('This component requires a newer LOGman version. Please download the latest version from <a href=http://joomlatools.com target=_blank>joomlatools.com</a> and upgrade.');
$return = false;
}
}

if ($return == false && $errors)
{
$error = implode('<br />', $errors);
$installer->getParent()->abort($error);
}

return $return;
}

/**
* Returns the current version (if any) of LOGman.
*
* @return string|null The LOGman version if present, null otherwise.
*/
public function getLogmanVersion()
{
if (!$this->_logman_ver) {
$this->_logman_ver = $this->_getExtensionVersion('com_logman');
}

return $this->_logman_ver;
}

/**
* Extension version getter.
*
* @param string $element The element name, e.g. com_extman, com_logman, etc.
* @return mixed|null|string The extension version, null if couldn't be determined.
*/
protected function _getExtensionVersion($element)
{
$version = null;

$query = "SELECT manifest_cache FROM #__extensions WHERE element = '{$element}'";
if ($result = JFactory::getDBO()->setQuery($query)->loadResult()) {
$manifest = new JRegistry($result);
$version = $manifest->get('version', null);
}

return $version;
}
}
3 changes: 3 additions & 0 deletions k2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
<version>2.0.0</version>
<description>PLG_LOGMAN_K2_DESC</description>

<scriptfile>install.php</scriptfile>

<files>
<filename plugin="k2">k2.php</filename>
<filename>version.php</filename>
<folder>activity</folder>
<folder>language</folder>
</files>
Expand Down
43 changes: 43 additions & 0 deletions version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* @package LOGman
* @copyright Copyright (C) 2011 - 2014 Timble CVBA. (http://www.timble.net)
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://www.joomlatools.com
*/

/**
* Version
*
* @author Arunas Mazeika <https://github.com/amazeika>
* @package Joomlatools\Plugin\LOGman
*/
class PlgLogmanK2Version extends KObject
{
const VERSION = '2.0.0';

/**
* The LOGman API version used by the plugin. i.e. the LOGman version that got used for developing this plugin.
*/
const API_VERSION = '2.0.2';

/**
* Get the version
*
* @return string
*/
public function getVersion()
{
return self::VERSION;
}

/**
* Get the LOGman API version.
*
* @return string
*/
public function getApiVersion()
{
return self::API_VERSION;
}
}

0 comments on commit 9b47274

Please sign in to comment.