本文整理汇总了PHP中Bitrix\Main\Loader::getPersonal方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::getPersonal方法的具体用法?PHP Loader::getPersonal怎么用?PHP Loader::getPersonal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\Loader
的用法示例。
在下文中一共展示了Loader::getPersonal方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connectInternal
/**
* Establishes a connection to the database.
* Includes php_interface/after_connect_d7.php on success.
* Throws exception on failure.
*
* @return void
* @throws \Bitrix\Main\DB\ConnectionException
*/
protected function connectInternal()
{
if ($this->isConnected) {
return;
}
$connectionInfo = array("UID" => $this->login, "PWD" => $this->password, "Database" => $this->database, "ReturnDatesAsStrings" => true);
if (($this->options & self::PERSISTENT) != 0) {
$connectionInfo["ConnectionPooling"] = true;
} else {
$connectionInfo["ConnectionPooling"] = false;
}
$connection = sqlsrv_connect($this->host, $connectionInfo);
if (!$connection) {
throw new ConnectionException('MS Sql connect error', $this->getErrorMessage());
}
$this->resource = $connection;
$this->isConnected = true;
// hide cautions
sqlsrv_configure("WarningsReturnAsErrors", 0);
/** @noinspection PhpUnusedLocalVariableInspection */
global $DB, $USER, $APPLICATION;
if ($fn = \Bitrix\Main\Loader::getPersonal("php_interface/after_connect_d7.php")) {
include $fn;
}
}
示例2: runInitScripts
public static function runInitScripts()
{
if (($includePath = \Bitrix\Main\Loader::getLocal("init.php")) !== false) {
require_once $includePath;
}
if (($includePath = \Bitrix\Main\Loader::getPersonal("php_interface/init.php")) !== false) {
require_once $includePath;
}
if (($includePath = \Bitrix\Main\Loader::getPersonal("php_interface/" . SITE_ID . "/init.php")) !== false) {
require_once $includePath;
}
}
示例3: connectInternal
protected function connectInternal()
{
if ($this->isConnected) {
return;
}
$dbHost = $this->dbHost;
$dbPort = 0;
if (($pos = strpos($dbHost, ":")) !== false) {
$dbPort = intval(substr($dbHost, $pos + 1));
$dbHost = substr($dbHost, 0, $pos);
}
if (($this->dbOptions & self::PERSISTENT) != 0) {
$dbHost = "p:" . $dbHost;
}
/** @var $connection \mysqli */
$connection = \mysqli_init();
if (!$connection) {
throw new ConnectionException('Mysql init failed');
}
if (!empty($this->dbInitCommand)) {
if (!$connection->options(MYSQLI_INIT_COMMAND, $this->dbInitCommand)) {
throw new ConnectionException('Setting mysql init command failed');
}
}
if ($dbPort > 0) {
$r = $connection->real_connect($dbHost, $this->dbLogin, $this->dbPassword, $this->dbName, $dbPort);
} else {
$r = $connection->real_connect($dbHost, $this->dbLogin, $this->dbPassword, $this->dbName);
}
if (!$r) {
throw new ConnectionException('Mysql connect error', sprintf('(%s) %s', $connection->connect_errno, $connection->connect_error));
}
$this->resource = $connection;
$this->isConnected = true;
// nosql memcached driver
if (isset($this->configuration['memcache'])) {
$memcached = \Bitrix\Main\Application::getInstance()->getConnectionPool()->getConnection($this->configuration['memcache']);
mysqlnd_memcache_set($this->resource, $memcached->getResource());
}
//global $DB, $USER, $APPLICATION;
if ($fn = \Bitrix\Main\Loader::getPersonal("php_interface/after_connect_d7.php")) {
include $fn;
}
}
示例4: connectInternal
protected function connectInternal()
{
if ($this->isConnected) {
return;
}
if (($this->dbOptions & self::PERSISTENT) != 0) {
$connection = oci_pconnect($this->dbLogin, $this->dbPassword, $this->dbName);
} else {
$connection = oci_connect($this->dbLogin, $this->dbPassword, $this->dbName);
}
if (!$connection) {
throw new ConnectionException('Oracle connect error', $this->getErrorMessage());
}
$this->isConnected = true;
$this->resource = $connection;
global $DB, $USER, $APPLICATION;
if ($fn = \Bitrix\Main\Loader::getPersonal("php_interface/after_connect_d7.php")) {
include $fn;
}
}
示例5: connectInternal
/**
* Establishes a connection to the database.
* Includes php_interface/after_connect_d7.php on success.
* Throws exception on failure.
*
* @return void
* @throws \Bitrix\Main\DB\ConnectionException
*/
protected function connectInternal()
{
if ($this->isConnected) {
return;
}
if (($this->options & self::PERSISTENT) != 0) {
$connection = oci_pconnect($this->login, $this->password, $this->database);
} else {
$connection = oci_new_connect($this->login, $this->password, $this->database);
}
if (!$connection) {
throw new ConnectionException('Oracle connect error', $this->getErrorMessage());
}
$this->isConnected = true;
$this->resource = $connection;
/** @noinspection PhpUnusedLocalVariableInspection */
global $DB, $USER, $APPLICATION;
if ($fn = \Bitrix\Main\Loader::getPersonal("php_interface/after_connect_d7.php")) {
include $fn;
}
}
示例6: connectInternal
protected function connectInternal()
{
if ($this->isConnected) {
return;
}
if (($this->dbOptions & self::PERSISTENT) != 0) {
$connection = mysql_pconnect($this->dbHost, $this->dbLogin, $this->dbPassword);
} else {
$connection = mysql_connect($this->dbHost, $this->dbLogin, $this->dbPassword, true);
}
if (!$connection) {
throw new ConnectionException('Mysql connect error', mysql_error());
}
if (!mysql_select_db($this->dbName, $connection)) {
throw new ConnectionException('Mysql select db error', mysql_error($connection));
}
$this->resource = $connection;
$this->isConnected = true;
if ($fn = \Bitrix\Main\Loader::getPersonal("php_interface/after_connect_d7.php")) {
include $fn;
}
}
示例7: clearCache
public static function clearCache($full = false, $initDir = "")
{
if ($full !== true && $full !== false && $initDir === "" && is_string($full)) {
$initDir = $full;
$full = true;
}
$res = true;
if ($full === true) {
$obCache = static::createInstance();
$obCache->cleanDir($initDir, "cache");
}
$path = Main\Loader::getPersonal("cache" . $initDir);
if (is_dir($path) && ($handle = opendir($path))) {
while (($file = readdir($handle)) !== false) {
if ($file === "." || $file === "..") {
continue;
}
if (is_dir($path . "/" . $file)) {
if (!static::clearCache($full, $initDir . "/" . $file)) {
$res = false;
} else {
@chmod($path . "/" . $file, BX_DIR_PERMISSIONS);
//We suppress error handle here because there may be valid cache files in this dir
@rmdir($path . "/" . $file);
}
} elseif ($full) {
@chmod($path . "/" . $file, BX_FILE_PERMISSIONS);
if (!unlink($path . "/" . $file)) {
$res = false;
}
} elseif (substr($file, -4) === ".php") {
$c = static::createInstance();
if ($c->isCacheExpired($path . "/" . $file)) {
@chmod($path . "/" . $file, BX_FILE_PERMISSIONS);
if (!unlink($path . "/" . $file)) {
$res = false;
}
}
} else {
//We should skip unknown file
//it will be deleted with full cache cleanup
}
}
closedir($handle);
}
return $res;
}
示例8: runInitScripts
protected function runInitScripts()
{
if (!$this->dispatcher instanceof Dispatcher) {
throw new \Exception();
}
if (($includePath = Loader::getLocal("init_d7.php")) !== false) {
require_once $includePath;
}
if (($includePath = Loader::getPersonal("php_interface/init_d7.php")) !== false) {
require_once $includePath;
}
// константы после init.php
define("BX_CRONTAB_SUPPORT", defined("BX_CRONTAB"));
if (!defined("BX_FILE_PERMISSIONS")) {
define("BX_FILE_PERMISSIONS", 0644);
}
if (!defined("BX_DIR_PERMISSIONS")) {
define("BX_DIR_PERMISSIONS", 0755);
}
}