Browse Source

Modules fix

master
Egorka 6 years ago
parent
commit
472483d049
  1. 6
      backend/controllers/ModuleController.php
  2. 1
      backend/messages/ru/main.php
  3. 11
      backend/views/module/remote-list.php

6
backend/controllers/ModuleController.php

@ -102,8 +102,8 @@ class ModuleController extends Controller
{
$needed_manifest = [];
// check installed extension
if (class_exists('\ZipArchive')) {
\Yii::$app->session->setFlash('danger', \Yii::t('main', 'ZipArchive php extension not installed'));
if (!extension_loaded('zip')) {
\Yii::$app->session->setFlash('danger', \Yii::t('main', 'PHP extension "zip" not installed, Need ZipArchive class'));
return $this->redirect(['search']);
}
@ -143,7 +143,7 @@ class ModuleController extends Controller
if (!file_exists($module_path)) {
mkdir($module_path);
}
FileHelper::copyDirectory(\Yii::getAlias('@runtime/_module'), $module_path);
FileHelper::copyDirectory(\Yii::getAlias('@runtime/_module/' . $needed_manifest['git_name'] . '-master'), $module_path);
} else {
\Yii::$app->session->setFlash('danger', \Yii::t('main', 'Error module archive'));
return $this->redirect(['search']);

1
backend/messages/ru/main.php

@ -78,4 +78,5 @@ return [
'ZipArchive php extension not installed' => 'Расширение ZipArchive для PHP не установлено',
'Error module archive' => 'Ошибка архива модуля',
'Module installed successful' => 'Модуль успешно установлен',
'Install' => 'Установить',
];

11
backend/views/module/remote-list.php

@ -43,10 +43,15 @@ $this->params['breadcrumbs'][] = $this->title;
</div>
<div class="box-footer" style="text-align: right">
<?php if (Yii::$app->moduleManager->isExists($module['name'])) : ?>
<span class="text-bold text-green"><?= Yii::t('main', 'Installed') ?></span>
<?= Html::a(Yii::t('main', 'Installed'), '#', [
'class' => 'btn btn-default btn-sm disabled',
'data' => [
'method' => 'post',
],
]) ?>
<?php else : ?>
<?= Html::a(Yii::t('main', 'Enable'), ['module/install', 'name' => $module['name']], [
'class' => 'btn btn-default btn-sm',
<?= Html::a(Yii::t('main', 'Install'), ['module/install', 'name' => $module['name']], [
'class' => 'btn btn-success btn-sm',
'data' => [
'method' => 'post',
],

Loading…
Cancel
Save