/
mikopbx
/
ModuleGermanLanguagePack
Обзор
Документация
Войти
/
mikopbx
/
ModuleGermanLanguagePack
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
v1.5
Setup/PbxExtensionSetup.php
123 строки
4 KB
Nikolay Beketov
chore: update copyright year to 2026
07 апр 2026, 17:10
07 апр 2026, 17:10
b397048
Код
Авторство
О чём код?
<?php declare(strict_types=1); /* * MikoPBX - free phone system for small business * Copyright © 2017-2026 Alexey Portnov and Nikolay Beketov * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program. * If not, see <https://www.gnu.org/licenses/>. */ namespace Modules\ModuleGermanLanguagePack\Setup; use MikoPBX\Core\System\SystemMessages; use MikoPBX\Modules\PbxExtensionUtils; use MikoPBX\Modules\Setup\PbxExtensionSetupBase; /** * PbxExtensionSetup * * Setup class for German Language Pack Module * * This Language Pack module provides automatic installation of: * - German UI translations from Messages/de/ directory * - German voice prompts from Sounds/de-de/ directory * * The base class handles all installation/uninstallation automatically: * - Sound files are installed via SoundFilesConf::installModuleSounds() * - Translations are loaded via MessagesProvider::loadModuleTranslations() * - No additional logic is required for Language Pack modules * * @package Modules\ModuleGermanLanguagePack\Setup */ class PbxExtensionSetup extends PbxExtensionSetupBase { /** * Module unique identifier */ protected string $moduleUniqueID = 'ModuleGermanLanguagePack'; /** * Additional actions before module installation * * For Language Pack modules, we check for conflicts with other German packs. * Only one Language Pack per language is allowed. * * @return bool True if installation can proceed */ public function onBeforeModuleEnable(): bool { // Check for Language Pack conflicts $conflictModule = PbxExtensionUtils::checkLanguagePackConflict( $this->moduleUniqueID, 'de-de' ); if ($conflictModule !== null) { $this->messages[] = "Cannot install: Another German Language Pack ($conflictModule) is already installed. Please uninstall it first."; return false; } return parent::onBeforeModuleEnable(); } /** * Additional actions after module installation * * @return bool True if successful */ public function onAfterModuleEnable(): bool { SystemMessages::sysLogMsg( __CLASS__, 'German Language Pack installed successfully', LOG_INFO ); return parent::onAfterModuleEnable(); } /** * Additional actions before module uninstallation * * @return bool True if uninstallation can proceed */ public function onBeforeModuleDisable(): bool { SystemMessages::sysLogMsg( __CLASS__, 'Uninstalling German Language Pack', LOG_INFO ); return parent::onBeforeModuleDisable(); } /** * Additional actions after module uninstallation * * @return bool True if successful */ public function onAfterModuleDisable(): bool { SystemMessages::sysLogMsg( __CLASS__, 'German Language Pack uninstalled successfully', LOG_INFO ); return parent::onAfterModuleDisable(); } }