/** * Synchronize application data (packages metadata and database packages rows). * * @return void */ public function syncAction() { try { /** * Add missing packages. * Read packages files and find packages that is missing in db. * * $modulesWidgets - array of widgets that is located in modules [module => [widgets...n]]. * $notFoundWidgets - array of widgets as external packages [widgets...n]. * $packages - all packages names found at metadata files. * $widgets - all widgets names found at metadata files. */ list($modulesWidgets, $notFoundWidgets, $packages, $widgets) = $this->_checkMissingPackages(); /** * Add missing widgets from modules and from packages. */ $this->_checkMissingWidgets($modulesWidgets, $notFoundWidgets); /** * Remove unused packages. */ $this->_removeUnusedPackages($packages); /** * Remove unused widgets. */ $this->_removeUnusedWidgets($widgets); /** * Generate metadata. */ $manager = new Manager(Package::find(), $this->getDI()); $manager->generateMetadata(null, true); print ConsoleUtil::success('Application successfully synchronized.') . PHP_EOL; } catch (Exception $e) { print ConsoleUtil::error($e->getMessage()) . PHP_EOL; } }
/** * Save finish form action. * * @return ResponseInterface * * @Route("/save", methods={"GET"}, name="install-save") */ public function saveAction() { if (!$this->_isPassed('finishAction')) { return $this->_selectAction(); } foreach ($this->_actions as $action) { $this->_setPassed($action, false); } $this->_setupDatabase(); $this->config->offsetSet('installed', true); $packageManager = new PackageManager(Package::find()); $packageManager->generateMetadata(); $assetsManager = new AssetManager($this->getDI(), false); $assetsManager->clear(true, PUBLIC_PATH . '/themes/' . Settings::getSetting('system_theme')); return $this->response->redirect(); }
/** * Update packages metadata. * * @return void */ protected function _updateMetadata() { $packageManager = new Manager(); $packageManager->generateMetadata(Package::find()); }