Bitrix-D7  20.0.0
main/lib/site.php
См. документацию.
1 <?php
2 /**
3  * Bitrix Framework
4  * @package bitrix
5  * @subpackage main
6  * @copyright 2001-2012 Bitrix
7  */
8 namespace Bitrix\Main;
9 
10 use Bitrix\Main\IO;
11 
13 {
14  private static $documentRootCache = array();
15 
16  public static function getDocumentRoot($siteId = null)
17  {
18  if ($siteId === null)
19  {
20  $context = Application::getInstance()->getContext();
21  $siteId = $context->getSite();
22  }
23 
24  if (!isset(self::$documentRootCache[$siteId]))
25  {
26  $ar = SiteTable::getRow(array("filter" => array("LID" => $siteId)));
27  if ($ar && ($docRoot = $ar["DOC_ROOT"]) && (strlen($docRoot) > 0))
28  {
29  if (!IO\Path::isAbsolute($docRoot))
30  $docRoot = IO\Path::combine(Application::getDocumentRoot(), $docRoot);
31 
32  self::$documentRootCache[$siteId] = $docRoot;
33  }
34  else
35  {
36  self::$documentRootCache[$siteId] = Application::getDocumentRoot();
37  }
38  }
39 
40  return self::$documentRootCache[$siteId];
41  }
42 
43  public static function getTableName()
44  {
45  return 'b_lang';
46  }
47 
48  public static function getMap()
49  {
50  return array(
51  'LID' => array(
52  'data_type' => 'string',
53  'primary' => true
54  ),
55  'SORT' => array(
56  'data_type' => 'integer',
57  ),
58  'DEF' => array(
59  'data_type' => 'boolean',
60  'values' => array('N', 'Y'),
61  ),
62  'ACTIVE' => array(
63  'data_type' => 'boolean',
64  'values' => array('N', 'Y'),
65  ),
66  'NAME' => array(
67  'data_type' => 'string'
68  ),
69  'DIR' => array(
70  'data_type' => 'string'
71  ),
72  'LANGUAGE_ID' => array(
73  'data_type' => 'string',
74  ),
75  'DOC_ROOT' => array(
76  'data_type' => 'string',
77  ),
78  'DOMAIN_LIMITED' => array(
79  'data_type' => 'boolean',
80  'values' => array('N', 'Y'),
81  ),
82  'SERVER_NAME' => array(
83  'data_type' => 'string'
84  ),
85  'SITE_NAME' => array(
86  'data_type' => 'string'
87  ),
88  'EMAIL' => array(
89  'data_type' => 'string'
90  ),
91  'CULTURE_ID' => array(
92  'data_type' => 'integer',
93  ),
94  'CULTURE' => array(
95  'data_type' => 'Bitrix\Main\Localization\Culture',
96  'reference' => array('=this.CULTURE_ID' => 'ref.ID'),
97  ),
98  );
99  }
100 }
Bitrix\Main\SiteTable\getDocumentRoot
static getDocumentRoot($siteId=null)
Definition: main/lib/site.php:16
Bitrix\Main\ORM\Data\DataManager\getRow
static getRow(array $parameters)
Returns one row (or null) by parameters for getList()
Definition: main/lib/orm/data/datamanager.php:407
Bitrix\Main\ORM\Data\DataManager
Base entity data manager.
Definition: main/lib/orm/data/datamanager.php:32
Bitrix\Main\IO\Path\isAbsolute
static isAbsolute($path)
Definition: main/lib/io/path.php:358
Bitrix\Main
Bitrix\Main\IO\Path\combine
static combine()
Definition: main/lib/io/path.php:221
Bitrix\Main\SiteTable\getMap
static getMap()
Definition: main/lib/site.php:48
Bitrix\Main\Application\getInstance
static getInstance()
Returns current instance of the Application.
Definition: main/lib/application.php:86
Bitrix\Main\Application\getDocumentRoot
static getDocumentRoot()
Returns server document root.
Definition: main/lib/application.php:460
Bitrix\Main\IO
Definition: main/lib/io/directory.php:2
Bitrix\Main\SiteTable\getTableName
static getTableName()
Definition: main/lib/site.php:43
Bitrix\Main\SiteTable
Definition: main/lib/site.php:12