/**
  * Return the update process HTML content
  *
  * @return string
  */
 public function main()
 {
     $extConf = $this->getExtConf();
     $this->factory = tx_caretakerinstance_ServiceFactory::getInstance();
     try {
         list($publicKey, $privateKey) = $this->factory->getCryptoManager()->generateKeyPair();
         $extConf['crypto.']['instance.']['publicKey'] = $publicKey;
         $extConf['crypto.']['instance.']['privateKey'] = $privateKey;
         $this->writeExtensionConfiguration($extConf);
         $content = "Success: Generated public / private key";
     } catch (Exception $exception) {
         $content = 'Error: ' . $exception->getMessage();
     }
     return $content;
 }
 /**
  * Execute a list of operations on the configured instance.
  *
  * The operations must be of the form
  * <code>
  * array(array("SomeOperationWithParams", array("foo" => "bar")), array("OperationWithoutParams"))
  * </code>
  *
  * @param $operations Array of array of operations
  * @return tx_caretakerinstance_CommandResult|boolean
  */
 protected function executeRemoteOperations($operations)
 {
     $factory = tx_caretakerinstance_ServiceFactory::getInstance();
     $connector = $factory->getRemoteCommandConnector();
     $connector->setInstance($this->instance);
     return $connector->executeOperations($operations);
 }
 /**
  * Return the update process HTML content
  *
  * @return string
  */
 public function main()
 {
     $extConf = $this->getExtConf();
     $this->factory = tx_caretakerinstance_ServiceFactory::getInstance();
     try {
         list($publicKey, $privateKey) = $this->factory->getCryptoManager()->generateKeyPair();
         $extConf['crypto.']['instance.']['publicKey'] = $publicKey;
         $extConf['crypto.']['instance.']['privateKey'] = $privateKey;
         $typo3Version = explode('.', TYPO3_version);
         $majorVersion = intval($typo3Version[0]);
         if ($majorVersion >= 6) {
             $this->writeExtensionConfiguration($extConf);
         } else {
             $this->writeExtConf($extConf);
         }
         $content = "Success: Generated public / private key";
     } catch (Exception $exception) {
         $content = 'Error: ' . $exception->getMessage();
     }
     return $content;
 }
 /**
  * Destroy the factory instance
  */
 public function destroy()
 {
     self::$instance = null;
 }
 * $Id$
 */
// Exit, if script is called directly (must be included via eID in index_ts.php)
if (!defined('PATH_typo3conf')) {
    die('Could not access this script directly!');
}
/*
if($_SERVER['REQUEST_METHOD'] != 'POST') {
	header('HTTP/1.0 500 Invalid request');
	exit;
}
*/
require_once t3lib_extMgm::extPath('caretaker_instance', 'classes/class.tx_caretakerinstance_ServiceFactory.php');
tslib_eidtools::connectDB();
try {
    $factory = tx_caretakerinstance_ServiceFactory::getInstance();
    $commandService = $factory->getCommandService();
    $remoteAddress = $_SERVER['REMOTE_ADDR'];
    if ($_SERVER['REQUEST_METHOD'] == 'GET') {
        if (isset($_GET['rst'])) {
            $token = $commandService->requestSessionToken($remoteAddress);
            if (!$token) {
                header('HTTP/1.0 403 Request not allowed');
            } else {
                echo $token;
            }
        } else {
            header('HTTP/1.0 500 Invalid request');
        }
    } else {
        if (isset($_POST['st']) && isset($_POST['d']) && isset($_POST['s'])) {
 function tearDown()
 {
     // Destroy Service Factory singleton after each test
     tx_caretakerinstance_ServiceFactory::destroy();
 }