2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_SOURCE_ROOT_INFO_H_
18 #define incl_HPHP_SOURCE_ROOT_INFO_H_
20 #include "hphp/runtime/base/complex_types.h"
21 #include "hphp/runtime/eval/debugger/debugger_base.h"
24 ///////////////////////////////////////////////////////////////////////////////
28 class SourceRootInfo
{
30 SourceRootInfo(const char *host
);
31 SourceRootInfo(const std::string
&user
, const std::string
&sandbox
);
32 void createFromUserConfig();
33 void createFromCommonRoot(const String
&sandboxName
);
37 void setServerVariables(Variant
&server
) const;
38 std::string
path() const;
40 bool sandboxOn() const {
41 return m_sandboxCond
== SandboxOn
;
52 return m_sandboxCond
== SandboxError
;
54 void handleError(Transport
*t
);
55 static const std::string
&GetCurrentSourceRoot() {
56 return s_path
.isNull() ? RuntimeOption::SourceRoot
: *s_path
;
58 static const std::string
&GetCurrentPhpRoot() {
59 return s_phproot
.isNull() ? initPhpRoot() : *s_phproot
;
62 Eval::DSandboxInfo
getSandboxInfo() const;
68 enum SandboxCondition
{
74 static DECLARE_THREAD_LOCAL_NO_CHECK(std::string
, s_path
);
75 static DECLARE_THREAD_LOCAL_NO_CHECK(std::string
, s_phproot
);
77 static std::string
& initPhpRoot();
78 std::string
parseSandboxServerVariable(const std::string
&format
) const;
81 ///////////////////////////////////////////////////////////////////////////////
84 #endif // incl_HPHP_SOURCE_ROOT_INFO_H_