/** * @see \wcf\data\IEditableObject::deleteAll() */ public static function deleteAll(array $objectIDs = array()) { $list = new TemplateList(); $list->setObjectIDs($objectIDs); $list->readObjects(); foreach ($list as $template) { $editor = new TemplateEditor($template); $editor->deleteFile(); } return parent::deleteAll($objectIDs); }
/** * @see \wcf\page\IPage::readData() */ public function readData() { parent::readData(); // read out template groups $templateGroupList = new TemplateGroupList(); $templateGroupList->readObjects(); // build template group hierarchy (template groups that are parents of the template group of the selected template) $this->templateGroupHierarchy = array(); $templateGroup = $templateGroupList->search($this->template->templateGroupID); while ($templateGroup !== null) { $this->templateGroupHierarchy[$templateGroup->templateGroupID] = array('group' => $templateGroup, 'hasTemplate' => false); $templateGroup = $templateGroupList->search($templateGroup->parentTemplateGroupID); } $this->templateGroupHierarchy[0] = array('group' => array(), 'hasTemplate' => false); // find matching templates in the hierarchy $templateList = new TemplateList(); $templateList->getConditionBuilder()->add('templateName = ?', array($this->template->templateName)); $templateList->getConditionBuilder()->add('application = ?', array($this->template->application)); $templateList->getConditionBuilder()->add('(template.templateGroupID IN(?) OR template.templateGroupID IS NULL)', array(array_keys($this->templateGroupHierarchy))); $templateList->readObjects(); foreach ($templateList as $template) { $this->templateGroupHierarchy[$template->templateGroupID ?: 0]['hasTemplate'] = $template->templateID; } // a valid parent template was given, calculate diff if ($this->parent->templateID) { $a = explode("\n", StringUtil::unifyNewlines($this->parent->getSource())); $b = explode("\n", StringUtil::unifyNewlines($this->template->getSource())); $this->diff = new Diff($a, $b); } }