public function scanInstall()
    {

        if(!$this->lockSystemChanges)
        {
            foreach ($this->ApplicationContext->detectPluginDirectories()->getPluginDirectories() as $pluginDir) {
                if (is_dir($pluginDir)) {
                    $slug = basename($pluginDir);
                    if (!$this->PluginService->slugExists($slug)) {

                        $xml = $this->loadXML($pluginDir);
                        if ($xml) {

                            if(!$this->TransactionManager->isTransactionInProgress())
                                $this->TransactionManager->begin();

                            //INSERT PLUGIN INTO DB

                            $plugin = new Plugin();
                            $this->ModelMapper->defaultsOnModel($plugin);

                            $plugin = $this->SystemXMLConverter->xmlToPlugin($plugin, $xml);

                            $plugin->Slug = $slug;
                            $plugin->Path = $pluginDir;
                            $plugin->Installed = false;

                            try {
                                $this->PluginService->add($plugin);
                            } catch(ValidationException $ve) {
                                throw new Exception('Plugins: '.$ve->getMessage());
                            }
                        }

                    }
                }
            }

    //        $triggerReload = false;

            foreach ($this->PluginService->findAll()->getResults() as $plugin) {
                if(!is_dir($plugin->Path)) {
                    $plugin->PathInvalid = true;
                    if($plugin->isEnabled())
                    {
                        if(!$this->TransactionManager->isTransactionInProgress())
                            $this->TransactionManager->begin();

                        $plugin->Enabled = false;
                        $this->PluginService->edit($plugin);
                    }
                    if(!$plugin->isInstalled()) {
                        if(!$this->TransactionManager->isTransactionInProgress())
                            $this->TransactionManager->begin();

                        $this->PluginService->delete($plugin->Slug);
                    }
                    continue;
                }

                $this->autoupgradePlugin($plugin);
            }

            if($this->TransactionManager->isTransactionInProgress())
                $this->TransactionManager->commit();

        }

        foreach($this->ElementService->findAll()->getResults() as $element)
            $this->NodeService->createDBSchema($element);

//        if ($triggerReload)
//            $this->ApplicationContext->reload();


    }
public function scanInstall()
    {

        if(!$this->lockSystemChanges)
        {
            foreach ($this->ApplicationContext->detectPluginDirectories()->getPluginDirectories() as $pluginDir) {
                if (is_dir($pluginDir)) {
                    $slug = basename($pluginDir);
                    if (!$this->PluginService->slugExists($slug)) {

                        $xml = $this->loadXML($pluginDir);
                        if ($xml) {

                            if(!$this->TransactionManager->isTransactionInProgress())
                                $this->TransactionManager->begin();

                            //INSERT PLUGIN INTO DB

                            $plugin = new Plugin();
                            $this->ModelMapper->defaultsOnModel($plugin);

                            $plugin = $this->SystemXMLConverter->xmlToPlugin($plugin, $xml);

                            $plugin->Slug = $slug;
                            $plugin->Path = $pluginDir;
                            $plugin->Installed = false;

                            try {
                                $this->PluginService->add($plugin);
                            } catch(ValidationException $ve) {
                                throw new Exception('Plugins: '.$ve->getMessage());
                            }
                        }

                    }
                }
            }

    //        $triggerReload = false;

            foreach ($this->PluginService->findAll()->getResults() as $plugin) {
                if(!is_dir($plugin->Path)) {
                    $plugin->PathInvalid = true;
                    if($plugin->isEnabled())
                    {
                        if(!$this->TransactionManager->isTransactionInProgress())
                            $this->TransactionManager->begin();

                        $plugin->Enabled = false;
                        $this->PluginService->edit($plugin);
                    }
                    if(!$plugin->isInstalled()) {
                        if(!$this->TransactionManager->isTransactionInProgress())
                            $this->TransactionManager->begin();

                        $this->PluginService->delete($plugin->Slug);
                    }
                    continue;
                }

                $this->autoupgradePlugin($plugin);
            }

            if($this->TransactionManager->isTransactionInProgress())
                $this->TransactionManager->commit();

        }

        foreach($this->ElementService->findAll()->getResults() as $element)
            $this->NodeService->createDBSchema($element);

//        if ($triggerReload)
//            $this->ApplicationContext->reload();


    }
public function scanInstall ( ) { if ( ! $ this -> lockSystemChanges ) { foreach ( $ this -> ApplicationContext -> detectPluginDirectories ( ) -> getPluginDirectories ( ) as $ pluginDir ) { if ( is_dir ( $ pluginDir ) ) { $ slug = basename ( $ pluginDir ) ; if ( ! $ this -> PluginService -> slugExists ( $ slug ) ) { $ xml = $ this -> loadXML ( $ pluginDir ) ; if ( $ xml ) { if ( ! $ this -> TransactionManager -> isTransactionInProgress ( ) ) $ this -> TransactionManager -> begin ( ) ; //INSERT PLUGIN INTO DB $ plugin = new Plugin ( ) ; $ this -> ModelMapper -> defaultsOnModel ( $ plugin ) ; $ plugin = $ this -> SystemXMLConverter -> xmlToPlugin ( $ plugin , $ xml ) ; $ plugin -> Slug = $ slug ; $ plugin -> Path = $ pluginDir ; $ plugin -> Installed = false ; try { $ this -> PluginService -> add ( $ plugin ) ; } catch ( ValidationException $ ve ) { throw new Exception ( 'Plugins: ' . $ ve -> getMessage ( ) ) ; } } } } } //        $triggerReload = false; foreach ( $ this -> PluginService -> findAll ( ) -> getResults ( ) as $ plugin ) { if ( ! is_dir ( $ plugin -> Path ) ) { $ plugin -> PathInvalid = true ; if ( $ plugin -> isEnabled ( ) ) { if ( ! $ this -> TransactionManager -> isTransactionInProgress ( ) ) $ this -> TransactionManager -> begin ( ) ; $ plugin -> Enabled = false ; $ this -> PluginService -> edit ( $ plugin ) ; } if ( ! $ plugin -> isInstalled ( ) ) { if ( ! $ this -> TransactionManager -> isTransactionInProgress ( ) ) $ this -> TransactionManager -> begin ( ) ; $ this -> PluginService -> delete ( $ plugin -> Slug ) ; } continue ; } $ this -> autoupgradePlugin ( $ plugin ) ; } if ( $ this -> TransactionManager -> isTransactionInProgress ( ) ) $ this -> TransactionManager -> commit ( ) ; } foreach ( $ this -> ElementService -> findAll ( ) -> getResults ( ) as $ element ) $ this -> NodeService -> createDBSchema ( $ element ) ; //        if ($triggerReload) //            $this->ApplicationContext->reload(); }
Scans the plugin directories and installs plugins as needed

@return void
Scans the plugin directories and installs plugins as needed