コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /**
  * 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;
     }
 }
コード例 #3
0
 /**
  * @test
  * @author Bastian Waidelich <*****@*****.**>
  */
 public function concatenatePathsWorksForEmptyPathArrayElements()
 {
     $this->assertEquals('foo/bar', \F3\FLOW3\Utility\Files::concatenatePaths(array('foo', '', 'bar')));
 }
コード例 #4
0
 /**
  * Recursively publishes static resources located in the specified directory.
  * These resources are typically public package resources provided by the active packages.
  *
  * @param string $sourcePath The full path to the source directory which should be published (includes sub directories)
  * @param string $relativeTargetPath Path relative to the target's root where resources should be published to.
  * @return boolean TRUE if publication succeeded or FALSE if the resources could not be published
  */
 public function publishStaticResources($sourcePath, $relativeTargetPath)
 {
     if (!is_dir($sourcePath)) {
         return FALSE;
     }
     $targetPath = \F3\FLOW3\Utility\Files::concatenatePaths(array($this->resourcesPublishingPath . 'Static/', $relativeTargetPath));
     foreach (\F3\FLOW3\Utility\Files::readDirectoryRecursively($sourcePath) as $sourcePathAndFilename) {
         if (substr(strtolower($sourcePathAndFilename), -4, 4) === '.php') {
             continue;
         }
         $targetPathAndFilename = \F3\FLOW3\Utility\Files::concatenatePaths(array($targetPath, str_replace($sourcePath, '', $sourcePathAndFilename)));
         if (!file_exists($targetPathAndFilename) || filemtime($sourcePathAndFilename) > filemtime($targetPathAndFilename)) {
             $this->mirrorFile($sourcePathAndFilename, $targetPathAndFilename, TRUE);
         }
     }
     return TRUE;
 }
コード例 #5
0
 /**
  * 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;
     }
 }