Exemplo n.º 1
0
 /**
  * @ApiDoc(
  *  section="Bundle/Package Manager",
  *  description="Uninstalls a bundle"
  * )
  *
  * Removes relevant data and object's data. Executes also the uninstall script.
  * Removes database values, some files etc.
  *
  * @Rest\QueryParam(name="bundle", requirements=".+", strict=true, description="The bundle name")
  * @Rest\QueryParam(name="removeFiles", requirements=".+", default="true", description="If the orm should be updated")
  * @Rest\QueryParam(name="ormUpdate", requirements=".+", default="false", description="If the orm should be updated")
  *
  * @Rest\Post("/admin/system/bundle/manager/install")
  *
  * @param string $bundle
  * @param bool $ormUpdate
  * @param bool $removeFiles
  *
  * @throws BundleNotFoundException
  * @return bool
  */
 public function uninstallAction($bundle, $ormUpdate = null, $removeFiles = null)
 {
     $ormUpdate = filter_var($ormUpdate, FILTER_VALIDATE_BOOLEAN);
     $removeFiles = filter_var($removeFiles, FILTER_VALIDATE_BOOLEAN);
     Manager::prepareName($bundle);
     $fs = $this->localFilesystem;
     $path = $this->jarves->getBundleDir($bundle);
     if (!$path) {
         throw new \Jarves\Exceptions\BundleNotFoundException();
     }
     $hasPropelModels = $fs->has($path . 'Resources/config/model.xml');
     $this->firePackageManager($bundle, 'uninstall');
     $this->deactivateAction($bundle);
     //fire update propel orm
     if ($ormUpdate && $hasPropelModels) {
         //update propel
         if ($ormUpdate) {
             $this->jarves->getEventDispatcher()->dispatch('core/bundle/schema-update', $bundle);
         }
     }
     //remove files
     if (filter_var($removeFiles, FILTER_VALIDATE_BOOLEAN)) {
         $fs->delete($path);
         if (0 === strpos($path, $this->getComposerVendorDir())) {
             $path = explode('/', $path);
             $composerName = $path[1] . '/' . $path[2];
             $this->uninstallComposerAction($composerName);
         }
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * @ApiDoc(
  *  section="Language Editor",
  *  description="Extracts all language messages in the given bundle"
  * )
  *
  * @Rest\QueryParam(name="bundle", requirements=".+", strict=true, description="The bundle name")
  *
  * @Rest\Get("/admin/system/bundle/editor/language/extract")
  *
  * @param ParamFetcher $paramFetcher
  *
  * @return array
  */
 public function getExtractedLanguageAction(ParamFetcher $paramFetcher)
 {
     $bundle = $paramFetcher->get('bundle');
     Manager::prepareName($bundle);
     $utils = $this->translator->getUtils();
     return $utils->extractLanguage($bundle);
 }