/** * Setup * * @return void * @author Bastian Waidelich <*****@*****.**> */ public function setUp() { $this->unixStylePath = \F3\FLOW3\Utility\Files::getUnixStylePath(__DIR__); $this->unixStylePathAndFilename = \F3\FLOW3\Utility\Files::getUnixStylePath(__FILE__); \vfsStreamWrapper::register(); \vfsStreamWrapper::setRoot(new \vfsStreamDirectory('testDirectory')); }
/** * @test * @author Christopher Hlubek <*****@*****.**> */ public function getLanguagesScansFormatDirectoryAndReturnsLanguagesAsStrings() { $formatPath = \vfsStream::url('testDirectory') . '/'; \F3\FLOW3\Utility\Files::createDirectoryRecursively($formatPath . 'en'); $format = new \F3\FLOW3\Package\Documentation\Format('DocBook', $formatPath); $availableLanguages = $format->getAvailableLanguages(); $this->assertEquals(array('en'), $availableLanguages); }
/** * Generate the XSD file. * * @param string $baseNamespace * @param string $namespacePrefix * @return string HTML string * @author Sebastian Kurfürst <*****@*****.**> * @todo Still has to be finished */ public function generateXsdAction($baseNamespace, $namespacePrefix) { $xsdFileContents = $this->xsdGenerator->generateXSD($baseNamespace); $path = 'Resources/Fluid/XSD/'; if (!is_dir(FLOW3_PATH_WEB . $path)) { \F3\FLOW3\Utility\Files::createDirectoryRecursively(FLOW3_PATH_WEB . $path); } $filename = $path . str_replace('\\', '_', $baseNamespace) . '.xsd'; $fp = fopen(FLOW3_PATH_WEB . $filename, 'w'); fputs($fp, $xsdFileContents); fclose($fp); return $this->view->assign('xsdPath', $filename)->assign('namespaceUri', 'http://typo3.org/ns/fluid/' . str_replace('\\', '/', $baseNamespace))->assign('namespacePrefix', $namespacePrefix)->assign('view', $this->view)->render(); }
/** * @test * @author Christopher Hlubek <*****@*****.**> */ public function getDocumentationFormatsScansDocumentationDirectoryAndReturnsDocumentationFormatObjectsIndexedByFormatName() { $documentationPath = \vfsStream::url('testDirectory') . '/'; $mockPackage = $this->getMock('F3\\FLOW3\\Package\\PackageInterface'); \F3\FLOW3\Utility\Files::createDirectoryRecursively($documentationPath . 'DocBook/en'); $mockDocumentationFormat = $this->getMock('F3\\FLOW3\\Package\\Documentation\\Format', array('dummy'), array(), '', FALSE); $mockObjectFactory = $this->getMock('F3\\FLOW3\\Object\\ObjectFactoryInterface'); $mockObjectFactory->expects($this->once())->method('create')->with('F3\\FLOW3\\Package\\Documentation\\Format', 'DocBook', $documentationPath . 'DocBook/')->will($this->returnValue($mockDocumentationFormat)); $documentation = new \F3\FLOW3\Package\Documentation($mockPackage, 'Manual', $documentationPath); $documentation->injectObjectFactory($mockObjectFactory); $documentationFormats = $documentation->getDocumentationFormats(); $this->assertEquals(array('DocBook' => $mockDocumentationFormat), $documentationFormats); }
/** * Read the package metadata for the given package from the * Package.xml file contained in the package * * @param \F3\FLOW3\Package\PackageInterface $package The package to read metadata for * @return MetaData A package meta data instance with the data from the package's Package.xml file. * @author Christopher Hlubek <*****@*****.**> */ public function readPackageMetaData(\F3\FLOW3\Package\PackageInterface $package) { $packageInfoPath = $package->getMetaPath(); $meta = new \F3\FLOW3\Package\MetaData($package->getPackageKey()); $xml = simplexml_load_file(\F3\FLOW3\Utility\Files::concatenatePaths(array($packageInfoPath, 'Package.xml'))); if ($xml === FALSE) { $meta->setDescription('[Package.xml could not be read.]'); } else { $meta->setVersion((string) $xml->version); $meta->setTitle((string) $xml->title); $meta->setDescription((string) $xml->description); $this->readCategories($xml, $meta); $this->readParties($xml, $meta); $this->readConstraints($xml, $meta); } return $meta; }
/** * Scans all directories in the packages directories for available packages. * For each package a \F3\FLOW3\Package\ object is created and returned as * an array. * * @return void * @author Robert Lemke <*****@*****.**> */ protected function scanAvailablePackages() { $this->packages = array('FLOW3' => $this->objectFactory->create('F3\\FLOW3\\Package\\Package', 'FLOW3', FLOW3_PATH_FLOW3)); foreach (new \DirectoryIterator(FLOW3_PATH_PACKAGES) as $parentFileInfo) { $parentFilename = $parentFileInfo->getFilename(); if ($parentFilename[0] === '.' || !$parentFileInfo->isDir()) { continue; } foreach (new \DirectoryIterator($parentFileInfo->getPathname()) as $childFileInfo) { $childFilename = $childFileInfo->getFilename(); if ($childFilename[0] !== '.' && $childFilename !== 'FLOW3') { $packagePath = \F3\FLOW3\Utility\Files::getUnixStylePath($childFileInfo->getPathName()) . '/'; if (isset($this->packages[$childFilename])) { throw new \F3\FLOW3\Package\Exception\DuplicatePackageException('Detected a duplicate package, remove either "' . $this->packages[$childFilename]->getPackagePath() . '" or "' . $packagePath . '".', 1253716811); } $this->packages[$childFilename] = $this->objectFactory->create('F3\\FLOW3\\Package\\Package', $childFilename, $packagePath); } } } foreach (array_keys($this->packages) as $upperCamelCasedPackageKey) { $this->packageKeys[strtolower($upperCamelCasedPackageKey)] = $upperCamelCasedPackageKey; } }
/** * @test * @dataProvider pathsWithProtocol * @author Karsten Dambekalns <*****@*****.**> */ public function getUnixStylePathWorksForPathWithProtocol($path, $expected) { $this->assertEquals($expected, \F3\FLOW3\Utility\Files::getUnixStylePath($path)); }
/** * Retrieve information about a file. * * This method is called in response to all stat() related functions. * * $flags can hold one or more of the following values OR'd together: * STREAM_URL_STAT_LINK * For resources with the ability to link to other resource (such as an * HTTP Location: forward, or a filesystem symlink). This flag specified * that only information about the link itself should be returned, not * the resource pointed to by the link. This flag is set in response to * calls to lstat(), is_link(), or filetype(). * STREAM_URL_STAT_QUIET * If this flag is set, your wrapper should not raise any errors. If * this flag is not set, you are responsible for reporting errors using * the trigger_error() function during stating of the path. * * @param string $path The file path or URL to stat. Note that in the case of a URL, it must be a :// delimited URL. Other URL forms are not supported. * @param integer $flags Holds additional flags set by the streams API. * @return array Should return as many elements as stat() does. Unknown or unavailable values should be set to a rational value (usually 0). * @author Karsten Dambekalns <*****@*****.**> */ public function pathStat($path, $flags) { $this->checkScheme($path); $uri = $this->objectFactory->create('F3\\FLOW3\\Property\\DataType\\Uri', $path); $package = $this->packageManager->getPackage($uri->getHost()); $path = \F3\FLOW3\Utility\Files::concatenatePaths(array($package->getResourcesPath(), $uri->getPath())); if (file_exists($path)) { return stat($path); } else { return FALSE; } }
/** * Creates FLOW3's temporary directory - or at least asserts that it exists and is * writable. * * @param string $temporaryDirectoryBase Full path to the base for the temporary directory * @return string The full path to the temporary directory * @throws \F3\FLOW3\Utility\Exception if the temporary directory could not be created or is not writable * @author Robert Lemke <*****@*****.**> * @author Bastian Waidelich <*****@*****.**> */ protected function createTemporaryDirectory($temporaryDirectoryBase) { $temporaryDirectoryBase = \F3\FLOW3\Utility\Files::getUnixStylePath($temporaryDirectoryBase); if (substr($temporaryDirectoryBase, -1, 1) !== '/') { $temporaryDirectoryBase .= '/'; } $maximumPathLength = $this->getMaximumPathLength(); if (strlen($temporaryDirectoryBase) > $maximumPathLength - 230) { $this->systemLogger->log('The path to your temporary directory is ' . strlen($temporaryDirectoryBase) . ' characters long. The maximum path length of your system is only ' . $maximumPathLength . '. Please consider setting the temporaryDirectoryBase option to a shorter path.', LOG_WARNING); } $processUser = extension_loaded('posix') ? posix_getpwuid(posix_geteuid()) : array('name' => 'default'); $pathHash = substr(md5(FLOW3_PATH_WEB . $this->getSAPIName() . $processUser['name'] . $this->context), 0, 12); $temporaryDirectory = $temporaryDirectoryBase . $pathHash . '/'; if (!is_dir($temporaryDirectory)) { try { \F3\FLOW3\Utility\Files::createDirectoryRecursively($temporaryDirectory); } catch (\F3\FLOW3\Error\Exception $exception) { } } if (!is_writable($temporaryDirectory)) { throw new \F3\FLOW3\Utility\Exception('The temporary directory "' . $temporaryDirectory . '" could not be created or is not writable for the current user "' . $processUser['name'] . '". Please make this directory writable or define another temporary directory by setting the respective system environment variable (eg. TMPDIR) or defining it in the FLOW3 settings.', 1216287176); } return $temporaryDirectory; }
/** * Carries out all actions necessary to prepare the logging backend, such as opening * the log file or opening a database connection. * * @return void * @author Robert Lemke <*****@*****.**> * @api */ public function open() { $this->severityLabels = array(LOG_EMERG => 'EMERGENCY', LOG_ALERT => 'ALERT ', LOG_CRIT => 'CRITICAL ', LOG_ERR => 'ERROR ', LOG_WARNING => 'WARNING ', LOG_NOTICE => 'NOTICE ', LOG_INFO => 'INFO ', LOG_DEBUG => 'DEBUG '); if (file_exists($this->logFileUrl) && $this->maximumLogFileSize > 0 && filesize($this->logFileUrl) > $this->maximumLogFileSize) { $this->rotateLogFile(); } if (file_exists($this->logFileUrl)) { $this->fileHandle = fopen($this->logFileUrl, 'at'); } else { $logPath = dirname($this->logFileUrl); if (!is_dir($logPath)) { if ($this->createParentDirectories === FALSE) { throw new \F3\FLOW3\Log\Exception\CouldNotOpenResourceException('Could not open log file "' . $this->logFileUrl . '" for write access because the parent directory does not exist.', 1243931200); } \F3\FLOW3\Utility\Files::createDirectoryRecursively($logPath); } $this->fileHandle = fopen($this->logFileUrl, 'at'); if ($this->fileHandle === FALSE) { throw new \F3\FLOW3\Log\Exception\CouldNotOpenResourceException('Could not open log file "' . $this->logFileUrl . '" for write access.', 1243588980); } $streamMeta = stream_get_meta_data($this->fileHandle); if ($streamMeta['wrapper_type'] === 'plainfile') { fclose($this->fileHandle); chmod($this->logFileUrl, 0666); $this->fileHandle = fopen($this->logFileUrl, 'at'); } } if ($this->fileHandle === FALSE) { throw new \F3\FLOW3\Log\Exception\CouldNotOpenResourceException('Could not open log file "' . $this->logFileUrl . '" for write access.', 1229448440); } }
/** * @test * @author Robert Lemke <*****@*****.**> */ public function publishStaticResourcesDoesNotMirrorAFileIfItAlreadyExistsAndTheModificationTimeIsEqualOrNewer() { mkdir('vfs://Foo/Sources'); file_put_contents('vfs://Foo/Sources/file1.txt', 1); file_put_contents('vfs://Foo/Sources/file2.txt', 1); file_put_contents('vfs://Foo/Sources/file3.txt', 1); \F3\FLOW3\Utility\Files::createDirectoryRecursively('vfs://Foo/Web/_Resources/Static/Bar'); file_put_contents('vfs://Foo/Web/_Resources/Static/Bar/file2.txt', 1); \vfsStreamWrapper::getRoot()->getChild('Web/_Resources/Static/Bar/file2.txt')->setFilemtime(time() - 5); file_put_contents('vfs://Foo/Web/_Resources/Static/Bar/file3.txt', 1); $mirrorFileCallback = function ($sourcePathAndFilename, $targetPathAndFilename) { if ($sourcePathAndFilename === 'vfs://Foo/Sources/file3.txt') { throw new \Exception('file3.txt should not have been mirrored.'); } }; $publishingTarget = $this->getMock($this->buildAccessibleProxy('\\F3\\FLOW3\\Resource\\Publishing\\FileSystemPublishingTarget'), array('mirrorFile')); $publishingTarget->_set('resourcesPublishingPath', 'vfs://Foo/Web/_Resources/'); $publishingTarget->expects($this->exactly(2))->method('mirrorFile')->will($this->returnCallback($mirrorFileCallback)); $result = $publishingTarget->publishStaticResources('vfs://Foo/Sources', 'Bar'); $this->assertTrue($result); }
/** * Main function - runs the tests and outputs HTML code * * @return void * @author Robert Lemke <*****@*****.**> * @author Karsten Dambekalns <*****@*****.**> * @internal Preliminary solution - there surely will be nicer ways to implement a test runner */ public function run() { $this->renderPageHeader(); $this->renderTestForm(); if (!empty($this->packageKey)) { $testcaseFileNamesAndPaths = $this->getTestcaseFilenames(); if (count($testcaseFileNamesAndPaths) > 0) { $this->renderInfoAndProgressbar(); $this->requireTestCaseFiles($testcaseFileNamesAndPaths); $testListener = new \F3\Testing\TestListener(); $testListener->baseUri = $this->request->getBaseUri(); $testResult = new \PHPUnit_Framework_TestResult(); $testResult->addListener($testListener); $testResult->collectCodeCoverageInformation($this->collectCodeCoverage); $startTime = microtime(TRUE); foreach (get_declared_classes() as $className) { if (substr($className, -4, 4) == 'Test') { $class = new \ReflectionClass($className); if ($class->isSubclassOf('PHPUnit_Framework_TestCase') && substr($className, 0, 8) !== 'PHPUnit_') { $testSuite = new \PHPUnit_Framework_TestSuite($class); $testSuite->run($testResult); } } } $endTime = microtime(TRUE); // Display test statistics: if ($testResult->wasSuccessful()) { echo '<script type="text/javascript">document.getElementById("progress-bar").style.backgroundColor = "green";document.getElementById("progress-bar").style.backgroundImage = "none";</script> <h1 class="success">SUCCESS</h1> ' . $testResult->count() . ' tests, ' . $testResult->failureCount() . ' failures, ' . $testResult->errorCount() . ' errors. </h1>'; } else { echo ' <script>document.getElementById("progress-bar").style.backgroundColor = "red";document.getElementById("progress-bar").style.backgroundImage = "none";</script> <h1 class="failure">FAILURE</h1> ' . $testResult->count() . ' tests, ' . $testResult->failureCount() . ' failures, ' . $testResult->errorCount() . ' errors. '; } echo '<p>Peak memory usage was: ~' . floor(memory_get_peak_usage() / 1024 / 1024) . ' MByte.<br />'; echo 'Test run took ' . round($endTime - $startTime, 4) . ' seconds.</p>'; if ($this->collectCodeCoverage === TRUE) { \F3\FLOW3\Utility\Files::emptyDirectoryRecursively($this->coverageOutputPath); \PHPUnit_Util_Report::render($testResult, $this->coverageOutputPath); echo '<a href="_Resources/CodeCoverageReport/index.html">See code coverage report...</a>'; } } else { echo '<p>No testcase found. Did you specify the intended pattern?</p>'; } } $this->renderPageFooter(); }
/** * Removes all cache entries of this cache. * * @return void * @author Robert Lemke <*****@*****.**> * @api */ public function flush() { \F3\FLOW3\Utility\Files::emptyDirectoryRecursively($this->cacheDirectory); $this->systemLogger->log(sprintf('Cache %s: flushed all entries.', $this->cacheIdentifier), LOG_INFO); }
/** * FIXME do we test something like this? * @test * @author Christopher Hlubek <*****@*****.**> */ public function getLocalPackagesPathReturnsPathToLocalPackagesDirectory() { $this->markTestSkipped('needs proper rework using vfs'); $packagesPath = $this->packageManager->getLocalPackagesPath(); $this->assertEquals(\F3\FLOW3\Utility\Files::getUnixStylePath(realpath(FLOW3_PATH_PACKAGES . '../Packages/Application/') . '/'), $packagesPath); }
/** * Starts the session, if is has not been already started * * @return void * @author Andreas Förthner <*****@*****.**> */ public function start() { if ($this->started === FALSE) { if (empty($this->settings['PHPSession']['savePath'])) { $sessionsPath = \F3\FLOW3\Utility\Files::concatenatePaths(array($this->environment->getPathToTemporaryDirectory(), 'Sessions')); } else { $sessionsPath = $this->settings['PHPSession']['savePath']; } if (!file_exists($sessionsPath)) { mkdir($sessionsPath); } session_save_path($sessionsPath); session_start(); $this->sessionId = session_id(); $this->started = TRUE; } }
/** * Converts the given string or array to a Resource object. * * If the input format is an array, this method assumes the resource to be a * fresh file upload and imports the temporary upload file through the * resource manager. * * @param array $source The upload info (expected keys: error, name, tmp_name) * @return object An object or an instance of F3\FLOW3\Error\Error if the input format is not supported or could not be converted for other reasons * @author Robert Lemke <*****@*****.**> * @author Karsten Dambekalns <*****@*****.**> */ public function convertFrom($source) { if (is_array($source)) { if ($source['error'] === \UPLOAD_ERR_NO_FILE) { return NULL; } if ($source['error'] !== \UPLOAD_ERR_OK) { return $this->objectFactory->create('F3\\FLOW3\\Error\\Error', \F3\FLOW3\Utility\Files::getUploadErrorMessage($source['error']), 1264440823); } $resource = $this->resourceManager->importUploadedResource($source); if ($resource === FALSE) { return $this->objectFactory->create('F3\\FLOW3\\Error\\Error', 'The resource manager could not create a resource instance.', 1264517906); } else { return $resource; } } else { return $this->objectFactory->create('F3\\FLOW3\\Error\\Error', 'The source for conversion to a resource object was not an array.', 1264440811); } }
/** * Depending on the settings of this publishing target copies the specified file * or creates a symbolic link. * * @param string $sourcePathAndFilename * @param string $targetPathAndFilename * @return void * @author Robert Lemke <*****@*****.**> * @author Karsten Dambekalns <*****@*****.**> */ protected function mirrorFile($sourcePathAndFilename, $targetPathAndFilename, $createDirectoriesIfNecessary) { if ($createDirectoriesIfNecessary === TRUE) { \F3\FLOW3\Utility\Files::createDirectoryRecursively(dirname($targetPathAndFilename)); } switch ($this->settings['resource']['publishing']['fileSystem']['mirrorMode']) { case 'copy': copy($sourcePathAndFilename, $targetPathAndFilename); touch($targetPathAndFilename, filemtime($sourcePathAndFilename)); break; case 'link': if (file_exists($targetPathAndFilename)) { if (is_link($targetPathAndFilename) && readlink($targetPathAndFilename) === $sourcePathAndFilename) { break; } unlink($targetPathAndFilename); symlink($sourcePathAndFilename, $targetPathAndFilename); } else { symlink($sourcePathAndFilename, $targetPathAndFilename); } break; default: throw new \F3\FLOW3\Resource\Exception('An invalid mirror mode (' . $this->settings['resource']['publishing']['fileSystem']['mirrorMode'] . ') has been configured.', 1256133400); } if (!file_exists($targetPathAndFilename)) { throw new \F3\FLOW3\Resource\Exception('The resource "' . str_replace($sourcePath, '', $sourcePathAndFilename) . '" could not be mirrored.', 1207255453); } }
/** * Render the given template file with the given variables * * @param string $templatePathAndFilename * @param array $contextVariables * @return string * @author Christopher Hlubek <*****@*****.**> */ protected function renderTemplate($templatePathAndFilename, $contextVariables) { $templateSource = \F3\FLOW3\Utility\Files::getFileContents($templatePathAndFilename, FILE_TEXT); if ($templateSource === FALSE) { throw new \F3\Fluid\Core\RuntimeException('The template file "' . $templatePathAndFilename . '" could not be loaded.', 1225709595); } $parsedTemplate = $this->templateParser->parse($templateSource); $renderingContext = $this->buildRenderingContext($contextVariables); return $parsedTemplate->render($renderingContext); }
if (!defined('FLOW3_PATH_ROOT')) { exit('FLOW3: No root path defined in environment variable FLOW3_ROOTPATH (Error #1248964376)' . PHP_EOL); } if (!isset($_SERVER['FLOW3_WEBPATH']) || !is_dir($_SERVER['FLOW3_WEBPATH'])) { exit('FLOW3: No web path defined in environment variable FLOW3_WEBPATH or directory does not exist (Error #1249046843)' . PHP_EOL); } define('FLOW3_PATH_WEB', \F3\FLOW3\Utility\Files::getUnixStylePath(realpath($_SERVER['FLOW3_WEBPATH'])) . '/'); define('FLOW3_PATH_CONFIGURATION', FLOW3_PATH_ROOT . 'Configuration/'); define('FLOW3_PATH_DATA', FLOW3_PATH_ROOT . 'Data/'); define('FLOW3_PATH_PACKAGES', FLOW3_PATH_ROOT . 'Packages/'); echo "\nFLOW3 1.0.0 alpha 7 class names migration script.\n\nThis script scans PHP, YAML and XML files of all installed packages for\noccurrences of class and interface names which have been changed for\nFLOW3 1.0.0 alpha 7 and replaces them by the new names.\n\n"; $classNameReplacementMap = array('F3\\FLOW3\\AOP\\Exception\\CircularPointcutReference' => 'F3\\FLOW3\\AOP\\Exception\\CircularPointcutReferenceException', 'F3\\FLOW3\\AOP\\Exception\\InvalidArgument' => 'F3\\FLOW3\\AOP\\Exception\\InvalidArgumentException', 'F3\\FLOW3\\AOP\\Exception\\InvalidConstructorSignature' => 'F3\\FLOW3\\AOP\\Exception\\InvalidConstructorSignatureException', 'F3\\FLOW3\\AOP\\Exception\\InvalidPointcutExpression' => 'F3\\FLOW3\\AOP\\Exception\\InvalidPointcutExpressionException', 'F3\\FLOW3\\AOP\\Exception\\InvalidTargetClass' => 'F3\\FLOW3\\AOP\\Exception\\InvalidTargetClassException', 'F3\\FLOW3\\AOP\\Exception\\UnknowClass' => 'F3\\FLOW3\\AOP\\Exception\\UnknowClassException', 'F3\\FLOW3\\AOP\\Exception\\UnknownPointcut' => 'F3\\FLOW3\\AOP\\Exception\\UnknownPointcutException', 'F3\\FLOW3\\Cache\\Controller\\ManagerController' => 'F3\\FLOW3\\Cache\\Controller\\CacheManagerController', 'F3\\FLOW3\\Cache\\Exception\\ClassAlreadyLoaded' => 'F3\\FLOW3\\Cache\\Exception\\ClassAlreadyLoadedException', 'F3\\FLOW3\\Cache\\Exception\\DuplicateIdentifier' => 'F3\\FLOW3\\Cache\\Exception\\DuplicateIdentifierException', 'F3\\FLOW3\\Cache\\Exception\\InvalidBackend' => 'F3\\FLOW3\\Cache\\Exception\\InvalidBackendException', 'F3\\FLOW3\\Cache\\Exception\\InvalidCache' => 'F3\\FLOW3\\Cache\\Exception\\InvalidCacheException', 'F3\\FLOW3\\Cache\\Exception\\InvalidData' => 'F3\\FLOW3\\Cache\\Exception\\InvalidDataException', 'F3\\FLOW3\\Cache\\Exception\\NoSuchCache' => 'F3\\FLOW3\\Cache\\Exception\\NoSuchCacheException', 'F3\\FLOW3\\Cache\\Factory' => 'F3\\FLOW3\\Cache\\CacheFactory', 'F3\\FLOW3\\Cache\\Manager' => 'F3\\FLOW3\\Cache\\CacheManager', 'F3\\FLOW3\\Configuration\\Exception\\ContainerIsLocked' => 'F3\\FLOW3\\Configuration\\Exception\\ContainerIsLockedException', 'F3\\FLOW3\\Configuration\\Exception\\InvalidConfigurationType' => 'F3\\FLOW3\\Configuration\\Exception\\InvalidConfigurationTypeException', 'F3\\FLOW3\\Configuration\\Exception\\NoSuchFile' => 'F3\\FLOW3\\Configuration\\Exception\\NoSuchFileException', 'F3\\FLOW3\\Configuration\\Exception\\NoSuchOption' => 'F3\\FLOW3\\Configuration\\Exception\\NoSuchOptionException', 'F3\\FLOW3\\Configuration\\Exception\\ParseError' => 'F3\\FLOW3\\Configuration\\Exception\\ParseErrorException', 'F3\\FLOW3\\Configuration\\Source\\YAMLSource' => 'F3\\FLOW3\\Configuration\\Source\\YamlSource', 'F3\\FLOW3\\Configuration\\Manager' => 'F3\\FLOW3\\Configuration\\ConfigurationManager', 'F3\\FLOW3\\Locale\\Exception\\InvalidLocaleIdentifier' => 'F3\\FLOW3\\Locale\\Exception\\InvalidLocaleIdentifierException', 'F3\\FLOW3\\Log\\Exception\\CouldNotOpenResource' => 'F3\\FLOW3\\Log\\Exception\\CouldNotOpenResourceException', 'F3\\FLOW3\\Log\\Exception\\InvalidBackend' => 'F3\\FLOW3\\Log\\Exception\\InvalidBackendException', 'F3\\FLOW3\\Log\\Exception\\NoSuchBackend' => 'F3\\FLOW3\\Log\\Exception\\NoSuchBackendException', 'F3\\FLOW3\\MVC\\Controller\\ControllerContext' => 'F3\\FLOW3\\MVC\\Controller\\Context', 'F3\\FLOW3\\MVC\\Controller\\ControllerInterface' => 'F3\\FLOW3\\MVC\\Controller\\ControllerInterface', 'F3\\FLOW3\\MVC\\Controller\\Exception\\InactivePackage' => 'F3\\FLOW3\\MVC\\Controller\\Exception\\InactivePackageException', 'F3\\FLOW3\\MVC\\Controller\\Exception\\InvalidController' => 'F3\\FLOW3\\MVC\\Controller\\Exception\\InvalidControllerException', 'F3\\FLOW3\\MVC\\Controller\\Exception\\InvalidPackage' => 'F3\\FLOW3\\MVC\\Controller\\Exception\\InvalidPackageException', 'F3\\FLOW3\\MVC\\Exception\\InfiniteLoop' => 'F3\\FLOW3\\MVC\\Exception\\InfiniteLoopException', 'F3\\FLOW3\\MVC\\Exception\\InvalidActionName' => 'F3\\FLOW3\\MVC\\Exception\\InvalidActionNameException', 'F3\\FLOW3\\MVC\\Exception\\InvalidArgumentName' => 'F3\\FLOW3\\MVC\\Exception\\InvalidArgumentNameException', 'F3\\FLOW3\\MVC\\Exception\\InvalidArgumentType' => 'F3\\FLOW3\\MVC\\Exception\\InvalidArgumentTypeException', 'F3\\FLOW3\\MVC\\Exception\\InvalidArgumentValue' => 'F3\\FLOW3\\MVC\\Exception\\InvalidArgumentValueException', 'F3\\FLOW3\\MVC\\Exception\\InvalidController' => 'F3\\FLOW3\\MVC\\Exception\\InvalidControllerException', 'F3\\FLOW3\\MVC\\Exception\\InvalidControllerName' => 'F3\\FLOW3\\MVC\\Exception\\InvalidControllerNameException', 'F3\\FLOW3\\MVC\\Exception\\InvalidFormat' => 'F3\\FLOW3\\MVC\\Exception\\InvalidFormatException', 'F3\\FLOW3\\MVC\\Exception\\InvalidMarker' => 'F3\\FLOW3\\MVC\\Exception\\InvalidMarkerException', 'F3\\FLOW3\\MVC\\Exception\\InvalidOrMissingRequestHash' => 'F3\\FLOW3\\MVC\\Exception\\InvalidOrMissingRequestHashException', 'F3\\FLOW3\\MVC\\Exception\\InvalidPackageKey' => 'F3\\FLOW3\\MVC\\Exception\\InvalidPackageKeyException', 'F3\\FLOW3\\MVC\\Exception\\InvalidPart' => 'F3\\FLOW3\\MVC\\Exception\\InvalidPartException', 'F3\\FLOW3\\MVC\\Exception\\InvalidRequestMethod' => 'F3\\FLOW3\\MVC\\Exception\\InvalidRequestMethodException', 'F3\\FLOW3\\MVC\\Exception\\InvalidRequestType' => 'F3\\FLOW3\\MVC\\Exception\\InvalidRequestTypeException', 'F3\\FLOW3\\MVC\\Exception\\InvalidRoutePartHandler' => 'F3\\FLOW3\\MVC\\Exception\\InvalidRoutePartHandlerException', 'F3\\FLOW3\\MVC\\Exception\\InvalidTemplateResource' => 'F3\\FLOW3\\MVC\\Exception\\InvalidTemplateResourceException', 'F3\\FLOW3\\MVC\\Exception\\InvalidUriPattern' => 'F3\\FLOW3\\MVC\\Exception\\InvalidUriPatternException', 'F3\\FLOW3\\MVC\\Exception\\NoSuchAction' => 'F3\\FLOW3\\MVC\\Exception\\NoSuchActionException', 'F3\\FLOW3\\MVC\\Exception\\NoSuchArgument' => 'F3\\FLOW3\\MVC\\Exception\\NoSuchArgumentException', 'F3\\FLOW3\\MVC\\Exception\\NoSuchController' => 'F3\\FLOW3\\MVC\\Exception\\NoSuchControllerException', 'F3\\FLOW3\\MVC\\Exception\\StopAction' => 'F3\\FLOW3\\MVC\\Exception\\StopActionException', 'F3\\FLOW3\\MVC\\Exception\\UnsupportedRequestType' => 'F3\\FLOW3\\MVC\\Exception\\UnsupportedRequestTypeException', 'F3\\FLOW3\\Object\\Builder' => 'F3\\FLOW3\\Object\\ObjectBuilder', 'F3\\FLOW3\\Object\\Exception\\CannotBuildObject' => 'F3\\FLOW3\\Object\\Exception\\CannotBuildObjectException', 'F3\\FLOW3\\Object\\Exception\\CannotReconstituteObject' => 'F3\\FLOW3\\Object\\Exception\\CannotReconstituteObjectException', 'F3\\FLOW3\\Object\\Exception\\InvalidClass' => 'F3\\FLOW3\\Object\\Exception\\InvalidClassException', 'F3\\FLOW3\\Object\\Exception\\InvalidObject' => 'F3\\FLOW3\\Object\\Exception\\InvalidObjectException', 'F3\\FLOW3\\Object\\Exception\\InvalidObjectConfiguration' => 'F3\\FLOW3\\Object\\Exception\\InvalidObjectConfigurationException', 'F3\\FLOW3\\Object\\Exception\\InvalidObjectName' => 'F3\\FLOW3\\Object\\Exception\\InvalidObjectNameException', 'F3\\FLOW3\\Object\\Exception\\ObjectAlreadyRegistered' => 'F3\\FLOW3\\Object\\Exception\\ObjectAlreadyRegisteredException', 'F3\\FLOW3\\Object\\Exception\\UnknownClass' => 'F3\\FLOW3\\Object\\Exception\\UnknownClassException', 'F3\\FLOW3\\Object\\Exception\\UnknownInterface' => 'F3\\FLOW3\\Object\\Exception\\UnknownInterfaceException', 'F3\\FLOW3\\Object\\Exception\\UnknownObject' => 'F3\\FLOW3\\Object\\Exception\\UnknownObjectException', 'F3\\FLOW3\\Object\\Exception\\UnresolvedDependencies' => 'F3\\FLOW3\\Object\\Exception\\UnresolvedDependenciesException', 'F3\\FLOW3\\Object\\Exception\\WrongScope' => 'F3\\FLOW3\\Object\\Exception\\WrongScopeException', 'F3\\FLOW3\\Object\\Factory' => 'F3\\FLOW3\\Object\\ObjectFactory', 'F3\\FLOW3\\Object\\FactoryInterface' => 'F3\\FLOW3\\Object\\ObjectFactoryInterface', 'F3\\FLOW3\\Object\\Manager' => 'F3\\FLOW3\\Object\\ObjectManager', 'F3\\FLOW3\\Object\\ManagerInterface' => 'F3\\FLOW3\\Object\\ObjectManagerInterface', 'F3\\FLOW3\\Object\\RegistryInterface' => 'F3\\FLOW3\\Object\\RegistryInterface', 'F3\\FLOW3\\Object\\SessionRegistry' => 'F3\\FLOW3\\Object\\SessionRegistry', 'F3\\FLOW3\\Object\\TransientRegistry' => 'F3\\FLOW3\\Object\\TransientRegistry', 'F3\\FLOW3\\Package\\Controller\\ManagerController' => 'F3\\FLOW3\\Package\\Controller\\PackageManagerController', 'F3\\FLOW3\\Package\\Exception\\DuplicatePackage' => 'F3\\FLOW3\\Package\\Exception\\DuplicatePackageException', 'F3\\FLOW3\\Package\\Exception\\InvalidPackageKey' => 'F3\\FLOW3\\Package\\Exception\\InvalidPackageKeyException', 'F3\\FLOW3\\Package\\Exception\\InvalidPackagePath' => 'F3\\FLOW3\\Package\\Exception\\InvalidPackagePathException', 'F3\\FLOW3\\Package\\Exception\\InvalidPackageState' => 'F3\\FLOW3\\Package\\Exception\\InvalidPackageStateException', 'F3\\FLOW3\\Package\\Exception\\PackageKeyAlreadyExists' => 'F3\\FLOW3\\Package\\Exception\\PackageKeyAlreadyExistsException', 'F3\\FLOW3\\Package\\Exception\\ProtectedPackageKey' => 'F3\\FLOW3\\Package\\Exception\\ProtectedPackageKeyException', 'F3\\FLOW3\\Package\\Exception\\UnknownPackage' => 'F3\\FLOW3\\Package\\Exception\\UnknownPackageException', 'F3\\FLOW3\\Package\\Manager' => 'F3\\FLOW3\\Package\\PackageManager', 'F3\\FLOW3\\Package\\ManagerInterface' => 'F3\\FLOW3\\Package\\PackageManagerInterface', 'F3\\FLOW3\\Persistence\\Aspect\\DirtyMonitoring' => 'F3\\FLOW3\\Persistence\\Aspect\\DirtyMonitoringAspect', 'F3\\FLOW3\\Persistence\\Exception\\IllegalObjectType' => 'F3\\FLOW3\\Persistence\\Exception\\IllegalObjectTypeException', 'F3\\FLOW3\\Persistence\\Exception\\MissingBackend' => 'F3\\FLOW3\\Persistence\\Exception\\MissingBackendException', 'F3\\FLOW3\\Persistence\\Exception\\TooDirty' => 'F3\\FLOW3\\Persistence\\Exception\\TooDirtyException', 'F3\\FLOW3\\Persistence\\Exception\\UnexpectedType' => 'F3\\FLOW3\\Persistence\\Exception\\UnexpectedTypeException', 'F3\\FLOW3\\Persistence\\Exception\\UnknownObject' => 'F3\\FLOW3\\Persistence\\Exception\\UnknownObjectException', 'F3\\FLOW3\\Persistence\\Manager' => 'F3\\FLOW3\\Persistence\\PersistenceManager', 'F3\\FLOW3\\Persistence\\ManagerInterface' => 'F3\\FLOW3\\Persistence\\PersistenceManagerInterface', 'F3\\FLOW3\\Property\\Exception\\FormatNotSupported' => 'F3\\FLOW3\\Property\\Exception\\FormatNotSupportedException', 'F3\\FLOW3\\Property\\Exception\\InvalidDataType' => 'F3\\FLOW3\\Property\\Exception\\InvalidDataTypeException', 'F3\\FLOW3\\Property\\Exception\\InvalidFormat' => 'F3\\FLOW3\\Property\\Exception\\InvalidFormatException', 'F3\\FLOW3\\Property\\Exception\\InvalidProperty' => 'F3\\FLOW3\\Property\\Exception\\InvalidPropertyException', 'F3\\FLOW3\\Property\\Exception\\InvalidSource' => 'F3\\FLOW3\\Property\\Exception\\InvalidSourceException', 'F3\\FLOW3\\Property\\Exception\\InvalidTarget' => 'F3\\FLOW3\\Property\\Exception\\InvalidTargetException', 'F3\\FLOW3\\Property\\Exception\\TargetNotFound' => 'F3\\FLOW3\\Property\\Exception\\TargetNotFoundException', 'F3\\FLOW3\\Reflection\\Exception\\InvalidPropertyType' => 'F3\\FLOW3\\Reflection\\Exception\\InvalidPropertyTypeException', 'F3\\FLOW3\\Reflection\\Exception\\UnknownClass' => 'F3\\FLOW3\\Reflection\\Exception\\UnknownClassException', 'F3\\FLOW3\\Reflection\\Service' => 'F3\\FLOW3\\Reflection\\ReflectionService', 'F3\\FLOW3\\Security\\Authentication\\ManagerInterface' => 'F3\\FLOW3\\Security\\Authentication\\AuthenticationManagerInterface', 'F3\\FLOW3\\Security\\Authentication\\Provider\\UsernamePasswordCR' => 'F3\\FLOW3\\Security\\Authentication\\Provider\\PersistedUsernamePasswordProvider', 'F3\\FLOW3\\Security\\Authentication\\ProviderInterface' => 'F3\\FLOW3\\Security\\Authentication\\AuthenticationProviderInterface', 'F3\\FLOW3\\Security\\Authentication\\ProviderManager' => 'F3\\FLOW3\\Security\\Authentication\\AuthenticationProviderManager', 'F3\\FLOW3\\Security\\Authentication\\ProviderResolver' => 'F3\\FLOW3\\Security\\Authentication\\AuthenticationProviderResolver', 'F3\\FLOW3\\Security\\Authorization\\Voter\\ACL' => 'F3\\FLOW3\\Security\\Authorization\\Voter\\AclVoter', 'F3\\FLOW3\\Security\\Channel\\HTTPSInterceptor' => 'F3\\FLOW3\\Security\\Channel\\HttpsInterceptor', 'F3\\FLOW3\\Security\\Channel\\RequestHashService' => 'F3\\FLOW3\\Security\\Channel\\RequestHashService', 'F3\\FLOW3\\Security\\Cryptography\\OpenSSLRSAKey' => 'F3\\FLOW3\\Security\\Cryptography\\OpenSslRsaKey', 'F3\\FLOW3\\Security\\Cryptography\\RSAWalletServiceInterface' => 'F3\\FLOW3\\Security\\Cryptography\\RsaWalletServiceInterface', 'F3\\FLOW3\\Security\\Cryptography\\RSAWalletServicePHP' => 'F3\\FLOW3\\Security\\Cryptography\\RsaWalletServicePhp', 'F3\\FLOW3\\Security\\Exception\\AccessDenied' => 'F3\\FLOW3\\Security\\Exception\\AccessDeniedException', 'F3\\FLOW3\\Security\\Exception\\AuthenticationRequired' => 'F3\\FLOW3\\Security\\Exception\\AuthenticationRequiredException', 'F3\\FLOW3\\Security\\Exception\\CircularResourceDefinitionDetected' => 'F3\\FLOW3\\Security\\Exception\\CircularResourceDefinitionDetectedException', 'F3\\FLOW3\\Security\\Exception\\DecryptionNotAllowed' => 'F3\\FLOW3\\Security\\Exception\\DecryptionNotAllowedException', 'F3\\FLOW3\\Security\\Exception\\InvalidArgumentForHashGeneration' => 'F3\\FLOW3\\Security\\Exception\\InvalidArgumentForHashGenerationException', 'F3\\FLOW3\\Security\\Exception\\InvalidArgumentForRequestHashGeneration' => 'F3\\FLOW3\\Security\\Exception\\InvalidArgumentForRequestHashGenerationException', 'F3\\FLOW3\\Security\\Exception\\InvalidAuthenticationProvider' => 'F3\\FLOW3\\Security\\Exception\\InvalidAuthenticationProviderException', 'F3\\FLOW3\\Security\\Exception\\InvalidAuthenticationStatus' => 'F3\\FLOW3\\Security\\Exception\\InvalidAuthenticationStatusException', 'F3\\FLOW3\\Security\\Exception\\InvalidKeyPairID' => 'F3\\FLOW3\\Security\\Exception\\InvalidKeyPairIdException', 'F3\\FLOW3\\Security\\Exception\\MissingConfiguration' => 'F3\\FLOW3\\Security\\Exception\\MissingConfigurationException', 'F3\\FLOW3\\Security\\Exception\\NoAuthenticationProviderFound' => 'F3\\FLOW3\\Security\\Exception\\NoAuthenticationProviderFoundException', 'F3\\FLOW3\\Security\\Exception\\NoContextAvailable' => 'F3\\FLOW3\\Security\\Exception\\NoContextAvailableException', 'F3\\FLOW3\\Security\\Exception\\NoEntryInPolicy' => 'F3\\FLOW3\\Security\\Exception\\NoEntryInPolicyException', 'F3\\FLOW3\\Security\\Exception\\NoEntryPointFound' => 'F3\\FLOW3\\Security\\Exception\\NoEntryPointFoundException', 'F3\\FLOW3\\Security\\Exception\\NoInterceptorFound' => 'F3\\FLOW3\\Security\\Exception\\NoInterceptorFoundException', 'F3\\FLOW3\\Security\\Exception\\NoRequestPatternFound' => 'F3\\FLOW3\\Security\\Exception\\NoRequestPatternFoundException', 'F3\\FLOW3\\Security\\Exception\\OperationNotPermitted' => 'F3\\FLOW3\\Security\\Exception\\OperationNotPermittedException', 'F3\\FLOW3\\Security\\Exception\\RequestTypeNotSupported' => 'F3\\FLOW3\\Security\\Exception\\RequestTypeNotSupportedException', 'F3\\FLOW3\\Security\\Exception\\SyntacticallyWrongRequestHash' => 'F3\\FLOW3\\Security\\Exception\\SyntacticallyWrongRequestHashException', 'F3\\FLOW3\\Security\\Exception\\UnsupportedAuthenticationToken' => 'F3\\FLOW3\\Security\\Exception\\UnsupportedAuthenticationTokenException', 'F3\\FLOW3\\Security\\Exception\\VoterNotFound' => 'F3\\FLOW3\\Security\\Exception\\VoterNotFoundException', 'F3\\FLOW3\\Session\\Exception\\DataNotSerializeable' => 'F3\\FLOW3\\Session\\Exception\\DataNotSerializeableException', 'F3\\FLOW3\\Session\\Exception\\SessionAutostartIsEnabled' => 'F3\\FLOW3\\Session\\Exception\\SessionAutostartIsEnabledException', 'F3\\FLOW3\\Session\\Exception\\SessionNotStarted' => 'F3\\FLOW3\\Session\\Exception\\SessionNotStartedException', 'F3\\FLOW3\\Session\\PHPSession' => 'F3\\FLOW3\\Session\\PhpSession', 'F3\\FLOW3\\SignalSlot\\Exception\\InvalidSlot' => 'F3\\FLOW3\\SignalSlot\\Exception\\InvalidSlotException', 'F3\\FLOW3\\Validation\\Exception\\InvalidSubject' => 'F3\\FLOW3\\Validation\\Exception\\InvalidSubjectException', 'F3\\FLOW3\\Validation\\Exception\\InvalidValidationConfiguration' => 'F3\\FLOW3\\Validation\\Exception\\InvalidValidationConfigurationException', 'F3\\FLOW3\\Validation\\Exception\\InvalidValidationOptions' => 'F3\\FLOW3\\Validation\\Exception\\InvalidValidationOptionsException', 'F3\\FLOW3\\Validation\\Exception\\NoSuchFilter' => 'F3\\FLOW3\\Validation\\Exception\\NoSuchFilterException', 'F3\\FLOW3\\Validation\\Exception\\NoSuchValidator' => 'F3\\FLOW3\\Validation\\Exception\\NoSuchValidatorException', 'F3\\FLOW3\\Validation\\Validator\\UUIDValidator' => 'F3\\FLOW3\\Validation\\Validator\\UuidValidator', 'F3\\FLOW3\\Private\\AOP\\AOPProxyClassTemplate' => 'F3\\FLOW3\\Private\\AOP\\AopProxyClassTemplate', 'F3\\Fluid\\View\\Exception\\InvalidTemplateResource' => 'F3\\Fluid\\View\\Exception\\InvalidTemplateResourceException', 'F3\\Testing\\Controller\\CLIController' => 'F3\\Testing\\Controller\\CliController', 'F3\\TYPO3CR\\Storage\\Backend\\PDO' => 'F3\\TYPO3CR\\Storage\\Backend\\Pdo', 'F3\\TYPO3CR\\Storage\\Search\\PDO' => 'F3\\TYPO3CR\\Storage\\Search\\Pdo', 'F3\\YAML\\YAML' => 'F3\\YAML\\Yaml'); $phpFiles = \F3\FLOW3\Utility\Files::readDirectoryRecursively(FLOW3_PATH_PACKAGES, '.php', TRUE); $yamlFiles = \F3\FLOW3\Utility\Files::readDirectoryRecursively(FLOW3_PATH_PACKAGES, '.yaml', TRUE); $xmlFiles = \F3\FLOW3\Utility\Files::readDirectoryRecursively(FLOW3_PATH_PACKAGES, '.xml', TRUE); $configurationFiles = \F3\FLOW3\Utility\Files::readDirectoryRecursively(FLOW3_PATH_CONFIGURATION, '.yaml', TRUE); $allPathsAndFilenames = array_merge($phpFiles, $yamlFiles, $xmlFiles, $configurationFiles); foreach ($allPathsAndFilenames as $pathAndFilename) { $pathInfo = pathinfo($pathAndFilename); if (!isset($pathInfo['filename'])) { continue; } if (strpos($pathAndFilename, 'Packages/Framework/') !== FALSE) { continue; } if ($pathAndFilename === __FILE__) { continue; } $file = file_get_contents($pathAndFilename); $fileBackup = $file; foreach ($classNameReplacementMap as $oldClassName => $newClassName) {
/** * Detects changes of the files and directories to be monitored and emits signals * accordingly. * * @return void * @author Robert Lemke <*****@*****.**> * @api */ public function detectChanges() { $changedFiles = array(); $changedDirectories = array(); $changedFiles = $this->detectChangedFiles($this->monitoredFiles); foreach ($this->monitoredDirectories as $path) { if (!isset($this->directoriesAndFiles[$path])) { $this->directoriesAndFiles[$path] = \F3\FLOW3\Utility\Files::readDirectoryRecursively($path); $this->directoriesChanged = TRUE; $changedDirectories[$path] = \F3\FLOW3\Monitor\ChangeDetectionStrategy\ChangeDetectionStrategyInterface::STATUS_CREATED; } } foreach ($this->directoriesAndFiles as $path => $pathAndFilenames) { if (!is_dir($path)) { unset($this->directoriesAndFiles[$path]); $this->directoriesChanged = TRUE; $changedDirectories[$path] = \F3\FLOW3\Monitor\ChangeDetectionStrategy\ChangeDetectionStrategyInterface::STATUS_DELETED; } else { $currentSubDirectoriesAndFiles = \F3\FLOW3\Utility\Files::readDirectoryRecursively($path); if ($currentSubDirectoriesAndFiles != $pathAndFilenames) { $pathAndFilenames = array_unique(array_merge($currentSubDirectoriesAndFiles, $pathAndFilenames)); } $changedFiles = array_merge($changedFiles, $this->detectChangedFiles($pathAndFilenames)); } } if (count($changedFiles) > 0) { $this->emitFilesHaveChanged($this->identifier, $changedFiles); } if (count($changedDirectories) > 0) { $this->emitDirectoriesHaveChanged($this->identifier, $changedDirectories); } if (count($changedFiles) > 0 || count($changedDirectories) > 0) { $this->systemLogger->log(sprintf('File Monitor detected %s changed files and %s changed directories.', count($changedFiles), count($changedDirectories)), LOG_INFO); } }
/** * Processes @templateRoot, @subpackage, @controller, and @format placeholders inside $pattern. * This method is used to generate "fallback chains" for file system locations where a certain Partial can reside. * * If $bubbleControllerAndSubpackage is FALSE and $formatIsOptional is FALSE, then the resulting array will only have one element * with all the above placeholders replaced. * * If you set $bubbleControllerAndSubpackage to TRUE, then you will get an array with potentially many elements: * The first element of the array is like above. The second element has the @controller part set to "" (the empty string) * The third element now has the @controller part again stripped off, and has the last subpackage part stripped off as well. * This continues until both @subpackage and @controller are empty. * * Example for $bubbleControllerAndSubpackage is TRUE, we have the F3\MyPackage\MySubPackage\Controller\MyController as Controller Object Name and the current format is "html" * If pattern is @templateRoot/@subpackage/@controller/@action.@format, then the resulting array is: * - Resources/Private/Templates/MySubPackage/My/@action.html * - Resources/Private/Templates/MySubPackage/@action.html * - Resources/Private/Templates/@action.html * * If you set $formatIsOptional to TRUE, then for any of the above arrays, every element will be duplicated - once with @format * replaced by the current request format, and once with .@format stripped off. * * @param string $pattern Pattern to be resolved * @param boolean $bubbleControllerAndSubpackage if TRUE, then we successively split off parts from @controller and @subpackage until both are empty. * @param boolean $formatIsOptional if TRUE, then half of the resulting strings will have .@format stripped off, and the other half will have it. * @return array unix style path * @author Sebastian Kurfürst <*****@*****.**> * @author Robert Lemke <*****@*****.**> */ protected function expandGenericPathPattern($pattern, $bubbleControllerAndSubpackage, $formatIsOptional) { $pattern = str_replace('@templateRoot', $this->getTemplateRootPath(), $pattern); $pattern = str_replace('@partialRoot', $this->getPartialRootPath(), $pattern); $pattern = str_replace('@layoutRoot', $this->getLayoutRootPath(), $pattern); $subPackageKey = $this->controllerContext->getRequest()->getControllerSubpackageKey(); $controllerName = $this->controllerContext->getRequest()->getControllerName(); $subpackageParts = $subPackageKey !== '' ? explode(\F3\Fluid\Fluid::NAMESPACE_SEPARATOR, $subPackageKey) : array(); $results = array(); if ($controllerName !== NULL) { $i = -1; } else { $i = 0; } do { $temporaryPattern = $pattern; if ($i < 0) { $temporaryPattern = str_replace('@controller', $controllerName, $temporaryPattern); } else { $temporaryPattern = str_replace('//', '/', str_replace('@controller', '', $temporaryPattern)); } $temporaryPattern = str_replace('@subpackage', implode('/', $i < 0 ? $subpackageParts : array_slice($subpackageParts, $i)), $temporaryPattern); $results[] = \F3\FLOW3\Utility\Files::getUnixStylePath(str_replace('@format', $this->controllerContext->getRequest()->getFormat(), $temporaryPattern)); if ($formatIsOptional) { $results[] = \F3\FLOW3\Utility\Files::getUnixStylePath(str_replace('.@format', '', $temporaryPattern)); } } while ($i++ < count($subpackageParts) && $bubbleControllerAndSubpackage); return $results; }
/** * Reads all test files from base directory and subdirecotries * * @param array $testcaseFilenames array to store found testcases * @param object $testsDirectoryIterator RecursiveDirectoryIterator object * @return array Filenames of all found testcase files * @author Ronny Unger <*****@*****.**> */ protected function readDirectories(array $testcaseFilenames, $testsDirectoryIterator) { while ($testsDirectoryIterator->valid()) { if ($testsDirectoryIterator->hasChildren() && $testsDirectoryIterator->getFilename() != '.svn') { $testcaseFilenames = $this->readDirectories($testcaseFilenames, $testsDirectoryIterator->getChildren()); } if (!$testsDirectoryIterator->isDir()) { $pathAndFilename = \F3\FLOW3\Utility\Files::getUnixStylePath($testsDirectoryIterator->getPathname()); if (preg_match('/\\/' . str_replace('\\', '\\/', $this->testcaseClassName) . '\\.php/', $pathAndFilename) === 1) { $testcaseFilenames[] = $pathAndFilename; } } $testsDirectoryIterator->next(); } return $testcaseFilenames; }
/** * Saves the current configuration into a cache file and creates a cache inclusion script * in the context's Configuration directory. * * @return void * @author Robert Lemke <*****@*****.**> */ protected function saveConfigurationCache() { $configurationCachePath = $this->environment->getPathToTemporaryDirectory() . 'Configuration/'; if (!file_exists($configurationCachePath)) { \F3\FLOW3\Utility\Files::createDirectoryRecursively($configurationCachePath); } $cachePathAndFilename = $configurationCachePath . $this->context . 'Configurations.php'; $currentRevision = \F3\FLOW3\Core\Bootstrap::REVISION; $includeCachedConfigurationsCode = <<<EOD <?php \tif (file_exists('{$cachePathAndFilename}') && \\F3\\FLOW3\\Core\\Bootstrap::REVISION === '{$currentRevision}') { \t\treturn require '{$cachePathAndFilename}'; \t} else { \t\tunlink(__FILE__); \t\treturn array(); \t} ?> EOD; file_put_contents($cachePathAndFilename, '<?php return ' . var_export($this->configurations, TRUE) . '?>'); file_put_contents($this->includeCachedConfigurationsPathAndFilename, $includeCachedConfigurationsCode); }
/** * Sets up the APC backend used for testing * * @return \F3\FLOW3\Cache\Backend\PdoBackend * @author Karsten Dambekalns <*****@*****.**> */ protected function setUpBackend() { $environment = $this->objectManager->getObject('F3\\FLOW3\\Utility\\Environment'); $this->fixtureFolder = $environment->getPathToTemporaryDirectory() . 'FLOW3/Tests/'; \F3\FLOW3\Utility\Files::createDirectoryRecursively($this->fixtureFolder); $this->fixtureDB = uniqid('Cache') . '.db'; $pdoHelper = new \F3\FLOW3\Utility\PdoHelper('sqlite:' . $this->fixtureFolder . $this->fixtureDB, '', ''); $pdoHelper->importSql(FLOW3_PATH_FLOW3 . 'Resources/Private/Cache/SQL/DDL.sql'); $mockSystemLogger = $this->getMock('F3\\FLOW3\\Log\\SystemLoggerInterface'); $mockCache = $this->getMock('F3\\FLOW3\\Cache\\Frontend\\FrontendInterface', array(), array(), '', FALSE); $mockCache->expects($this->any())->method('getIdentifier')->will($this->returnValue('TestCache')); $backend = new \F3\FLOW3\Cache\Backend\PdoBackend('Testing'); $backend->injectEnvironment($environment); $backend->injectSystemLogger($mockSystemLogger); $backend->setCache($mockCache); $backend->setDataSourceName('sqlite:' . $this->fixtureFolder . $this->fixtureDB); $backend->initializeObject(); return $backend; }
/** * Defines various path constants used by FLOW3 and if no root path or web root was * specified by an environment variable, exits with a respective error message. * * @return void */ public static function defineConstants() { define('FLOW3_SAPITYPE', PHP_SAPI === 'cli' ? 'CLI' : 'Web'); define('FLOW3_PATH_FLOW3', str_replace('//', '/', str_replace('\\', '/', realpath(__DIR__ . '/../../') . '/'))); if (isset($_SERVER['FLOW3_ROOTPATH'])) { $rootPath = str_replace('//', '/', str_replace('\\', '/', realpath($_SERVER['FLOW3_ROOTPATH']))) . '/'; $testPath = str_replace('//', '/', str_replace('\\', '/', realpath($rootPath . 'Packages/Framework/FLOW3'))) . '/'; if ($testPath !== FLOW3_PATH_FLOW3) { exit('FLOW3: Invalid root path. (Error #1248964375)' . PHP_EOL . '"' . $rootPath . 'Packages/Framework/FLOW3' . '" does not lead to' . PHP_EOL . '"' . FLOW3_PATH_FLOW3 . '"' . PHP_EOL); } define('FLOW3_PATH_ROOT', $rootPath); unset($rootPath); unset($testPath); } if (FLOW3_SAPITYPE === 'cli') { if (!defined('FLOW3_PATH_ROOT')) { exit('FLOW3: No root path defined in environment variable FLOW3_ROOTPATH (Error #1248964376)' . PHP_EOL); } if (!isset($_SERVER['FLOW3_WEBPATH']) || !is_dir($_SERVER['FLOW3_WEBPATH'])) { exit('FLOW3: No web path defined in environment variable FLOW3_WEBPATH or directory does not exist (Error #1249046843)' . PHP_EOL); } define('FLOW3_PATH_WEB', \F3\FLOW3\Utility\Files::getUnixStylePath(realpath($_SERVER['FLOW3_WEBPATH'])) . '/'); } else { if (!defined('FLOW3_PATH_ROOT')) { define('FLOW3_PATH_ROOT', \F3\FLOW3\Utility\Files::getUnixStylePath(realpath(dirname($_SERVER['SCRIPT_FILENAME']) . '/../')) . '/'); } define('FLOW3_PATH_WEB', \F3\FLOW3\Utility\Files::getUnixStylePath(realpath(dirname($_SERVER['SCRIPT_FILENAME']))) . '/'); } define('FLOW3_PATH_CONFIGURATION', FLOW3_PATH_ROOT . 'Configuration/'); define('FLOW3_PATH_DATA', FLOW3_PATH_ROOT . 'Data/'); define('FLOW3_PATH_PACKAGES', FLOW3_PATH_ROOT . 'Packages/'); }
/** * @test * @author Christopher Hlubek <*****@*****.**> */ public function getPackageDocumentationsScansDocumentationDirectoryAndCreatesDocumentationObjects() { \vfsStreamWrapper::register(); \vfsStreamWrapper::setRoot(new \vfsStreamDirectory('testDirectory')); $packagePath = \vfsStream::url('testDirectory') . '/'; \F3\FLOW3\Utility\Files::createDirectoryRecursively($packagePath . 'Documentation/Manual/DocBook/en'); $mockDocumentation = $this->getMock('F3\\FLOW3\\Package\\Documentation', array('dummy'), array(), '', FALSE); $package = new \F3\FLOW3\Package\Package('FLOW3', $packagePath); $mockObjectFactory = $this->getMock('F3\\FLOW3\\Object\\ObjectFactoryInterface'); $mockObjectFactory->expects($this->once())->method('create')->with('F3\\FLOW3\\Package\\Documentation', $package, 'Manual', $packagePath . 'Documentation/Manual/')->will($this->returnValue($mockDocumentation)); $package->injectObjectFactory($mockObjectFactory); $documentations = $package->getPackageDocumentations(); $this->assertEquals(array('Manual' => $mockDocumentation), $documentations); }