コード例 #1
0
 /**
  * Show Documentation
  *
  * @param string $lang 
  * @param string $doc 
  * @param string $page 
  * @return void
  * @author Marc Neuhaus
  */
 public function indexAction($lang = "en", $doc = "Manual", $page = "index.html")
 {
     \Admin\Core\API::addTitleSegment("Documentation");
     \Admin\Core\API::addTitleSegment($page);
     if ($this->request->hasArgument("subpage1")) {
         $c = 1;
         $directories = array($page);
         while ($c < 10) {
             if ($this->request->hasArgument("subpage" . $c)) {
                 $directories[] = $this->request->getArgument("subpage" . $c);
             } else {
                 break;
             }
             $c++;
         }
         $page = implode("/", $directories);
     }
     if (!stristr($page, ".html")) {
         $page .= ".html";
     }
     $page = urldecode($page);
     if ($lang == "index") {
         $lang = "en";
     }
     $package = $this->packageManager->getPackage("Admin");
     $path = "resource://Admin/Private/Docs/";
     $template = $path . $doc . "/" . $lang . "/html/" . $page;
     $this->view->setTemplatePathAndFilename($template);
     $this->view->assign("base", "/admin/doc/en/");
     $content = $this->view->render();
     $content = preg_replace('/internal" href="([A-Za-z0-9])/', 'internal" href="/admin/doc/' . $lang . '/\\1', $content);
     $content = str_replace('href="#', 'href="/admin/doc/' . $lang . '/' . $page . '#', $content);
     $content = str_replace('{ ', '{', $content);
     return $content;
 }
コード例 #2
0
 /**
  * Evaluates the absolute path and filename of the resource file specified
  * by the given path.
  *
  * @param string $requestedPath
  * @param boolean $checkForExistence Whether a (non-hash) path should be checked for existence before being returned
  * @return mixed The full path and filename or FALSE if the file doesn't exist
  * @throws \TYPO3\FLOW3\Resource\Exception
  * @throws \InvalidArgumentException
  */
 protected function evaluateResourcePath($requestedPath, $checkForExistence = TRUE)
 {
     if (substr($requestedPath, 0, strlen(self::SCHEME)) !== self::SCHEME) {
         throw new \InvalidArgumentException('The ' . __CLASS__ . ' only supports the \'' . self::SCHEME . '\' scheme.', 1256052544);
     }
     $uriParts = parse_url($requestedPath);
     if (!is_array($uriParts) || !isset($uriParts['host'])) {
         return FALSE;
     }
     if (strlen($uriParts['host']) === 40) {
         $resourcePath = $this->resourceManager->getPersistentResourcesStorageBaseUri() . $uriParts['host'];
         if ($checkForExistence === FALSE || file_exists($resourcePath)) {
             return $resourcePath;
         } else {
             return FALSE;
         }
     }
     if (!$this->packageManager->isPackageAvailable($uriParts['host'])) {
         throw new \TYPO3\FLOW3\Resource\Exception(sprintf('Invalid resource URI "%s": Package "%s" is not available.', $requestedPath, $uriParts['host']), 1309269952);
     }
     $package = $this->packageManager->getPackage($uriParts['host']);
     $resourcePath = \TYPO3\FLOW3\Utility\Files::concatenatePaths(array($package->getResourcesPath(), $uriParts['path']));
     if ($checkForExistence === FALSE || file_exists($resourcePath)) {
         return $resourcePath;
     }
     return FALSE;
 }
コード例 #3
0
 /**
  * Generates a new migration file and returns the path to it.
  *
  * If $diffAgainstCurrent is TRUE, it generates a migration file with the
  * diff between current DB structure and the found mapping metadata.
  *
  * Otherwise an empty migration skeleton is generated.
  *
  * @param boolean $diffAgainstCurrent
  * @return string Path to the new file
  */
 public function generateAndExecutePartialMigrationFor($tables = array(), $package = null, $diffAgainstCurrent = TRUE)
 {
     $configuration = $this->getMigrationConfiguration();
     $up = NULL;
     $down = NULL;
     if ($diffAgainstCurrent === TRUE) {
         $connection = $this->entityManager->getConnection();
         $platform = $connection->getDatabasePlatform();
         $metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
         if (empty($metadata)) {
             return 'No mapping information to process.';
         }
         $tool = new \Doctrine\ORM\Tools\SchemaTool($this->entityManager);
         $fromSchema = $connection->getSchemaManager()->createSchema();
         $toSchema = $tool->getSchemaFromMetadata($metadata);
         $fromSchema = $this->filterSchema($fromSchema, $tables);
         $toSchema = $this->filterSchema($toSchema, $tables);
         $up = $this->buildCodeFromSql($configuration, $fromSchema->getMigrateToSql($toSchema, $platform));
         $down = $this->buildCodeFromSql($configuration, $fromSchema->getMigrateFromSql($toSchema, $platform));
         if (!$up && !$down) {
             return 'No changes detected in your mapping information.';
         }
     }
     if (!is_null($package) && $this->packageManager->isPackageActive($package)) {
         $package = $this->packageManager->getPackage($package);
         $migrationsPath = $package->getPackagePath() . "Migrations/" . ucfirst($platform->getName()) . "/";
         $configuration->setMigrationsDirectory($migrationsPath);
     }
     $migrationFile = $this->writeMigrationClassToFile($configuration, $up, $down);
     preg_match("/Version([0-9]+)\\.php/", $migrationFile, $matches);
     $version = $matches[1];
     $this->executeMigration($version);
 }
コード例 #4
0
 /**
  * Processes the template files
  * 
  * @return void 
  */
 protected function processTemplateFiles()
 {
     $this->backporter->emptyTargetPath(FALSE);
     $replacePairs = array('f:form.checkbox' => 'form:form.checkbox');
     $this->backporter->setReplacePairs($replacePairs);
     $this->backporter->setFileSpecificReplacePairs(array());
     $this->backporter->setCodeProcessorClassName('TYPO3\\FormBackporter\\CodeProcessor\\TemplateCodeProcessor');
     $this->backporter->setIncludeFilePatterns(array('#^Resources/Private/Form/.*.html$#'));
     $this->backporter->processFiles($this->packageManager->getPackage('TYPO3.Form')->getPackagePath(), $this->settings['targetPath']);
 }
コード例 #5
0
 /**
  * @return void
  */
 protected function displayHelpIndex()
 {
     $context = $this->bootstrap->getContext();
     $this->outputLine('<b>FLOW3 %s ("%s" context)</b>', array($this->packageManager->getPackage('TYPO3.FLOW3')->getPackageMetaData()->getVersion(), $context));
     $this->outputLine('<i>usage: %s <command identifier></i>', array($this->getFlow3InvocationString()));
     $this->outputLine();
     $this->outputLine('The following commands are currently available:');
     $this->displayShortHelpForCommands($this->commandManager->getAvailableCommands());
     $this->outputLine('* = compile time command');
     $this->outputLine();
     $this->outputLine('See "%s help <commandidentifier>" for more information about a specific command.', array($this->getFlow3InvocationString()));
     $this->outputLine();
 }
コード例 #6
0
ファイル: ReflectionService.php プロジェクト: nxpthx/FLOW3
 /**
  * Stores the current reflection data related to classes of the specified package
  * in the PrecompiledReflectionData directory for the current context.
  *
  * This method is used by the package manager.
  *
  * @param string $packageKey
  * @return void
  */
 public function freezePackageReflection($packageKey)
 {
     $package = $this->packageManager->getPackage($packageKey);
     $packageNamespace = $package->getPackageNamespace() . '\\';
     $packageNamespaceLength = strlen($packageNamespace);
     $reflectionData = array('classReflectionData' => $this->classReflectionData, 'classSchemata' => $this->classSchemata, 'annotatedClasses' => $this->annotatedClasses, 'classesByMethodAnnotations' => $this->classesByMethodAnnotations);
     foreach (array_keys($reflectionData['classReflectionData']) as $className) {
         if (substr($className, 0, $packageNamespaceLength) !== $packageNamespace) {
             unset($reflectionData['classReflectionData'][$className]);
         }
     }
     foreach (array_keys($reflectionData['classSchemata']) as $className) {
         if (substr($className, 0, $packageNamespaceLength) !== $packageNamespace) {
             unset($reflectionData['classSchemata'][$className]);
         }
     }
     foreach (array_keys($reflectionData['annotatedClasses']) as $className) {
         if (substr($className, 0, $packageNamespaceLength) !== $packageNamespace) {
             unset($reflectionData['annotatedClasses'][$className]);
         }
     }
     if (isset($reflectionData['classesByMethodAnnotations'])) {
         foreach ($reflectionData['classesByMethodAnnotations'] as $annotationClassName => $classNames) {
             foreach ($classNames as $index => $className) {
                 if (substr($className, 0, $packageNamespaceLength) !== $packageNamespace) {
                     unset($reflectionData['classesByMethodAnnotations'][$annotationClassName][$index]);
                 }
             }
         }
     }
     $precompiledReflectionStoragePath = $this->getPrecompiledReflectionStoragePath();
     if (!is_dir($precompiledReflectionStoragePath)) {
         Files::createDirectoryRecursively($precompiledReflectionStoragePath);
     }
     $pathAndFilename = $precompiledReflectionStoragePath . $packageKey . '.dat';
     file_put_contents($pathAndFilename, extension_loaded('igbinary') ? igbinary_serialize($reflectionData) : serialize($reflectionData));
 }