Esempio n. 1
0
 /**
  * Upgrades a package's database and refreshes all blocks.
  */
 public function upgrade()
 {
     $this->upgradeDatabase();
     // now we refresh all blocks
     $manager = new Manager($this->app);
     $items = $manager->driver('block_type')->getItems($this->getPackageEntity());
     foreach ($items as $item) {
         $item->refresh();
     }
     \Localization::clearCache();
 }
Esempio n. 2
0
 foreach ($local as $_pkg) {
     $updates++;
     $localHandles[] = $_pkg->getPackageHandle();
 }
 foreach ($remote as $_pkg) {
     if (!in_array($_pkg->getPackageHandle(), $localHandles)) {
         $updates++;
     }
 }
 if ($tp->canInstallPackages()) {
     foreach (Package::getAvailablePackages() as $_pkg) {
         $_pkg->setupPackageLocalization();
         $pkgAvailableArray[] = $_pkg;
     }
     if (count($pkgAvailableArray) > 0) {
         Localization::clearCache();
     }
 }
 $thisURL = $view->url('/dashboard/extend/install');
 $availableArray = $pkgAvailableArray;
 usort($availableArray, function ($a, $b) {
     return strcasecmp($a->getPackageName(), $b->getPackageName());
 });
 /* Load featured add-ons from the marketplace.
  */
 $db = Loader::db();
 if (is_object($mi) && $mi->isConnected() && Config::get('concrete.marketplace.enabled') && $tp->canInstallPackages()) {
     $purchasedBlocksSource = Marketplace::getAvailableMarketplaceItems();
 } else {
     $purchasedBlocksSource = array();
 }
 public function export_translations($localeCode)
 {
     $result = new EditResponse();
     try {
         if (!Core::make('token')->validate('export_translations')) {
             throw new \Exception(Core::make('token')->getErrorMessage());
         }
         $section = Section::getByLocale($localeCode);
         if (is_object($section) && !$section->isError()) {
             if ($section->getLocale() == Config::get('concrete.multilingual.default_source_locale')) {
                 $section = null;
             }
         } else {
             $section = null;
         }
         if (!isset($section)) {
             throw new \Exception(t('Invalid language identifier'));
         }
         $translations = $section->getSectionInterfaceTranslations();
         $extractor = Core::make('multilingual/extractor');
         $extractor->mergeTranslationsWithSectionFile($section, $translations);
         $extractor->saveSectionTranslationsToFile($section, $translations);
         \Localization::clearCache();
         $result->setAdditionalDataAttribute('newToken', Core::make('token')->generate('export_translations'));
         $result->message = t('The translations have been exported to file and will be used by the website.');
     } catch (\Exception $x) {
         $result->setError($x);
     }
     $result->outputJSON();
 }