コード例 #1
0
 /**
  * Return the json array for a given locale, sourceCatalog, xliffPath and package.
  * The json will be cached.
  *
  * @param Locale $locale The locale
  * @throws \TYPO3\Flow\I18n\Exception
  * @return \TYPO3\Flow\Error\Result
  */
 public function getCachedJson(Locale $locale)
 {
     $cacheIdentifier = md5($locale);
     if ($this->xliffToJsonTranslationsCache->has($cacheIdentifier)) {
         $json = $this->xliffToJsonTranslationsCache->get($cacheIdentifier);
     } else {
         $labels = [];
         $localeChain = $this->localizationService->getLocaleChain($locale);
         foreach ($this->packagesRegisteredForAutoInclusion as $packageKey => $sourcesToBeIncluded) {
             if (!is_array($sourcesToBeIncluded)) {
                 continue;
             }
             $translationBasePath = Files::concatenatePaths([$this->packageManager->getPackage($packageKey)->getResourcesPath(), $this->xliffBasePath]);
             // We merge labels in the chain from the worst choice to best choice
             foreach (array_reverse($localeChain) as $allowedLocale) {
                 $localeSourcePath = Files::getNormalizedPath(Files::concatenatePaths([$translationBasePath, $allowedLocale]));
                 foreach ($sourcesToBeIncluded as $sourceName) {
                     foreach (glob($localeSourcePath . $sourceName . '.xlf') as $xliffPathAndFilename) {
                         $xliffPathInfo = pathinfo($xliffPathAndFilename);
                         $sourceName = str_replace($localeSourcePath, '', $xliffPathInfo['dirname'] . '/' . $xliffPathInfo['filename']);
                         $labels = Arrays::arrayMergeRecursiveOverrule($labels, $this->parseXliffToArray($xliffPathAndFilename, $packageKey, $sourceName));
                     }
                 }
             }
         }
         $json = json_encode($labels);
         $this->xliffToJsonTranslationsCache->set($cacheIdentifier, $json);
     }
     return $json;
 }
コード例 #2
0
 /**
  * Set the routes configuration for the Neos setup and configures the routing component
  * to skip initialisation, which would overwrite the specific settings again.
  *
  * @param ComponentContext $componentContext
  * @return void
  */
 public function handle(ComponentContext $componentContext)
 {
     $configurationSource = $this->objectManager->get('TYPO3\\Flow\\Configuration\\Source\\YamlSource');
     $routesConfiguration = $configurationSource->load($this->packageManager->getPackage('TYPO3.Setup')->getConfigurationPath() . ConfigurationManager::CONFIGURATION_TYPE_ROUTES);
     $this->router->setRoutesConfiguration($routesConfiguration);
     $componentContext->setParameter('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'skipRouterInitialization', TRUE);
 }
コード例 #3
0
 /**
  * @param $patchId
  * @return \TYPO3\Flow\Package\PackageInterface
  */
 public function getPatchTargetPackage($patchId)
 {
     $details = $this->requestGerritAPI(sprintf($this->gerritApiPattern, $patchId, 'detail'));
     $projectParts = explode('/', $details['project']);
     $packageName = $projectParts[1];
     $package = $this->packageManager->getPackage($packageName);
     return $package;
 }
コード例 #4
0
 /**
  * Resolve view object. Falls back to TYPO3.Ice package templates
  * if current package does not contain a template for current request.
  *
  * @return \TYPO3\Flow\Mvc\View\ViewInterface the resolved view
  */
 public function resolveView()
 {
     $view = parent::resolveView();
     if (!$view->canRender($this->controllerContext) && $this->request->getFormat() === 'html') {
         $templateFileName = \TYPO3\Flow\Utility\Files::concatenatePaths(array($this->packageManager->getPackage('TYPO3.Ice')->getPackagePath(), 'Resources', 'Private', 'Templates', 'Standard', 'Index.html'));
         // Fallback to TYPO3.Ice template if file exists
         if (file_exists($templateFileName)) {
             $view->setTemplatePathAndFilename($templateFileName);
         }
     }
     return $view;
 }
コード例 #5
0
 /**
  * Executes this task
  *
  * @param \TYPO3\Surf\Domain\Model\Node $node
  * @param \TYPO3\Surf\Domain\Model\Application $application
  * @param \TYPO3\Surf\Domain\Model\Deployment $deployment
  * @param array $options
  * @return void
  * @throws \TYPO3\Surf\Exception\TaskExecutionException
  */
 public function execute(Node $node, Application $application, Deployment $deployment, array $options = array())
 {
     $this->hosting = $application->getOption('hosting');
     $this->username = $options['username'];
     $this->hostname = $node->getHostname();
     $this->deployment = $deployment;
     $this->resourcePath = $this->packageManager->getPackage('Famelo.Surf.SharedHosting')->getResourcesPath() . 'Private/' . $this->hosting;
     $this->temporaryPath = FLOW_PATH_ROOT . '/Data/Temporary/Deployment/' . $this->hosting;
     if (!is_dir($this->temporaryPath)) {
         \TYPO3\Flow\Utility\Files::createDirectoryRecursively($this->temporaryPath);
     }
 }
コード例 #6
0
 /**
  * Convert (and optionally filter) code coverage data generated by functional tests,
  * such that file references inside point not to the code cache inside Data/Temporary/....,
  * but to the Classes/ directory of the packages.
  *
  * <b>Example Usage:</b>
  * phpunit -c Build/BuildEssentials/FunctionalTests.xml --coverage-php Build/Reports/RawFunctionalTestCoverageReport.php
  * ./flow codeCoverage:convert Build/Reports/RawFunctionalTestCoverageReport.php Build/Reports/FunctionalTestCoverageReport.php --packages 'Your.Packages,Separated.By.Comma'
  *
  * The "--packages" argument is optional; but using it results in a huge speed boost;
  * as only the classes from the specified packages are included in the coverage result.
  *
  * @param string $codeCoverageFile Path to the code coverage file generated with "--coverage-php" of phpunit.
  * @param string $outFile Path to the converted code coverage file
  * @param string $packages The comma-separated list of packages to filter for. These packages must be installed here.
  * @param string $context The Flow context which has been used during the functional test run. Only needs to be modified if tests are ran in a special context.
  */
 public function convertCommand($codeCoverageFile, $outFile, $packages = '*', $context = 'Testing')
 {
     // Load $packages which should be taken into account while conversion
     $packageKeys = $packages;
     if ($packageKeys === '*') {
         $packages = $this->packageManager->getActivePackages();
     } else {
         $packages = array();
         foreach (\TYPO3\Flow\Utility\Arrays::trimExplode(',', $packageKeys) as $packageKey) {
             $packages[] = $this->packageManager->getPackage($packageKey);
         }
     }
     // For all $packages which should be used, build up a "cache-file-name" -> "real-file-name" mapping.
     $reverseIndexOfCacheFileNamesToClassFiles = array();
     foreach ($packages as $package) {
         /* @var $package \TYPO3\Flow\Package\PackageInterface */
         foreach ($package->getClassFiles() as $className => $fileName) {
             $cacheFileName = str_replace('\\', '_', $className);
             $reverseIndexOfCacheFileNamesToClassFiles[$cacheFileName] = $package->getPackagePath() . $fileName;
         }
     }
     // Modify the coverage report
     /* @var $coverage \Php_CodeCoverage */
     $coverage = unserialize(file_get_contents($codeCoverageFile));
     $coverageData = $coverage->getData();
     $baseDirectoryLength = strlen(FLOW_PATH_ROOT . 'Data/Temporary/' . $context . '/Cache/Code/Flow_Object_Classes/');
     $adjustedCoverageData = array();
     foreach ($coverageData as $fullCacheFileName => $coverageDataForFile) {
         $shortCacheFileName = substr($fullCacheFileName, $baseDirectoryLength, -4);
         if (isset($reverseIndexOfCacheFileNamesToClassFiles[$shortCacheFileName])) {
             $classFileInPackage = $reverseIndexOfCacheFileNamesToClassFiles[$shortCacheFileName];
             $numberOfLinesOfFile = count(file($classFileInPackage));
             if (isset($adjustedCoverageData[$classFileInPackage])) {
                 throw new \Sandstorm\Fuzzer\Exception('Coverage data already found for class file "' . $classFileInPackage . '". This should never happen; so we do not override it. It is probably a bug in Fuzzer.', 1367238729);
             }
             $adjustedCoverageData[$classFileInPackage] = array();
             foreach ($coverageDataForFile as $lineNumber => $coveredBy) {
                 if ($lineNumber <= $numberOfLinesOfFile) {
                     $adjustedCoverageData[$classFileInPackage][$lineNumber] = $coveredBy;
                 }
             }
         }
     }
     // Save the new coverage report
     $adjustedCoverage = new PhpunitCodeCoverage();
     $adjustedCoverage->setData($adjustedCoverageData);
     $adjustedCoverage->setTests($coverage->getTests());
     file_put_contents($outFile, serialize($adjustedCoverage));
 }
コード例 #7
0
 /**
  * Update global Piwik settings
  *
  * @param array $piwik
  * @return void
  */
 public function updateAction(array $piwik)
 {
     $configurationPath = $this->packageManager->getPackage('Portachtzig.Neos.Piwik')->getConfigurationPath();
     $settings = $this->configurationSource->load($configurationPath . ConfigurationManager::CONFIGURATION_TYPE_SETTINGS);
     $piwik['host'] = preg_replace("(^https?://)", "", $piwik['host']);
     $settings = Arrays::setValueByPath($settings, 'Portachtzig.Neos.Piwik.host', $piwik['host']);
     $settings = Arrays::setValueByPath($settings, 'Portachtzig.Neos.Piwik.protocol', $piwik['protocol']);
     $settings = Arrays::setValueByPath($settings, 'Portachtzig.Neos.Piwik.token_auth', $piwik['token_auth']);
     if (array_key_exists('idSite', $piwik)) {
         $settings = Arrays::setValueByPath($settings, 'Portachtzig.Neos.Piwik.idSite', $piwik['idSite']);
     }
     $this->configurationSource->save($configurationPath . ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $settings);
     $this->configurationManager->flushConfigurationCache();
     $this->redirect('index');
 }
コード例 #8
0
 /**
  * Index action
  *
  * @return void
  */
 public function indexAction()
 {
     $this->view->assign('flowPathRoot', realpath(FLOW_PATH_ROOT));
     $this->view->assign('flowPathWeb', realpath(FLOW_PATH_WEB));
     $this->view->assign('isMyPackageActive', $this->packageManager->isPackageActive('MyCompany.MyPackage'));
     $baseUri = $this->request->getHttpRequest()->getBaseUri();
     $this->view->assign('baseUri', $baseUri);
     $this->view->assign('isWindows', DIRECTORY_SEPARATOR !== '/');
     $flowPackage = $this->packageManager->getPackage('TYPO3.Flow');
     $version = $flowPackage->getPackageMetaData()->getVersion();
     $this->view->assign('version', $version);
     $activePackages = $this->packageManager->getActivePackages();
     $this->view->assign('activePackages', $activePackages);
     $this->view->assign('notDevelopmentContext', !$this->objectManager->getContext()->isDevelopment());
 }
コード例 #9
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\Flow\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 (preg_match('/^[0-9a-f]{40}$/i', $uriParts['host']) === 1) {
         $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\Flow\Resource\Exception(sprintf('Invalid resource URI "%s": Package "%s" is not available.', $requestedPath, $uriParts['host']), 1309269952);
     }
     $package = $this->packageManager->getPackage($uriParts['host']);
     $resourcePath = \TYPO3\Flow\Utility\Files::concatenatePaths(array($package->getResourcesPath(), $uriParts['path']));
     if ($checkForExistence === FALSE || file_exists($resourcePath)) {
         return $resourcePath;
     }
     return FALSE;
 }
コード例 #10
0
 /**
  * Generate additional folders for site packages.
  *
  * @param string $packageKey
  * @throws \TYPO3\Flow\Utility\Exception
  */
 protected function generateAdditionalFolders($packageKey)
 {
     $resourcesPath = $this->packageManager->getPackage($packageKey)->getResourcesPath();
     $publicResourcesPath = Files::concatenatePaths(array($resourcesPath, 'Public'));
     foreach (array('Images', 'JavaScript', 'Styles') as $publicResourceFolder) {
         Files::createDirectoryRecursively(Files::concatenatePaths(array($publicResourcesPath, $publicResourceFolder)));
     }
 }
コード例 #11
0
 /**
  * Gets the directory for package where .SQL file will be stored
  * 
  * @param string    $packageKey
  * @param bool      $createDirectoryStructure
  * @return string
  * @throws \TYPO3\Flow\Utility\Exception
  */
 protected function getContentDirectoryForPackageKey($packageKey, $createDirectoryStructure = FALSE)
 {
     $resourcesPath = $this->packageManager->getPackage($packageKey)->getResourcesPath();
     $dir = Files::concatenatePaths(array($resourcesPath, 'Private/Content/'));
     if ($createDirectoryStructure) {
         Files::createDirectoryRecursively($dir);
     }
     return Files::getNormalizedPath($dir);
 }
コード例 #12
0
 /**
  * A edit view for a site and its settings.
  *
  * @param Site $site Site to view
  * @Flow\IgnoreValidation("$site")
  * @return void
  */
 public function editAction(Site $site)
 {
     try {
         $sitePackage = $this->packageManager->getPackage($site->getSiteResourcesPackageKey());
     } catch (\Exception $e) {
         $this->addFlashMessage('The site package with key "%s" was not found.', 'Site package not found', Message::SEVERITY_ERROR, array(htmlspecialchars($site->getSiteResourcesPackageKey())));
     }
     $this->view->assignMultiple(array('site' => $site, 'sitePackageMetaData' => isset($sitePackage) ? $sitePackage->getPackageMetaData() : array(), 'domains' => $this->domainRepository->findBySite($site), 'assetCollections' => $this->assetCollectionRepository->findAll()));
 }
コード例 #13
0
 private function getNamespaceBaseDirectory($packageKey)
 {
     $package = $this->packageManager->getPackage($packageKey);
     if ($package->getAutoloadType() === Package::AUTOLOADER_TYPE_PSR4) {
         // WORKAROUND to support PSR4 properly
         return Files::getNormalizedPath($package->getClassesPath());
     } else {
         return $package->getClassesNamespaceEntryPath();
     }
 }
コード例 #14
0
 /**
  * @return void
  */
 protected function displayHelpIndex()
 {
     $context = $this->bootstrap->getContext();
     $this->outputLine('<b>TYPO3 Flow %s ("%s" context)</b>', array($this->packageManager->getPackage('TYPO3.Flow')->getPackageMetaData()->getVersion() ?: FLOW_VERSION_BRANCH, $context));
     $this->outputLine('<i>usage: %s <command identifier></i>', array($this->getFlowInvocationString()));
     $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->getFlowInvocationString()));
     $this->outputLine();
 }
コード例 #15
0
 /**
  * @return void
  */
 protected function displayHelpIndex()
 {
     $context = $this->bootstrap->getContext();
     $applicationPackage = $this->packageManager->getPackage($this->applicationPackageKey);
     $this->outputLine('<b>%s %s ("%s" context)</b>', array($applicationPackage->getComposerManifest('description'), $applicationPackage->getInstalledVersion() ?: 'dev', $context));
     $this->outputLine('<i>usage: %s <command identifier></i>', array($this->getFlowInvocationString()));
     $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->getFlowInvocationString()));
     $this->outputLine();
 }
 /**
  * @param string $driver
  * @return array Not supported image format
  */
 protected function findUnsupportedImageFormats($driver)
 {
     $this->imagineFactory->injectSettings(array('driver' => ucfirst($driver)));
     $imagine = $this->imagineFactory->create();
     $unsupportedFormats = array();
     foreach (array('jpg', 'gif', 'png') as $imageFormat) {
         $imagePath = Files::concatenatePaths(array($this->packageManager->getPackage('TYPO3.Neos')->getResourcesPath(), 'Private/Installer/TestImages/Test.' . $imageFormat));
         try {
             $imagine->open($imagePath);
         } catch (\Exception $exception) {
             $unsupportedFormats[] = sprintf('"%s"', $imageFormat);
         }
     }
     return $unsupportedFormats;
 }
コード例 #17
0
 /**
  * Generate a repository for a model given a model name and package key
  *
  * @param string $packageKey The package key
  * @param string $modelName The name of the model
  * @return array An array of generated filenames
  * @param boolean $overwrite Overwrite any existing files?
  */
 public function generateRepository($packageKey, $modelName, $overwrite = FALSE)
 {
     $modelName = ucfirst($modelName);
     $repositoryClassName = $modelName . 'Repository';
     $namespace = str_replace('.', '\\', $packageKey) . '\\Domain\\Repository';
     $templatePathAndFilename = 'resource://TYPO3.Kickstart/Private/Generator/Repository/RepositoryTemplate.php.tmpl';
     $contextVariables = array();
     $contextVariables['packageKey'] = $packageKey;
     $contextVariables['modelName'] = $modelName;
     $contextVariables['repositoryClassName'] = $repositoryClassName;
     $contextVariables['namespace'] = $namespace;
     $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
     $repositoryFilename = $repositoryClassName . '.php';
     $repositoryPath = $this->packageManager->getPackage($packageKey)->getClassesNamespaceEntryPath() . 'Domain/Repository/';
     $targetPathAndFilename = $repositoryPath . $repositoryFilename;
     $this->generateFile($targetPathAndFilename, $fileContent, $overwrite);
     return $this->generatedFiles;
 }
コード例 #18
0
ファイル: CasManager.php プロジェクト: rafaelka/jasigphpcas
 /**
  * @todo Provide persisted resources
  *
  * @param string $resource   'resource://'
  * @param bool   $fileExists <b>&$fileExists</b> if set then checks file existency and sets given variable accordingly result of check.
  *
  * @return string
  */
 private function resolveResoursceToRealpath($resource, &$fileExists = null)
 {
     $uriParts = parse_url($resource);
     if (!is_array($uriParts) || !isset($uriParts['scheme']) || $uriParts['scheme'] !== 'resource' || !isset($uriParts['path'])) {
         return false;
     }
     $isOnPackage = isset($uriParts['host']);
     if ($isOnPackage) {
         $package = $this->packageManager->getPackage($uriParts['host']);
         $filename = \TYPO3\Flow\Utility\Files::concatenatePaths([$package->getResourcesPath(), $uriParts['path']]);
     } else {
         // will not work
         return;
         $filename = \TYPO3\Flow\Utility\Files::concatenatePaths([FLOW_PATH_DATA, 'Persistent/Resources' . $uriParts['path']]);
     }
     $filename = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $filename);
     $fileExists = file_exists($filename);
     return $filename;
 }
コード例 #19
0
 /**
  * Test the quality of your tests by injecting random errors into your source code
  *
  * You at least need to specify the $packageKey which should be fuzzed.
  *
  * Optionally, specify <b>classFileRegex</b> to only mutate parts of all class files.
  *
  * Optionally, if only unit or functional tests should be ran, this can be specified using <b>testType</b>
  *
  * @param string $packageKey The package key
  * @param string $classFileRegex
  * @param string $testType either <b>Unit</b> or <b>Functional</b>. If not specified, executed both.
  * @param string $testPath
  * @return void
  */
 public function fuzzCommand($packageKey, $classFileRegex = NULL, $testType = 'BOTH', $testPath = NULL)
 {
     switch ($testType) {
         case 'Unit':
             $this->runUnitTests = TRUE;
             break;
         case 'Functional':
             $this->runFunctionalTests = TRUE;
             break;
         case 'BOTH':
             $this->runUnitTests = TRUE;
             $this->runFunctionalTests = TRUE;
             break;
         default:
             $this->outputFormatted('You specified an <b>invalid testType</b> ("%s"), only <b>Unit</b> or <b>Functional</b> allowed.', array($testType));
             $this->quit(1);
     }
     $package = $this->packageManager->getPackage($packageKey);
     $this->checkPrerequisites($package);
     $this->fuzz($package, $classFileRegex, $testPath);
 }
コード例 #20
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 \InvalidArgumentException|Exception
  */
 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 = Functions::parse_url($requestedPath);
     if (!is_array($uriParts) || !isset($uriParts['host'])) {
         return false;
     }
     if (preg_match('/^[0-9a-f]{40}$/i', $uriParts['host']) === 1) {
         $resource = $this->resourceManager->getResourceBySha1($uriParts['host']);
         return $this->resourceManager->getStreamByResource($resource);
     }
     if (!$this->packageManager->isPackageAvailable($uriParts['host'])) {
         throw new Exception(sprintf('Invalid resource URI "%s": Package "%s" is not available.', $requestedPath, $uriParts['host']), 1309269952);
     }
     $package = $this->packageManager->getPackage($uriParts['host']);
     $resourceUri = Files::concatenatePaths(array($package->getResourcesPath(), $uriParts['path']));
     if ($checkForExistence === false || file_exists($resourceUri)) {
         return $resourceUri;
     }
     return false;
 }
コード例 #21
0
 /**
  * Generate a documentation skeleton for the package key
  *
  * @param string $packageKey The package key
  * @return array An array of generated filenames
  */
 public function generateDocumentation($packageKey)
 {
     $contextVariables = array();
     $contextVariables['packageKey'] = $packageKey;
     $templatePathAndFilename = 'resource://TYPO3.Kickstart/Private/Generator/Documentation/conf.py';
     $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
     $targetPathAndFilename = $this->packageManager->getPackage($packageKey)->getDocumentationPath() . 'conf.py';
     $this->generateFile($targetPathAndFilename, $fileContent);
     $templatePathAndFilename = 'resource://TYPO3.Kickstart/Private/Generator/Documentation/Makefile';
     $fileContent = file_get_contents($templatePathAndFilename);
     $targetPathAndFilename = $this->packageManager->getPackage($packageKey)->getDocumentationPath() . 'Makefile';
     $this->generateFile($targetPathAndFilename, $fileContent);
     $templatePathAndFilename = 'resource://TYPO3.Kickstart/Private/Generator/Documentation/index.rst';
     $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
     $targetPathAndFilename = $this->packageManager->getPackage($packageKey)->getDocumentationPath() . 'index.rst';
     $this->generateFile($targetPathAndFilename, $fileContent);
     $targetPathAndFilename = $this->packageManager->getPackage($packageKey)->getDocumentationPath() . '_build/.gitignore';
     $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10));
     $targetPathAndFilename = $this->packageManager->getPackage($packageKey)->getDocumentationPath() . '_static/.gitignore';
     $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10));
     $targetPathAndFilename = $this->packageManager->getPackage($packageKey)->getDocumentationPath() . '_templates/.gitignore';
     $this->generateFile($targetPathAndFilename, '*' . chr(10) . '!.gitignore' . chr(10));
     return $this->generatedFiles;
 }
コード例 #22
0
 /**
  * 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)
 {
     if (!$this->initialized) {
         $this->initialize();
     }
     $package = $this->packageManager->getPackage($packageKey);
     $packageNamespace = $package->getNamespace() . '\\';
     $reflectionData = ['classReflectionData' => $this->classReflectionData, 'classSchemata' => $this->classSchemata, 'annotatedClasses' => $this->annotatedClasses, 'classesByMethodAnnotations' => $this->classesByMethodAnnotations];
     $reflectionData['classReflectionData'] = $this->filterArrayByClassesInNamespace($reflectionData['classReflectionData'], $packageNamespace);
     $reflectionData['classSchemata'] = $this->filterArrayByClassesInNamespace($reflectionData['classSchemata'], $packageNamespace);
     $reflectionData['annotatedClasses'] = $this->filterArrayByClassesInNamespace($reflectionData['annotatedClasses'], $packageNamespace);
     $reflectionData['classesByMethodAnnotations'] = isset($reflectionData['classesByMethodAnnotations']) ? $reflectionData['classesByMethodAnnotations'] : [];
     $methodAnnotationsFilters = function ($className) use($packageNamespace) {
         return strpos($className, $packageNamespace) === 0;
     };
     foreach ($reflectionData['classesByMethodAnnotations'] as $annotationClassName => $classNames) {
         $reflectionData['classesByMethodAnnotations'][$annotationClassName] = array_filter($classNames, $methodAnnotationsFilters);
     }
     $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));
 }
コード例 #23
0
 /**
  * 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)
 {
     if (!$this->initialized) {
         $this->initialize();
     }
     $package = $this->packageManager->getPackage($packageKey);
     $packageNamespace = $package->getNamespace() . '\\';
     $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));
 }
コード例 #24
0
 /**
  * Gets the full filesystem path to an Xliff file of a specified language within
  * a specific package.
  *
  * @param string $packageKey
  * @param string $language
  * @return string
  */
 protected function getFilePath($packageKey, $language)
 {
     return $this->packageManager->getPackage($packageKey)->getPackagePath() . 'Resources/Private/Translations/' . $language . '/Main.xlf';
 }