Skip to content

Commit

Permalink
Refactor, rendre la version du CMS dynamique.
Browse files Browse the repository at this point in the history
  • Loading branch information
noelma committed Mar 11, 2021
1 parent 28a3eba commit 5740011
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
9 changes: 5 additions & 4 deletions core/modules/Dashboard/Controller/Dashboard.php
Expand Up @@ -27,10 +27,11 @@ public function index()
])
->view('page.messages', $messages)
->make('page.content', 'dashboard/content-dashboard-dashboard.php', $this->pathViews, [
'link_info' => self::router()->getRoute('dashboard.info'),
'size_backup' => self::dashboard()->getSizeBackups(),
'size_data' => self::dashboard()->getSizeDatabase(),
'size_file' => self::dashboard()->getSizeFiles()
'link_info' => self::router()->getRoute('dashboard.info'),
'size_backup' => self::dashboard()->getSizeBackups(),
'size_data' => self::dashboard()->getSizeDatabase(),
'size_file' => self::dashboard()->getSizeFiles(),
'version_core' => self::composer()->getVersionCore()
]);
}

Expand Down
Expand Up @@ -42,7 +42,7 @@
<tbody>
<tr>
<th><?php echo t('Soosyze version'); ?></th>
<td>1.0.0-beta2.4</td>
<td><?php echo htmlspecialchars($version_core); ?></td>
</tr>
<tr>
<th><?php echo t('Environment'); ?></th>
Expand Down
2 changes: 1 addition & 1 deletion core/modules/System/Controller/Install.php
Expand Up @@ -162,7 +162,7 @@ private function installModule()

foreach ($this->modules as $title => $namespace) {
/* Charge la version du coeur à ses modules. */
$composer[$title]['version'] = $this->container->get('module')->getVersionCore();
$composer[$title]['version'] = $this->container->get('composer')->getVersionCore();

/* Enregistre le module en base de données. */
self::module()->create($composer[ $title ]);
Expand Down
23 changes: 23 additions & 0 deletions core/modules/System/Services/Composer.php
Expand Up @@ -18,6 +18,13 @@ class Composer
*/
private $core;

/**
* Les données du fichier du coeur du CMS.
*
* @var array
*/
private $coreComposer = [];

/**
* @var Modules
*/
Expand Down Expand Up @@ -213,6 +220,22 @@ public function validRequireModule($title, array $composers)
return $errors;
}

public function getVersionCore()
{
$coreComposer = $this->getComposerCore();

return $coreComposer[ 'version' ];
}

public function getComposerCore()
{
if (!$this->coreComposer) {
$this->coreComposer = Util::getJson(ROOT . '/composer.json');
}

return $this->coreComposer;
}

public function getThemeComposers($reload = false)
{
if (!empty($this->themeComposers) || $reload) {
Expand Down
5 changes: 0 additions & 5 deletions core/modules/System/Services/Modules.php
Expand Up @@ -22,11 +22,6 @@ public function __construct($query, $translate)
$this->transalte = $translate;
}

public function getVersionCore()
{
return '1.0.0-beta2.4';
}

/**
* Si le module est installé.
*
Expand Down

0 comments on commit 5740011

Please sign in to comment.