mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-01-11 07:18:40 +00:00
54 lines
1.2 KiB
PHP
Executable File
54 lines
1.2 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Jingga
|
|
*
|
|
* PHP Version 8.2
|
|
*
|
|
* @package Modules\Profile\Admin\Install
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 2.0
|
|
* @version 1.0.0
|
|
* @link https://jingga.app
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Profile\Admin\Install;
|
|
|
|
use Model\Setting;
|
|
use Model\SettingMapper;
|
|
use Modules\Profile\Models\SettingsEnum;
|
|
use phpOMS\Application\ApplicationAbstract;
|
|
|
|
/**
|
|
* Media class.
|
|
*
|
|
* @package Modules\Profile\Admin\Install
|
|
* @license OMS License 2.0
|
|
* @link https://jingga.app
|
|
* @since 1.0.0
|
|
*/
|
|
class Media
|
|
{
|
|
/**
|
|
* Install media providing
|
|
*
|
|
* @param ApplicationAbstract $app Application
|
|
* @param string $path Module path
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public static function install(ApplicationAbstract $app, string $path) : void
|
|
{
|
|
$media = \Modules\Media\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Media.install.json']);
|
|
|
|
$defaultProfileImage = (int) \reset($media['upload'][0]);
|
|
|
|
$setting = new Setting();
|
|
SettingMapper::create()->execute(
|
|
$setting->with(0, SettingsEnum::DEFAULT_PROFILE_IMAGE, (string) $defaultProfileImage, '\\d+', module: 'Profile')
|
|
);
|
|
}
|
|
}
|