Skip to content

Commit

Permalink
Merge pull request #38 from OXIDprojects/fix-adding-controllers
Browse files Browse the repository at this point in the history
fix error message using console command fix:states
fix #37
  • Loading branch information
keywan-ghadami-oxid authored Dec 5, 2018
2 parents 38add1d + e0f9c97 commit eced874
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions Core/ModuleStateFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ private function restoreModuleInformation($module, $moduleId)

if (version_compare($metaDataVersion, '2.0', '>=')) {
try {
$this->setModuleControllers($module->getControllers(), $moduleId, $module);
$moduleControllers = $module->isActive() ? $module->getControllers() : [];
$this->setModuleControllers($moduleControllers, $moduleId, $module);
} catch (ModuleValidationException $exception) {
print "[ERROR]: duplicate controllers:" . $exception->getMessage() ."\n";
}
Expand Down Expand Up @@ -330,18 +331,20 @@ protected function setModuleControllers($moduleControllers, $moduleId, $module)
$controllersForThatModuleInDb = $this->getModuleControllerEntries($moduleId);

$duplicatedKeys = array_intersect_key($moduleControllers, $controllersForThatModuleInDb);
$diff = array_diff_assoc($moduleControllers,$duplicatedKeys);
$diff = array_diff_assoc($moduleControllers, $duplicatedKeys);
if ($diff) {
$this->output->writeLn("$moduleId fixing module controllers (in md):" . var_export($moduleControllers, true));
$this->output->writeLn("$moduleId fixing module controllers (in db):" . var_export($controllersForThatModuleInDb, true));

$this->deleteModuleControllers($moduleId);
$this->resetModuleCache($module);
$this->validateModuleMetadataControllersOnActivation($moduleControllers);
if ($moduleControllers) {
$this->validateModuleMetadataControllersOnActivation($moduleControllers);

$classProviderStorage = $this->getClassProviderStorage();
$classProviderStorage = $this->getClassProviderStorage();

$classProviderStorage->add($moduleId, $moduleControllers);
$classProviderStorage->add($moduleId, $moduleControllers);
}
$this->needCacheClear = true;
}

Expand Down
2 changes: 1 addition & 1 deletion metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
Komplette Übersicht: '.$sLinkAndText,
],
'thumbnail' => 'module_internals.png',
'version' => '1.5.0',
'version' => '1.5.1',
'author' => 'OXID Community',
'url' => 'https://github.com/OXIDprojects/oxid-module-internals',
'email' => '',
Expand Down

0 comments on commit eced874

Please sign in to comment.