/**
  * Rebuild Vimeo cache
  *
  * @param DataContainer $dc
  */
 public function rebuildVimeoCache(DataContainer $dc)
 {
     $rebuilder = new Rebuilder();
     try {
         $result = $rebuilder->rebuildElementCache(ContentModel::findByPk($dc->id));
     } catch (\InvalidArgumentException $e) {
         return;
     } catch (\RuntimeException $e) {
         System::log(sprintf('Unable to rebuild Vimeo cache of element ID %s: %s', $dc->id, $e->getMessage()), __METHOD__, TL_ERROR);
         $result = false;
     }
     if ($result === true) {
         Message::addConfirmation($GLOBALS['TL_LANG']['tl_content']['vimeo_cacheConfirm']);
     } elseif ($result === false) {
         Message::addError($GLOBALS['TL_LANG']['tl_content']['vimeo_cacheError']);
     }
 }
 /**
  * Run the controller and parse the template
  */
 public function run()
 {
     $template = new BackendTemplate('be_picker');
     $template->main = '';
     // Ajax request
     if ($_POST && Environment::get('isAjaxRequest')) {
         $this->ajax = new Ajax(Input::post('action'));
         $this->ajax->executePreActions();
     }
     $rebuilder = new Rebuilder();
     $rebuilder->setPopupMode(true);
     $template->main = $rebuilder->run();
     $template->theme = Backend::getTheme();
     $template->base = Environment::get('base');
     $template->language = $GLOBALS['TL_LANGUAGE'];
     $template->title = specialchars($GLOBALS['TL_LANG']['MSC']['pagepicker']);
     $template->charset = Config::get('characterSet');
     Config::set('debugMode', false);
     $template->output();
 }
 /**
  * Generate the purge cache field
  *
  * @return string
  */
 public function generatePurgeField()
 {
     System::loadLanguageFile('tl_maintenance');
     $template = new BackendTemplate('be_vimeo_rebuilder_user');
     $template->elementsCount = count(Rebuilder::getContentElements());
     if (($stats = Rebuilder::generateStats()) !== null) {
         foreach ($stats as $k => $v) {
             $template->{$k} = $v;
         }
     }
     return $template->parse();
 }