本文整理汇总了PHP中Bitrix\Main\Application::getPersonalRoot方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getPersonalRoot方法的具体用法?PHP Application::getPersonalRoot怎么用?PHP Application::getPersonalRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\Application
的用法示例。
在下文中一共展示了Application::getPersonalRoot方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UnInstallFiles
function UnInstallFiles()
{
$rootDir = Application::getDocumentRoot() . '/' . Application::getPersonalRoot();
$adminGatewayFile = '/admin/ws_tools.php';
unlink($rootDir . $adminGatewayFile);
return true;
}
示例2: UnInstallFiles
public function UnInstallFiles()
{
$files = array('js' => '/js/' . $this->MODULE_ID, 'img' => '/images/' . $this->MODULE_ID, 'request' => '/tools/' . $this->MODULE_ID);
$rootDir = Application::getDocumentRoot() . '/' . ltrim(Application::getPersonalRoot(), '/');
foreach ($files as $file) {
Directory::deleteDirectory($rootDir . $file);
}
}
示例3: getCurrentTemplateId
public static function getCurrentTemplateId($siteId)
{
$cacheFlags = Config\Configuration::getValue("cache_flags");
$ttl = isset($cacheFlags["site_template"]) ? $cacheFlags["site_template"] : 0;
$connection = Application::getConnection();
$sqlHelper = $connection->getSqlHelper();
$field = $connection->getType() === "mysql" ? "`CONDITION`" : "CONDITION";
$path2templates = IO\Path::combine(Application::getDocumentRoot(), Application::getPersonalRoot(), "templates");
if ($ttl === false) {
$sql = "\n\t\t\t\tSELECT " . $field . ", TEMPLATE\n\t\t\t\tFROM b_site_template\n\t\t\t\tWHERE SITE_ID = '" . $sqlHelper->forSql($siteId) . "'\n\t\t\t\tORDER BY IF(LENGTH(" . $field . ") > 0, 1, 2), SORT\n\t\t\t\t";
$recordset = $connection->query($sql);
while ($record = $recordset->fetch()) {
$condition = trim($record["CONDITION"]);
if ($condition != '' && !@eval("return " . $condition . ";")) {
continue;
}
if (IO\Directory::isDirectoryExists($path2templates . "/" . $record["TEMPLATE"])) {
return $record["TEMPLATE"];
}
}
} else {
$managedCache = Application::getInstance()->getManagedCache();
if ($managedCache->read($ttl, "b_site_template")) {
$arSiteTemplateBySite = $managedCache->get("b_site_template");
} else {
$arSiteTemplateBySite = array();
$sql = "\n\t\t\t\t\tSELECT " . $field . ", TEMPLATE, SITE_ID\n\t\t\t\t\tFROM b_site_template\n\t\t\t\t\tWHERE SITE_ID = '" . $sqlHelper->forSql($siteId) . "'\n\t\t\t\t\tORDER BY SITE_ID, IF(LENGTH(" . $field . ") > 0, 1, 2), SORT\n\t\t\t\t\t";
$recordset = $connection->query($sql);
while ($record = $recordset->fetch()) {
$arSiteTemplateBySite[$record['SITE_ID']][] = $record;
}
$managedCache->set("b_site_template", $arSiteTemplateBySite);
}
if (is_array($arSiteTemplateBySite[$siteId])) {
foreach ($arSiteTemplateBySite[$siteId] as $record) {
$condition = trim($record["CONDITION"]);
if ($condition != '' && !@eval("return " . $condition . ";")) {
continue;
}
if (IO\Directory::isDirectoryExists($path2templates . "/" . $record["TEMPLATE"])) {
return $record["TEMPLATE"];
}
}
}
}
return ".default";
}
示例4: initCache
public function initCache($TTL, $uniqueString, $initDir = false, $baseDir = "cache")
{
if ($initDir === false) {
$request = Main\Context::getCurrent()->getRequest();
$initDir = $request->getRequestedPageDirectory();
}
$personalRoot = Main\Application::getPersonalRoot();
$this->baseDir = $personalRoot . "/" . $baseDir . "/";
$this->initDir = $initDir;
$this->filename = "/" . $this->getPath($uniqueString);
$this->TTL = $TTL;
$this->uniqueString = $uniqueString;
$this->vars = false;
if ($TTL <= 0) {
return false;
}
if (static::shouldClearCache()) {
return false;
}
$arAllVars = array("CONTENT" => "", "VARS" => "");
if (!$this->cacheEngine->read($arAllVars, $this->baseDir, $this->initDir, $this->filename, $this->TTL)) {
return false;
}
if (static::$showCacheStat) {
$read = 0;
$path = '';
if ($this->cacheEngine instanceof ICacheEngineStat) {
$read = $this->cacheEngine->getReadBytes();
$path = $this->cacheEngine->getCachePath();
} elseif ($this->cacheEngine instanceof \ICacheBackend) {
/** @noinspection PhpUndefinedFieldInspection */
$read = $this->cacheEngine->read;
/** @noinspection PhpUndefinedFieldInspection */
$path = $this->cacheEngine->path;
}
Diag\CacheTracker::addCacheStatBytes($read);
Diag\CacheTracker::add($read, $path, $this->baseDir, $this->initDir, $this->filename, "R");
}
$this->content = $arAllVars["CONTENT"];
$this->vars = $arAllVars["VARS"];
return true;
}
示例5: getDbConnConnectionParameters
private function getDbConnConnectionParameters()
{
/* Old kernel code for compatibility */
global $DBType, $DBDebug, $DBDebugToFile, $DBHost, $DBName, $DBLogin, $DBPassword, $DBSQLServerType;
require_once Main\Application::getDocumentRoot() . Main\Application::getPersonalRoot() . "/php_interface/dbconn.php";
$DBType = strtolower($DBType);
if ($DBType == 'mysql') {
$className = "\\Bitrix\\Main\\DB\\MysqlConnection";
} elseif ($DBType == 'mssql') {
$className = "\\Bitrix\\Main\\DB\\MssqlConnection";
} else {
$className = "\\Bitrix\\Main\\DB\\OracleConnection";
}
return array('className' => $className, 'host' => $DBHost, 'database' => $DBName, 'login' => $DBLogin, 'password' => $DBPassword, 'options' => (!defined("DBPersistent") || DBPersistent ? Main\DB\Connection::PERSISTENT : 0) | (defined("DELAY_DB_CONNECT") && DELAY_DB_CONNECT === true ? Main\DB\Connection::DEFERRED : 0));
}
示例6: includeConfiguration
/**
* Reads the configuration.
*
* @return array
*/
public function includeConfiguration()
{
if (!isset($this->options)) {
$arHTMLPagesOptions = array();
$configurationPath = Main\IO\Path::convertRelativeToAbsolute(Main\Application::getPersonalRoot() . "/html_pages/.config.php");
if (file_exists($configurationPath)) {
include $configurationPath;
}
$this->options = $arHTMLPagesOptions;
}
return $this->options;
}
示例7: initCache
public function initCache($TTL, $uniqueString, $initDir = false, $baseDir = "cache")
{
if ($initDir === false) {
$request = \Bitrix\Main\Context::getCurrent()->getRequest();
$initDir = $request->getRequestedPageDirectory();
}
$personalRoot = \Bitrix\Main\Application::getPersonalRoot();
$this->baseDir = \Bitrix\Main\IO\Path::combine($personalRoot, $baseDir);
$this->initDir = $initDir;
$this->filename = $this->getPath($uniqueString);
$this->TTL = $TTL;
$this->uniqueString = $uniqueString;
$this->vars = false;
if ($TTL <= 0) {
return false;
}
if ($this->getClearCache()) {
return false;
}
$arAllVars = array("CONTENT" => "", "VARS" => "");
if (!$this->cacheEngine->read($arAllVars, $this->baseDir, $this->initDir, $this->filename, $this->TTL)) {
return false;
}
$this->content = $arAllVars["CONTENT"];
$this->vars = $arAllVars["VARS"];
return true;
}
示例8: __construct
public function __construct($cacheKey, array $configuration, array $htmlCacheOptions)
{
parent::__construct($cacheKey, $configuration, $htmlCacheOptions);
$this->cacheFile = new Main\IO\File(Main\IO\Path::convertRelativeToAbsolute(Main\Application::getPersonalRoot() . "/html_pages" . $this->cacheKey));
}
示例9: baseDir
/**
* @return string
*/
private function baseDir()
{
$personalRoot = Application::getPersonalRoot();
return $personalRoot . "/" . $this->bxBaseDir . "/";
}