예제 #1
0
 /**
  * @param string $design
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePost($design)
 {
     $bool = false;
     if ((bool) preg_match('=/=', $design) === false && is_file($this->appPath->getDesignRootPathInternal() . $design . '/info.xml') === true) {
         $bool = $this->config->saveSettings(['design' => $design], Schema::MODULE_NAME);
         Core\Cache\Purge::doPurge([$this->appPath->getCacheDir() . 'sql', $this->appPath->getCacheDir() . 'tpl_compiled', $this->appPath->getCacheDir() . 'http']);
     }
     $text = $this->translator->t('system', $bool === true ? 'designs_edit_success' : 'designs_edit_error');
     return $this->redirectMessages()->setMessage($bool, $text, $this->request->getFullPath());
 }
 public function invalidatePageCache()
 {
     if ($this->canUsePageCache->canUsePageCache()) {
         if ($this->settings->getSettings(Schema::MODULE_NAME)['page_cache_purge_mode'] == 1) {
             Purge::doPurge($this->applicationPath->getCacheDir() . 'http');
         } else {
             $this->settings->saveSettings(['page_cache_is_valid' => false], Schema::MODULE_NAME);
         }
     }
 }
예제 #3
0
파일: Order.php 프로젝트: acp3/module-menus
 /**
  * @param int    $id
  * @param string $action
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($id, $action)
 {
     if ($this->menuItemRepository->menuItemExists($id) === true) {
         $this->sortOperation->execute($id, $action);
         $this->menusCache->saveMenusCache();
         Core\Cache\Purge::doPurge($this->appPath->getCacheDir() . 'http');
         return $this->redirect()->temporary('acp/menus');
     }
     throw new Core\Controller\Exception\ResultNotExistsException();
 }
예제 #4
0
 /**
  * @param string $action
  *
  * @return mixed
  * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($action = '')
 {
     return $this->actionHelper->handleDeleteAction($action, function (array $items) {
         $bool = false;
         foreach ($items as $item) {
             $bool = $this->commentRepository->delete($item, 'module_id');
         }
         Core\Cache\Purge::doPurge($this->appPath->getCacheDir() . 'http');
         return $bool;
     });
 }
 public function invalidatePageCache()
 {
     if ($this->canUsePageCache->canUsePageCache()) {
         if ($this->settings->getSettings(Schema::MODULE_NAME)['page_cache_purge_mode'] == 1) {
             Purge::doPurge($this->applicationPath->getCacheDir() . 'http');
         } else {
             $systemModuleId = $this->modules->getModuleId(Schema::MODULE_NAME);
             $this->settingsRepository->update(['value' => false], ['module_id' => $systemModuleId, 'name' => 'page_cache_is_valid']);
         }
     }
 }
예제 #6
0
파일: Order.php 프로젝트: acp3/cms
 /**
  * @param int    $id
  * @param string $action
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($id, $action)
 {
     if (($action === 'up' || $action === 'down') && $this->pictureRepository->pictureExists($id) === true) {
         if ($action === 'up') {
             $this->sortHelper->up(Gallery\Model\Repository\PictureRepository::TABLE_NAME, 'id', 'pic', $id, 'gallery_id');
         } else {
             $this->sortHelper->down(Gallery\Model\Repository\PictureRepository::TABLE_NAME, 'id', 'pic', $id, 'gallery_id');
         }
         $galleryId = $this->pictureRepository->getGalleryIdFromPictureId($id);
         $this->galleryCache->saveCache($galleryId);
         Core\Cache\Purge::doPurge($this->appPath->getCacheDir() . 'http');
         return $this->redirect()->temporary('acp/gallery/index/edit/id_' . $galleryId);
     }
     throw new Core\Controller\Exception\ResultNotExistsException();
 }
예제 #7
0
파일: Settings.php 프로젝트: acp3/cms
 /**
  * @param array $formData
  * @param array $settings
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePost(array $formData, array $settings)
 {
     return $this->actionHelper->handleSettingsPostAction(function () use($formData, $settings) {
         $this->adminSettingsFormValidation->validate($formData);
         $data = ['width' => (int) $formData['width'], 'height' => (int) $formData['height'], 'thumbwidth' => (int) $formData['thumbwidth'], 'thumbheight' => (int) $formData['thumbheight'], 'overlay' => $formData['overlay'], 'dateformat' => $this->get('core.helpers.secure')->strEncode($formData['dateformat']), 'sidebar' => (int) $formData['sidebar']];
         if ($this->modules->isActive('comments') === true) {
             $data['comments'] = (int) $formData['comments'];
         }
         $bool = $this->config->saveSettings($data, Gallery\Installer\Schema::MODULE_NAME);
         if ($formData['thumbwidth'] !== $settings['thumbwidth'] || $formData['thumbheight'] !== $settings['thumbheight'] || $formData['width'] !== $settings['width'] || $formData['height'] !== $settings['height']) {
             Core\Cache\Purge::doPurge($this->appPath->getUploadsDir() . 'gallery/cache', 'gallery');
             $this->get('gallery.cache.core')->getDriver()->deleteAll();
         }
         return $bool;
     });
 }
예제 #8
0
파일: Delete.php 프로젝트: acp3/cms
 /**
  * @param int $id
  * @param string $action
  *
  * @return mixed
  * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($id, $action = '')
 {
     return $this->actionHelper->handleDeleteAction($action, function (array $items) {
         $bool = false;
         foreach ($items as $item) {
             if (!empty($item) && $this->pictureRepository->pictureExists($item) === true) {
                 $picture = $this->pictureRepository->getOneById($item);
                 $this->pictureRepository->updatePicturesNumbers($picture['pic'], $picture['gallery_id']);
                 $this->galleryHelpers->removePicture($picture['file']);
                 $bool = $this->pictureRepository->delete($item);
                 if ($this->uriAliasManager) {
                     $this->uriAliasManager->deleteUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_PICTURE, $item));
                 }
                 $this->galleryCache->saveCache($picture['gallery_id']);
             }
         }
         Core\Cache\Purge::doPurge($this->appPath->getCacheDir() . 'http');
         return $bool;
     }, 'acp/gallery/pictures/delete/id_' . $id, 'acp/gallery/index/edit/id_' . $id);
 }
예제 #9
0
 /**
  * @param string $action
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePurge($action)
 {
     $cacheTypes = ['general' => [$this->appPath->getCacheDir() . 'http', $this->appPath->getCacheDir() . 'sql'], 'images' => $this->appPath->getCacheDir() . 'images', 'minify' => $this->appPath->getUploadsDir() . 'assets', 'page' => $this->appPath->getCacheDir() . 'http', 'templates' => [$this->appPath->getCacheDir() . 'tpl_compiled', $this->appPath->getCacheDir() . 'tpl_cached']];
     $result = false;
     switch ($action) {
         case 'general':
         case 'images':
         case 'minify':
         case 'page':
         case 'templates':
             $result = Core\Cache\Purge::doPurge($cacheTypes[$action]);
             $text = $this->translator->t('system', $result === true ? 'cache_type_' . $action . '_delete_success' : 'cache_type_' . $action . '_delete_error');
             if ($action === 'page') {
                 $this->config->saveSettings(['page_cache_is_valid' => true], System\Installer\Schema::MODULE_NAME);
             }
             break;
         default:
             $text = $this->translator->t('system', 'cache_type_not_found');
     }
     return $this->redirectMessages()->setMessage($result, $text, 'acp/system/maintenance/cache');
 }
예제 #10
0
 protected function purgeCaches()
 {
     Core\Cache\Purge::doPurge([$this->appPath->getCacheDir() . 'http', $this->appPath->getCacheDir() . 'sql', $this->appPath->getCacheDir() . 'tpl_compiled', $this->appPath->getCacheDir() . 'tpl_cached', $this->appPath->getCacheDir() . 'container.php', $this->appPath->getCacheDir() . 'container.php.meta']);
 }
예제 #11
0
파일: Index.php 프로젝트: acp3/setup
 protected function clearCaches()
 {
     Cache\Purge::doPurge([ACP3_ROOT_DIR . 'cache/', $this->appPath->getUploadsDir() . 'assets']);
 }