Пример #1
0
 /**
  * @param \Venne\Module\IModule $module
  */
 public function uninstall(IModule $module)
 {
     $name = $module->getName();
     $configuration = $module->getConfiguration();
     // update main config.neon
     if (count($configuration) > 0) {
         $orig = $data = $this->loadConfig();
         $data = $this->getRecursiveDiff($data, $configuration);
         // remove extension parameters
         $configuration = $module->getConfiguration();
         if (isset($configuration['extensions'])) {
             foreach ($configuration['extensions'] as $key => $values) {
                 if (isset($data[$key])) {
                     unset($data[$key]);
                 }
             }
         }
         $this->saveConfig($data);
         $this->actions[] = function ($self) use($orig) {
             $self->saveConfig($orig);
         };
     }
     // remove resources dir
     $resourcesDir = $this->resourcesDir . "/{$name}Module";
     if (file_exists($resourcesDir)) {
         if (is_link($resourcesDir)) {
             unlink($resourcesDir);
         } else {
             File::rmdir($resourcesDir, TRUE);
         }
     }
 }