Beispiel #1
0
 /**
  * Post-save handler.
  */
 protected function _postSave()
 {
     $templateModel = $this->_getTemplateModel();
     if ($this->isUpdate() && $this->isChanged('template')) {
         $this->_db->insert('xf_template_history', array('title' => $this->get('title'), 'style_id' => $this->get('style_id'), 'template' => $this->getExisting('template'), 'edit_date' => $this->getExisting('last_edit_date'), 'log_date' => XenForo_Application::$time));
     }
     if (is_array($this->_modificationStatuses)) {
         $this->_getModificationModel()->updateTemplateModificationLog($this->get('template_id'), $this->_modificationStatuses);
     }
     if ($this->getOption(self::OPTION_REBUILD_TEMPLATE_MAP)) {
         if ($this->isChanged('title')) {
             $templateModel->buildTemplateMap($this->get('title'));
             if ($existingTitle = $this->getExisting('title')) {
                 if ($this->getOption(self::OPTION_FULL_COMPILE)) {
                     // need to recompile anything including this template
                     $mappedTemplates = $templateModel->getMappedTemplatesByTemplateId($this->get('template_id'));
                     $mappedTemplateIds = array();
                     foreach ($mappedTemplates as $mappedTemplate) {
                         $mappedTemplateIds[] = $mappedTemplate['template_map_id'];
                     }
                     $templateModel->buildTemplateMap($existingTitle);
                     $templateModel->compileMappedTemplatesInStyleTree($templateModel->getIncludingTemplateMapIds($mappedTemplateIds));
                 } else {
                     $templateModel->buildTemplateMap($existingTitle);
                 }
             }
         } else {
             if ($this->isChanged('style_id')) {
                 $templateModel->buildTemplateMap($this->get('title'));
             }
         }
     }
     if ($this->getOption(self::OPTION_FULL_COMPILE)) {
         XenForo_Template_Compiler::removeTemplateFromCache($this->get('title'));
         XenForo_Template_Compiler::removeTemplateFromCache($this->getExisting('title'));
         $this->_recompileTemplate();
         $this->getModelFromCache('XenForo_Model_Style')->updateAllStylesLastModifiedDate();
         $this->getModelFromCache('XenForo_Model_AdminTemplate')->updateAdminStyleLastModifiedDate();
     }
     if ($devDir = $this->_getDevOutputDir()) {
         $this->_writeDevFileOutput($devDir);
     }
 }
Beispiel #2
0
 /**
  * Post-save handler.
  */
 protected function _postSave()
 {
     $templateModel = $this->_getTemplateModel();
     if ($this->getOption(self::OPTION_REBUILD_TEMPLATE_MAP)) {
         if ($this->isChanged('title')) {
             $templateModel->buildTemplateMap($this->get('title'));
             if ($existingTitle = $this->getExisting('title')) {
                 if ($this->getOption(self::OPTION_FULL_COMPILE)) {
                     // need to recompile anything including this template
                     $mappedTemplates = $templateModel->getMappedTemplatesByTemplateId($this->get('template_id'));
                     $mappedTemplateIds = array();
                     foreach ($mappedTemplates as $mappedTemplate) {
                         $mappedTemplateIds[] = $mappedTemplate['template_map_id'];
                     }
                     $templateModel->buildTemplateMap($existingTitle);
                     $templateModel->compileMappedTemplatesInStyleTree($templateModel->getIncludingTemplateMapIds($mappedTemplateIds));
                 } else {
                     $templateModel->buildTemplateMap($existingTitle);
                 }
             }
         } else {
             if ($this->isChanged('style_id')) {
                 $templateModel->buildTemplateMap($this->get('title'));
             }
         }
     }
     if ($this->getOption(self::OPTION_FULL_COMPILE)) {
         XenForo_Template_Compiler::removeTemplateFromCache($this->get('title'));
         XenForo_Template_Compiler::removeTemplateFromCache($this->getExisting('title'));
         $this->_recompileTemplate();
         $this->getModelFromCache('XenForo_Model_Style')->updateAllStylesLastModifiedDate();
     }
     if ($devDir = $this->_getDevOutputDir()) {
         $this->_writeDevFileOutput($devDir);
     }
 }