Ejemplo n.º 1
0
 /**
  * Parses the system context for a home directory.
  *
  * @return null|string Returns the path to the home directory or `null`
  *                     if none was found.
  */
 private static function parseHomeDirectory()
 {
     try {
         $homeDir = System::parseHomeDirectory();
         System::denyWebAccess($homeDir);
         return $homeDir;
     } catch (InvalidConfigException $e) {
         // Context variable was not found -> no home directory
         // This happens often on web servers where the home directory is
         // not set manually
         return null;
     }
 }
Ejemplo n.º 2
0
 public function testDenyWebAccess()
 {
     $this->assertFileNotExists($this->tempHome . '/.htaccess');
     System::denyWebAccess($this->tempHome);
     // Directory is protected
     $this->assertFileExists($this->tempHome . '/.htaccess');
     $this->assertSame('Deny from all', file_get_contents($this->tempHome . '/.htaccess'));
 }