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 = []; $needed_manifest = [];
// check installed extension // check installed extension
if (class_exists('\ZipArchive')) { if (!extension_loaded('zip')) {
\Yii::$app->session->setFlash('danger', \Yii::t('main', 'ZipArchive php extension not installed')); \Yii::$app->session->setFlash('danger', \Yii::t('main', 'PHP extension "zip" not installed, Need ZipArchive class'));
return $this->redirect(['search']); return $this->redirect(['search']);
} }
@ -143,7 +143,7 @@ class ModuleController extends Controller
if (!file_exists($module_path)) { if (!file_exists($module_path)) {
mkdir($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 { } else {
\Yii::$app->session->setFlash('danger', \Yii::t('main', 'Error module archive')); \Yii::$app->session->setFlash('danger', \Yii::t('main', 'Error module archive'));
return $this->redirect(['search']); return $this->redirect(['search']);

1
backend/messages/ru/main.php

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

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

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

Loading…
Cancel
Save