/**
  * Writes the extension list to "localconf.php" file
  * Removes the temp_CACHED* files before return.
  *
  * @param	string		List of extensions
  * @return	void
  * @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 - Use Tx_Install_Updates_Base::installExtensions() instead
  */
 protected function writeNewExtensionList($newExtList)
 {
     t3lib_div::logDeprecatedFunction();
     // Instance of install tool
     $instObj = new t3lib_install();
     $instObj->allowUpdateLocalConf = 1;
     $instObj->updateIdentity = 'TYPO3 Core Update Manager';
     // Get lines from localconf file
     $lines = $instObj->writeToLocalconf_control();
     $instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList);
     $instObj->writeToLocalconf_control($lines);
     $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList;
     t3lib_extMgm::removeCacheFiles();
 }
 /**
  * Writes the TSstyleconf values to "localconf.php"
  * Removes the temp_CACHED* files before return.
  *
  * @param	string		Extension key
  * @param	array		Configuration array to write back
  * @return	void
  */
 function writeTsStyleConfig($extKey, $arr)
 {
     // Instance of install tool
     $instObj = new t3lib_install();
     $instObj->allowUpdateLocalConf = 1;
     $instObj->updateIdentity = 'TYPO3 Extension Manager';
     // Get lines from localconf file
     $lines = $instObj->writeToLocalconf_control();
     $instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extConf\'][\'' . $extKey . '\']', serialize($arr));
     // This will be saved only if there are no linebreaks in it !
     $instObj->writeToLocalconf_control($lines);
     $this->removeCacheFiles();
 }
 /**
  * Writes the extension list to "localconf.php" file
  * Removes the temp_CACHED* files before return.
  *
  * @param	string		List of extensions
  * @return	void
  */
 function writeNewExtensionList($newExtList)
 {
     $strippedExtensionList = $this->stripNonFrontendExtensions($newExtList);
     // Instance of install tool
     $instObj = new t3lib_install();
     $instObj->allowUpdateLocalConf = 1;
     $instObj->updateIdentity = 'TYPO3 Extension Manager';
     // Get lines from localconf file
     $lines = $instObj->writeToLocalconf_control();
     $instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList);
     $instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList_FE\']', $strippedExtensionList);
     $instObj->writeToLocalconf_control($lines);
     $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList;
     $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList_FE'] = $strippedExtensionList;
     t3lib_extMgm::removeCacheFiles();
 }
 /**
  * Write back configuration
  *
  * @param array $extConf
  * @return void
  */
 protected function writeExtConf($extConf)
 {
     $install = new t3lib_install();
     $install->allowUpdateLocalConf = 1;
     $install->updateIdentity = 'Caretaker Instance installation';
     $lines = $install->writeToLocalconf_control();
     $install->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extConf\'][\'caretaker_instance\']', serialize($extConf));
     $install->writeToLocalconf_control($lines);
     t3lib_extMgm::removeCacheFiles();
 }
Пример #5
0
 /**
  * Updates the mapping in localconf.php according to form input values.
  *
  * @param array $data
  * @param t3lib_install $instObj
  * @return void
  * @api
  */
 public function updateMapping(array $data, t3lib_install $instObj)
 {
     $newMapping = $this->mapping;
     foreach ($data['tables'] as $table => $newName) {
         $newName = trim($newName);
         if ($newName && $newName !== $table) {
             if (!isset($newMapping[$table])) {
                 $newMapping[$table] = array();
             }
             $newMapping[$table]['mapTableName'] = $newName;
         }
         if (isset($data['fields'][$table])) {
             foreach ($data['fields'][$table] as $field => $newName) {
                 $newName = trim($newName);
                 if ($newName && $newName !== $field) {
                     if (!isset($newMapping[$table])) {
                         $newMapping[$table] = array();
                     }
                     if (!isset($newMapping[$table]['mapFieldNames'])) {
                         $newMapping[$table]['mapFieldNames'] = array();
                     }
                     $newMapping[$table]['mapFieldNames'][$field] = $newName;
                 }
             }
         }
     }
     // Sort table and field names
     foreach ($newMapping as $table => &$config) {
         if (isset($config['mapFieldNames'])) {
             ksort($config['mapFieldNames']);
         }
     }
     ksort($newMapping);
     // Write new mapping to localconf.php
     $key = '$TYPO3_CONF_VARS[\'EXTCONF\'][\'dbal\'][\'mapping\']';
     $instObj->allowUpdateLocalConf = 1;
     $instObj->updateIdentity = 'TYPO3 Extension Manager';
     $lines = $instObj->writeToLocalconf_control();
     $instObj->setArrayValueInLocalconfFile($lines, $key, $newMapping);
     if ($instObj->writeToLocalconf($lines)) {
         $this->mapping = $newMapping;
     }
 }
 /**
  * Writes or returns lines from localconf.php
  *
  * @param array $lines Array of lines to write back to localconf.php. Possibly
  * @param boolean $showOutput If TRUE then print what has been done.
  * @return mixed If $lines is not an array it will return an array with the lines from localconf.php. Otherwise it will return a status string, either "continue" (updated) or "nochange" (not updated)
  * @see parent::writeToLocalconf_control()
  */
 function writeToLocalconf_control($lines = '', $showOutput = TRUE)
 {
     // Get the template file
     $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'WriteToLocalConfControl.html');
     $returnVal = parent::writeToLocalconf_control($lines);
     if ($showOutput) {
         switch ($returnVal) {
             case 'continue':
                 // Get the template part from the file
                 $template = t3lib_parsehtml::getSubpart($templateFile, '###CONTINUE###');
                 // Get the subpart for messages
                 $messagesSubPart = t3lib_parsehtml::getSubpart($template, '###MESSAGES###');
                 $messages = array();
                 foreach ($this->messages as $message) {
                     // Define the markers content
                     $messagesMarkers['message'] = $message;
                     // Fill the markers in the subpart
                     $messages[] = t3lib_parsehtml::substituteMarkerArray($messagesSubPart, $messagesMarkers, '###|###', TRUE, FALSE);
                 }
                 // Substitute the subpart for messages
                 $content = t3lib_parsehtml::substituteSubpart($template, '###MESSAGES###', implode(chr(10), $messages));
                 // Define the markers content
                 $markers = array('header' => 'Writing to \'localconf.php\'', 'action' => $this->action, 'label' => 'Click to continue...');
                 // Fill the markers
                 $content = t3lib_parsehtml::substituteMarkerArray($content, $markers, '###|###', TRUE, FALSE);
                 $this->outputExitBasedOnStep($content);
                 break;
             case 'nochange':
                 // Get the template part from the file
                 $template = t3lib_parsehtml::getSubpart($templateFile, '###NOCHANGE###');
                 // Define the markers content
                 $markers = array('header' => 'Writing to \'localconf.php\'', 'message' => 'No values were changed, so nothing is updated!', 'action' => $this->action, 'label' => 'Click to continue...');
                 // Fill the markers
                 $content = t3lib_parsehtml::substituteMarkerArray($template, $markers, '###|###', TRUE, FALSE);
                 $this->outputExitBasedOnStep($content);
                 break;
         }
     }
     return $returnVal;
 }