Commit 8cc7af42 authored by BohdanDmytryshyn's avatar BohdanDmytryshyn
Browse files

Merge branch 'release_4_1_3' into 'master'

Add 'extension name verification' item to settings form

See merge request !35
parents ca8b5f03 f64d9c6b
......@@ -35,6 +35,9 @@ class CRM_CiviMobileAPI_Form_Settings extends CRM_Core_Form {
$serverKeyValidMessage = FALSE;
$folderPermissionMessage = FALSE;
$serverKeyInValidMessage = FALSE;
$currentExtensionName = CRM_CiviMobileAPI_Utils_Extension::getCurrentExtensionName();
$currentExtensionPath = CRM_CiviMobileAPI_Utils_Extension::getCurrentExtensionPath();
$isCorrectExtensionName = CRM_CiviMobileAPI_Utils_Extension::isCorrectExtensionName();
if ($version->isCurrentVersionLowerThanRepositoryVersion()) {
$oldCivicrmMessage = ts('You are using CiviMobile <strong>%1</strong>. The latest version is CiviMobile <strong>%2</strong>', [
......@@ -62,6 +65,10 @@ class CRM_CiviMobileAPI_Form_Settings extends CRM_Core_Form {
$this->assign('latestCivicrmMessage', $latestCivicrmMessage);
$this->assign('oldCivicrmMessage', $oldCivicrmMessage);
$this->assign('folderPermissionMessage', $folderPermissionMessage);
$this->assign('currentExtensionName', $currentExtensionName);
$this->assign('currentExtensionPath', $currentExtensionPath);
$this->assign('isCorrectExtensionName', $isCorrectExtensionName);
$this->assign('correctExtensionName', CRM_CiviMobileAPI_ExtensionUtil::LONG_NAME);
}
/**
......
......@@ -24,7 +24,7 @@ class CRM_CiviMobileAPI_Upgrader extends CRM_CiviMobileAPI_Upgrader_Base {
public function upgrade_0003() {
CRM_CiviMobileAPI_Install_Install::run();
return TRUE;
}
......@@ -41,7 +41,7 @@ class CRM_CiviMobileAPI_Upgrader extends CRM_CiviMobileAPI_Upgrader_Base {
try {
$this->executeSql('ALTER TABLE civicrm_contact_push_notification_messages ADD invoke_contact_id INT(10) UNSIGNED NULL');
} catch (Exception $e) {}
return TRUE;
}
......@@ -49,7 +49,7 @@ class CRM_CiviMobileAPI_Upgrader extends CRM_CiviMobileAPI_Upgrader_Base {
try {
$this->executeSql('ALTER TABLE civicrm_contact_push_notification_messages ADD message_title varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL');
} catch (Exception $e) {}
return TRUE;
}
......
......@@ -87,4 +87,35 @@ class CRM_CiviMobileAPI_Utils_Extension {
return is_writable_r($extensionPath);
}
/**
* Returns current extension path
* Be careful when move this method
*
* @return bool|string
*/
public static function getCurrentExtensionPath() {
return realpath(__DIR__ . '/../../../');
}
/**
* Returns current extension name
*
* @return string
*/
public static function getCurrentExtensionName() {
$path = static::getCurrentExtensionPath();
$separatedPath = explode('/', $path);
return end($separatedPath);
}
/**
* Checks if is correct extension name
*
* @return bool
*/
public static function isCorrectExtensionName() {
return static::getCurrentExtensionName() == CRM_CiviMobileAPI_ExtensionUtil::LONG_NAME;
}
}
......@@ -14,8 +14,8 @@
<url desc="Support">https://agiliway.com</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2019-09-24</releaseDate>
<version>4.1.2</version>
<releaseDate>2019-10-01</releaseDate>
<version>4.1.3</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
......
......@@ -98,6 +98,32 @@
</td>
</tr>
{if !$isCorrectExtensionName}
<tr class="crm-group-form-block-isReserved">
<td class="label">
<label>{ts}Extension name doesn't correct{/ts}</label>
</td>
<td>
<div>
<div class="status">
<div>
<span>{ts}Current extension name:{/ts}</span>
<span><strong>{$currentExtensionName}</strong></span>
</div>
<div>
<span>{ts}Required extension name:{/ts}</span>
<span><strong>{$correctExtensionName}</strong></span>
</div>
<div>
<span>{ts}Current extension path:{/ts}</span>
<span><strong>{$currentExtensionPath}</strong></span>
</div>
</div>
</div>
</td>
</tr>
{/if}
</tbody>
</table>
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment