public function actionGenerateInstaller() { $addOnId = $this->_input->filterSingle('addon_id', XenForo_Input::STRING); $addOn = $this->_getAddOnOrError($addOnId); $config = $this->_getConfigModel()->loadAddOnConfig($addOn); list($className, $contents) = DevHelper_Generator_Code_Installer::generate($addOn, $config); DevHelper_Generator_File::writeClass($className, $contents); $dw = XenForo_DataWriter::create('XenForo_DataWriter_AddOn'); $dw->setExistingData($addOn); $dw->set('install_callback_class', $className); $dw->set('install_callback_method', 'install'); $dw->set('uninstall_callback_class', $className); $dw->set('uninstall_callback_method', 'uninstall'); $dw->save(); $xmlPath = DevHelper_Generator_File::getAddOnXmlPath($addOn, null, $config); $this->_getAddOnModel()->getAddOnXml($addOn)->save($xmlPath); if ($this->_input->filterSingle('run', XenForo_Input::UINT)) { call_user_func(array($className, 'install'), $dw->getMergedData(), $dw->getMergedData()); } return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CREATED, XenForo_Link::buildAdminLink('add-ons/data-manager', $addOn)); }
public function saveAddOnConfig($addOn, DevHelper_Config_Base $config) { $className = DevHelper_Generator_File::getClassName($addOn['addon_id'], 'DevHelper_Config'); DevHelper_Generator_File::writeClass($className, $config->outputSelf()); }