/** * Compiles the ext_emconf.php file * * @param string Extension key * @param array EM_CONF array * @return string PHP file content, ready to write to ext_emconf.php file */ function construct_ext_emconf_file($extKey, $EM_CONF) { // clean version number: $vDat = tx_em_Tools::renderVersion($EM_CONF['version']); $EM_CONF['version'] = $vDat['version']; $code = '<?php ######################################################################## # Extension Manager/Repository config file for ext "' . $extKey . '". # # Auto generated ' . date('d-m-Y H:i') . ' # # Manual updates: # Only the data in the array - everything else is removed by next # writing. "version" and "dependencies" must not be touched! ######################################################################## $EM_CONF[$_EXTKEY] = ' . tx_em_Tools::arrayToCode($EM_CONF, 0) . '; ?>'; return str_replace(CR, '', $code); }
/** * Upload extension to ter * @param $em * @return */ function uploadToTER($em) { $uArr = $this->emObj->extensionDetails->makeUploadarray($em['extKey'], $em['extInfo']); if (!is_array($uArr)) { return $uArr; } // Render new version number: $newVersionBase = $em['extInfo']['EM_CONF']['version']; switch ((string) $em['upload']['mode']) { case 'new_dev': $cmd = 'dev'; break; case 'new_sub': $cmd = 'sub'; break; case 'new_main': $cmd = 'main'; break; case 'custom': $newVersionBase = $em['upload']['version']; case 'latest': default: $cmd = ''; break; } $versionArr = tx_em_Tools::renderVersion($newVersionBase, $cmd); $em['version'] = $versionArr['version']; // Create dependency / conflict information: $dependenciesArr = array(); $extKeysArr = $uArr['EM_CONF']['constraints']['depends']; if (is_array($extKeysArr)) { foreach ($extKeysArr as $extKey => $version) { if (strlen($extKey)) { $dependenciesArr[] = array('kind' => 'depends', 'extensionKey' => utf8_encode($extKey), 'versionRange' => utf8_encode($version)); } } } $extKeysArr = $uArr['EM_CONF']['constraints']['conflicts']; if (is_array($extKeysArr)) { foreach ($extKeysArr as $extKey => $version) { if (strlen($extKey)) { $dependenciesArr[] = array('kind' => 'conflicts', 'extensionKey' => utf8_encode($extKey), 'versionRange' => utf8_encode($version)); } } } // FIXME: This part must be removed, when the problem is solved on the TER-Server #5919 if (count($dependenciesArr) == 1) { $dependenciesArr[] = array('kind' => 'depends', 'extensionKey' => '', 'versionRange' => ''); } // END for Bug #5919 // Compile data for SOAP call: $accountData = array('username' => $em['user']['fe_u'], 'password' => $em['user']['fe_p']); $extensionData = array('extensionKey' => utf8_encode($em['extKey']), 'version' => utf8_encode($em['version']), 'metaData' => array('title' => utf8_encode($uArr['EM_CONF']['title']), 'description' => utf8_encode($uArr['EM_CONF']['description']), 'category' => utf8_encode($uArr['EM_CONF']['category']), 'state' => utf8_encode($uArr['EM_CONF']['state']), 'authorName' => utf8_encode($uArr['EM_CONF']['author']), 'authorEmail' => utf8_encode($uArr['EM_CONF']['author_email']), 'authorCompany' => utf8_encode($uArr['EM_CONF']['author_company'])), 'technicalData' => array('dependencies' => $dependenciesArr, 'loadOrder' => utf8_encode($uArr['EM_CONF']['loadOrder']), 'uploadFolder' => (bool) intval($uArr['EM_CONF']['uploadfolder']), 'createDirs' => utf8_encode($uArr['EM_CONF']['createDirs']), 'shy' => (bool) intval($uArr['EM_CONF']['shy']), 'modules' => utf8_encode($uArr['EM_CONF']['module']), 'modifyTables' => utf8_encode($uArr['EM_CONF']['modify_tables']), 'priority' => utf8_encode($uArr['EM_CONF']['priority']), 'clearCacheOnLoad' => (bool) intval($uArr['EM_CONF']['clearCacheOnLoad']), 'lockType' => utf8_encode($uArr['EM_CONF']['lockType']), 'doNotLoadInFEe' => utf8_encode($uArr['EM_CONF']['doNotLoadInFE']), 'docPath' => utf8_encode($uArr['EM_CONF']['docPath'])), 'infoData' => array('codeLines' => intval($uArr['misc']['codelines']), 'codeBytes' => intval($uArr['misc']['codebytes']), 'codingGuidelinesCompliance' => utf8_encode($uArr['EM_CONF']['CGLcompliance']), 'codingGuidelinesComplianceNotes' => utf8_encode($uArr['EM_CONF']['CGLcompliance_note']), 'uploadComment' => utf8_encode($em['upload']['comment']), 'techInfo' => $uArr['techInfo'])); $filesData = array(); foreach ($uArr['FILES'] as $filename => $infoArr) { $filesData[] = array('name' => utf8_encode($infoArr['name']), 'size' => intval($infoArr['size']), 'modificationTime' => intval($infoArr['mtime']), 'isExecutable' => intval($infoArr['is_executable']), 'content' => $infoArr['content'], 'contentMD5' => $infoArr['content_md5']); } $soap = t3lib_div::makeInstance('tx_em_Connection_Soap'); $soap->init(array('wsdl' => $this->wsdlURL, 'soapoptions' => array('trace' => 1, 'exceptions' => 0))); $response = $soap->call('uploadExtension', array('accountData' => $accountData, 'extensionData' => $extensionData, 'filesData' => $filesData)); if ($response === FALSE) { switch (TRUE) { case is_string($soap->error): return $soap->error; break; default: return $soap->error->faultstring; } } return $response; }
/** * performs various compatibility modifications * and fixes/workarounds for wireit limitations * * @param array $extensionConfigurationJSON * @param boolean $prepareForModeler * * @return array the modified configuration */ public function fixExtensionBuilderJSON($extensionConfigurationJSON, $prepareForModeler) { $extBuilderVersion = tx_em_Tools::renderVersion($extensionConfigurationJSON['log']['extension_builder_version']); $extensionConfigurationJSON['modules'] = $this->mapOldRelationTypesToNewRelationTypes($extensionConfigurationJSON['modules']); $extensionConfigurationJSON['modules'] = $this->generateUniqueIDs($extensionConfigurationJSON['modules']); $extensionConfigurationJSON['modules'] = $this->resetOutboundedPositions($extensionConfigurationJSON['modules']); $extensionConfigurationJSON['modules'] = $this->mapAdvancedMode($extensionConfigurationJSON['modules'], $prepareForModeler); $extensionConfigurationJSON['modules'] = $this->mapOldActions($extensionConfigurationJSON['modules']); if ($extBuilderVersion['version_int'] < 2000100) { $extensionConfigurationJSON = $this->importExistingActionConfiguration($extensionConfigurationJSON); } $extensionConfigurationJSON = $this->reArrangeRelations($extensionConfigurationJSON); return $extensionConfigurationJSON; }