Exemplo n.º 1
0
 /**
  * Post-save handler.
  */
 protected function _postSave()
 {
     if ($this->isUpdate() && $this->isChanged('title')) {
         $this->_db->delete('xf_admin_template_compiled', 'title = ' . $this->_db->quote($this->getExisting('title')));
         $this->_db->delete('xf_admin_template_include', 'source_id = ' . $this->_db->quote($this->get('template_id')));
         $this->_db->delete('xf_admin_template_phrase', 'template_id = ' . $this->_db->quote($this->get('template_id')));
     }
     if ($this->getOption(self::OPTION_FULL_COMPILE)) {
         XenForo_Template_Compiler_Admin::removeTemplateFromCache($this->get('title'));
         XenForo_Template_Compiler_Admin::removeTemplateFromCache($this->getExisting('title'));
         $this->_recompileTemplate();
         $this->_recompileDependentTemplates();
         $this->_getAdminTemplateModel()->updateAdminStyleLastModifiedDate();
     }
     if ($devDir = $this->_getDevOutputDir()) {
         $this->_writeDevFileOutput($devDir);
     }
 }
Exemplo n.º 2
0
 /**
  * Post-save handler.
  */
 protected function _postSave()
 {
     $adminTemplateModel = $this->_getAdminTemplateModel();
     if ($this->isUpdate() && $this->isChanged('template')) {
         $this->_db->insert('xf_brivium_admin_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')) {
             $adminTemplateModel->buildAdminTemplateMap($this->get('title'));
             if ($existingTitle = $this->getExisting('title')) {
                 if ($this->getOption(self::OPTION_FULL_COMPILE)) {
                     // need to recompile anything including this template
                     $mappedAdminTemplates = $adminTemplateModel->getAdminTemplateMappedsByAdminTemplateId($this->get('template_id'));
                     $mappedAdminTemplateIds = array();
                     foreach ($mappedAdminTemplates as $mappedAdminTemplate) {
                         $mappedAdminTemplateIds[] = $mappedAdminTemplate['template_map_id'];
                     }
                     $adminTemplateModel->buildAdminTemplateMap($existingTitle);
                     $adminTemplateModel->compileAdminTemplateMappedsInStyleTree($adminTemplateModel->getIncludingAdminTemplateMapIds($mappedAdminTemplateIds));
                 } else {
                     $adminTemplateModel->buildAdminTemplateMap($existingTitle);
                 }
             }
         } else {
             if ($this->isChanged('style_id')) {
                 $adminTemplateModel->buildAdminTemplateMap($this->get('title'));
             }
         }
     }
     if ($this->getOption(self::OPTION_FULL_COMPILE)) {
         XenForo_Template_Compiler_Admin::removeTemplateFromCache($this->get('title'));
         XenForo_Template_Compiler_Admin::removeTemplateFromCache($this->getExisting('title'));
         $this->_recompileAdminTemplate();
         $styleModel = $this->getModelFromCache('XenForo_Model_Style');
         $styleModel->setAdminStyles(true);
         $styleModel->updateAllStylesLastModifiedDate();
         $this->getModelFromCache('XenForo_Model_AdminTemplate')->updateAdminStyleLastModifiedDate();
     }
     if ($devDir = $this->_getDevOutputDir()) {
         $this->_writeDevFileOutput($devDir);
     }
     if ($this->getOption(self::OPTION_REBUILD_XENFORO_ADMIN_TEMPLATE) && !$this->get('style_id')) {
         $this->_updateToXfAdminTemplate();
     }
 }