Skip to content

Commit

Permalink
Merge pull request #1394 from NextDom/develop
Browse files Browse the repository at this point in the history
0.5.0-RC4
  • Loading branch information
Sylvaner authored Oct 6, 2019
2 parents b1b1038 + 60d2328 commit c9127cf
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 37 deletions.
25 changes: 18 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
# NextDom Core Changelog
---
## 0.5.0-RC0
## 0.5.0

> ***Release Date : 23/09/2019***
> ***Release Date : 13/10/2019***
>
> ***Statut : Release candidate
> ***Statut : beta***
#### NEWS
* Affichage des scénarios sur le dashboard
* Possibilité de commander les scénarios sur le dashboard
* Déplacement du code du core (/core)
* Mise à jour des dépendances
* Séparation de la version mobile qui devient indépendante, l'installation est proposée au login
* Nouveau tests unitaires du core (coverall > 22%)
* Test unitaires version mobile (coverall > 41%)

#### AMELIORATIONS
* Amélioration de la migration depuis Jeedom
* Possibilité de commander les scénarios depuis le dashboard
* Déplacement du code du core
* Amélioration de compatibilité PHP > 7.2 et Debian Buster
* Correction de bugs
* Amélioration du système de validation (ajout des nightly et d'un triple LXC de validation automatique d'install & update)

#### FIXS
* Correction de l'affichage des updates du Core
* Mise à jour des dépendances
* [liste ici](https://github.com/NextDom/nextdom-core/milestone/18?closed=1)
---

## 0.4.2
> ***Release Date : 13/09/2019***
Expand Down
11 changes: 11 additions & 0 deletions src/Controller/Admin/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,18 @@ public static function get(&$pageData): string
$keys[] = $key . '::enable';
}
$pageData['adminConfigs'] = ConfigManager::byKeys($keys);
$pageData['adminPluginsList'] = [];
$pluginsList = PluginManager::listPlugin(true);
foreach ($pluginsList as $plugin) {
$pluginApi = ConfigManager::byKey('api', $plugin->getId());

if ($pluginApi !== '') {
$pluginData = [];
$pluginData['api'] = $pluginApi;
$pluginData['plugin'] = $plugin;
$pageData['adminPluginsList'][] = $pluginData;
}
}
$pageData['JS_END_POOL'][] = '/public/js/desktop/admin/api.js';

return Render::getInstance()->get('/desktop/admin/api.html.twig', $pageData);
Expand Down
10 changes: 9 additions & 1 deletion src/Controller/Params/LogAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@ public static function get(&$pageData): string
global $NEXTDOM_INTERNAL_CONFIG;
$pageData['adminAlerts'] = $NEXTDOM_INTERNAL_CONFIG['alerts'];
$pageData['adminOthersLogs'] = array('scenario', 'plugin', 'market', 'api', 'connection', 'interact', 'tts', 'report', 'event');

$pageData['adminPluginsList'] = [];
$pluginsList = PluginManager::listPlugin(true);
foreach ($pluginsList as $plugin) {
$pluginApi = ConfigManager::byKey('api', $plugin->getId());
$pluginData = [];
$pluginData['api'] = $pluginApi;
$pluginData['plugin'] = $plugin;
$pageData['adminPluginsList'][] = $pluginData;
}
$pageData['JS_END_POOL'][] = '/public/js/desktop/params/log_admin.js';

return Render::getInstance()->get('/desktop/params/log_admin.html.twig', $pageData);
Expand Down
34 changes: 27 additions & 7 deletions src/Helpers/MigrationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@
use NextDom\Exceptions\CoreException;
use NextDom\Managers\BackupManager;
use NextDom\Managers\ConfigManager;
use NextDom\Managers\ConsistencyManager;
use NextDom\Managers\CronManager;
use NextDom\Managers\InteractDefManager;
use NextDom\Managers\Plan3dManager;
use NextDom\Managers\PlanManager;
use NextDom\Managers\UpdateManager;
use NextDom\Model\Entity\Cron;

/**
* Class MigrationHelper
Expand Down Expand Up @@ -124,6 +127,7 @@ public static function migrate($logFile = 'migration')
$previousVersion[0] += 1;
}
}
self::replaceJeedomInDatabase($logFile);
ConfigManager::save('lastUpdateVersion', $currentVersion[0] . '.' . $currentVersion[1] . '.' . $currentVersion[2], 'core');
}

Expand Down Expand Up @@ -409,15 +413,15 @@ private static function migrateUserFunctionClass($logFile)
}
}

/***************************************************************** 0.4.2 Migration process *****************************************************************/
/**
* 0.4.1 Migration process
* Replace jeedom to nextdom in database
*
* @param string $logFile log name file to display information
*
* @throws \Exception
*/
private static function migrate_0_4_2($logFile = 'migration')
private static function replaceJeedomInDatabase($logFile = 'migration')
{

$message = 'Replace jeedom in database';
if ($logFile == 'migration') {
LogHelper::addInfo($logFile, $message, '');
Expand All @@ -437,16 +441,32 @@ private static function migrate_0_4_2($logFile = 'migration')
}
ConfigManager::save('nextdom::firstUse', 0, 'core');
// Update Crons table

// benchmark config update
$sql = 'UPDATE `crons`
$sql = 'UPDATE `cron`
SET `class` = "nextdom"
WHERE `class` = "jeedom"';
try {
DBHelper::exec($sql);
} catch (\Exception $e) {

}
// Check doublon on update
foreach (ConsistencyManager::getDefaultCrons() as $cronClass => $cronData) {
foreach ($cronData as $cronName => $cronConfig) {
$sql = 'SELECT ' . DBHelper::buildField(CronManager::CLASS_NAME) . '
FROM ' . CronManager::DB_CLASS_NAME . '
WHERE class = :class
AND function = :function';
$params = [
'class' => $cronClass,
'function' => $cronName,
];
/** @var Cron[] $result */
$result = DBHelper::getAllObjects($sql, $params, CronManager::CLASS_NAME);
if (count($result) > 1) {
$result[1]->remove();
}
}
}

// Update Update table

Expand Down
20 changes: 10 additions & 10 deletions src/Managers/ConsistencyManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,20 @@ private static function removeDeprecatedCrons()
*/
private static function checkAllDefaultCrons()
{
foreach (self::getDefaultCrons() as $c_class => $c_data) {
foreach ($c_data as $c_name => $c_config) {
foreach (self::getDefaultCrons() as $cronClass => $cronData) {
foreach ($cronData as $cronName => $cronConfig) {
try {
$cron = CronManager::byClassAndFunction($c_class, $c_name);
$cron = CronManager::byClassAndFunction($cronClass, $cronName);
if (false == is_object($cron)) {
$cron = new Cron();
}
$cron->setClass($c_class);
$cron->setFunction($c_name);
$cron->setSchedule($c_config["schedule"]);
$cron->setTimeout($c_config["timeout"]);
$cron->setClass($cronClass);
$cron->setFunction($cronName);
$cron->setSchedule($cronConfig["schedule"]);
$cron->setTimeout($cronConfig["timeout"]);
$cron->setDeamon(0);
if (true == array_key_exists("enabled", $c_config)) {
$cron->setEnable($c_config["enabled"]);
if (true == array_key_exists("enabled", $cronConfig)) {
$cron->setEnable($cronConfig["enabled"]);
}
$cron->save();
} catch (\Exception $e) {
Expand All @@ -149,7 +149,7 @@ private static function checkAllDefaultCrons()
/**
* @return array
*/
private static function getDefaultCrons()
public static function getDefaultCrons()
{
return array(
"nextdom" => array(
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Entity/Cmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public static function duringAlertLevel($_options)
*/
public function getEqType_name()
{
trigger_error('This method is deprecated. Use getEqType', E_USER_DEPRECATED);
@trigger_error('This method is deprecated. Use getEqType', E_USER_DEPRECATED);
return $this->eqType;
}

Expand Down Expand Up @@ -2178,4 +2178,4 @@ public function getAllAttributes()
'eqLogic_id' => $this->eqLogic_id
];
}
}
}
1 change: 1 addition & 0 deletions translations/en_US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ note:
are_sure_you_want_to_delete_the_note: "Are sure you want to delete the note"

osdb:
administration: Administration
warning: "WARNING: you may loose access to your system "
tools: "Tools"
system_console: "System console"
Expand Down
1 change: 1 addition & 0 deletions translations/fr_FR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ note:
are_sure_you_want_to_delete_the_note: "Etes-vous sur de vouloir supprimer la note : "

osdb:
administration: Administration
warning: "ATTENTION : ces opérations sont risquées, vous pouvez perdre l'accès à votre système et à "
tools: "Outils"
system_console: "Console Système"
Expand Down
6 changes: 3 additions & 3 deletions views/desktop/admin/api.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@

<!-- Plugins Section -->
<fieldset class="legend-section">
<legend>{{ 'Accès et CLefs API Plugins' }}</legend>
{% if not adminIsRescueMode and adminPluginsList|length > 0 %}
<legend>{{ 'Accès et Clefs API Plugins' }}</legend>
{% if adminPluginsList|length > 0 %}
<div class="row">
{% for pluginData in adminPluginsList %}
<div class="form-group col-lg-6 col-xs-12 col-padding">
Expand All @@ -171,7 +171,7 @@
{% endfor %}
</div>
{% else %}
<div class="alert alert-info">{{ 'Aucun plugins ne disposant de clés API...' }}.</div>
<div class="alert alert-info">{{ 'Aucun plugin ne disposant de clefs API...' }}.</div>
{% endif %}
</fieldset>
</div>
Expand Down
2 changes: 1 addition & 1 deletion views/desktop/connection.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
</div>
<div class="box-body" style="display: none;">
<pre>
git clone https://github.com/NextDom/nextdom-mobile {{ NEXTDOM_ROOT }}/mobile
git clone https://github.com/NextDom/nextdom-mobile-dist {{ NEXTDOM_ROOT }}/mobile
</pre>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion views/desktop/params/log_admin.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
<fieldset class="legend-section">
<legend>{{ 'Niveau des logs plugins' }}</legend>
<div class="row">
{% if not adminIsRescueMode and adminPluginsList|length > 0 %}
{% if adminPluginsList|length > 0 %}
{% for pluginData in adminPluginsList %}
<div class="form-group col-sm-6 col-xs-12 col-padding">
<label class="control-label">{{ pluginData['plugin'].getName() }}</label>
Expand Down
11 changes: 6 additions & 5 deletions views/desktop/tools/osdb.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@
<!-- DB Section -->
<fieldset class="legend-section">
<legend>{{ 'osdb.database'|trans }}</legend>
<div class="form-group">
<label class="col-lg-2 col-md-3 col-sm-4 col-xs-6 control-label">{{ 'osdb.administration' | trans }}</label>
<div class="col-lg-3 col-md-4 col-sm-5 col-xs-6">
<a class="btn btn-danger" href="index.php?v=d&p=database"><i class="fas fa-exclamation-triangle"></i>{{ 'osdb.run' | trans }}</a>
<div class="row">
<div class="form-group col-sm-6 col-xs-12 col-padding">
<label class="control-label">{{ 'osdb.administration' | trans }}</label>
<div class="mix-group">
<a class="btn btn-danger" href="index.php?v=d&p=database"><i class="fas fa-exclamation-triangle"></i>{{ 'osdb.run' | trans }}</a>
</div>
</div>
</div>
</div>
</fieldset>

<!-- DB Section -->
Expand Down

0 comments on commit c9127cf

Please sign in to comment.