/**
  * Method returns UID of the current repository.
  *
  * @access  public
  * @param   boolean	$insertIfMissing  creates repository record in DB if set to TRUE
  * @return  integer
  */
 public function getRepositoryUID($insertIfMissing = FALSE)
 {
     $uid = $this->repository->getId();
     $repository = tx_em_Database::getRepositoryByUID($uid);
     if (empty($repository) && $insertIfMissing) {
         $uid = tx_em_Database::insertRepository($this->repository);
     } else {
         $uid = intval($repository['uid']);
     }
     return $uid;
 }
 /**
  * Insert main repository if not present
  *
  * @return void
  */
 protected function fixMainRepository()
 {
     $this->setTitle('TYPO3.org Main Repository');
     $this->setId('1');
     $this->setPriority(1);
     $this->setDescription('Main repository on typo3.org. For extension download there are mirrors available.');
     $this->setMirrorListUrl('http://repositories.typo3.org/mirrors.xml.gz');
     $this->setWsdlUrl('http://typo3.org/wsdl/tx_ter_wsdl.php');
     tx_em_Database::insertRepository($this);
 }
 /**
  * Edit / Create repository
  *
  * @formHandler
  * @param array $parameter
  * @return array
  */
 public function repositoryEditFormSubmit($parameter)
 {
     $repId = intval($parameter['rep']);
     /** @var $repository tx_em_Repository */
     $repository = t3lib_div::makeInstance('tx_em_Repository', $repId);
     $repository->setTitle($parameter['title']);
     $repository->setDescription($parameter['description']);
     $repository->setWsdlUrl($parameter['wsdl_url']);
     $repository->setMirrorListUrl($parameter['mirror_url']);
     $repositoryData = array('title' => $repository->getTitle(), 'description' => $repository->getDescription(), 'wsdl_url' => $repository->getWsdlUrl(), 'mirror_url' => $repository->getMirrorListUrl(), 'lastUpdated' => $repository->getLastUpdate(), 'extCount' => $repository->getExtensionCount());
     if ($repId === 0) {
         // create a new repository
         $id = tx_em_Database::insertRepository($repository);
         return array('success' => TRUE, 'newId' => $id, 'params' => $repositoryData);
     } else {
         tx_em_Database::updateRepository($repository);
         return array('success' => TRUE, 'params' => $repositoryData);
     }
 }