当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::getConnection方法代码示例

本文整理汇总了PHP中Bitrix\Main\Application::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getConnection方法的具体用法?PHP Application::getConnection怎么用?PHP Application::getConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bitrix\Main\Application的用法示例。


在下文中一共展示了Application::getConnection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addProductsFromOrder

 /**
  * Add products from order or updates existing.
  *
  * @param $orderId
  *
  * @return void
  */
 public static function addProductsFromOrder($orderId = 0)
 {
     $orderId = (int) $orderId;
     if (Sale\OrderProcessingTable::hasAddedProducts($orderId)) {
         return;
     }
     $connection = Main\Application::getConnection();
     $type = $connection->getType();
     // Update existing
     if ($type == "mysql") {
         $sqlUpdate = "UPDATE b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\tSET  p2p.CNT = p2p.CNT + 1\n\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID";
     } elseif ($type == "mssql") {
         $sqlUpdate = "UPDATE b_sale_product2product\n\t\t\t\tSET CNT = CNT + 1\n\t\t\t\tFROM b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID";
     } else {
         $sqlUpdate = "UPDATE b_sale_product2product\n\t\t\t\tSET CNT = CNT + 1\n\t\t\t\tWHERE ID IN (\n\t\t\t\t\tSELECT p2p.ID FROM b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID\n\t\t\t\t\t)";
     }
     $connection->query($sqlUpdate);
     // Insert new
     $sqlInsert = "INSERT INTO b_sale_product2product (PRODUCT_ID, PARENT_PRODUCT_ID, CNT)\n\t\t\tSELECT b.PRODUCT_ID, b1.PRODUCT_ID, 1\n\t\t\tFROM b_sale_basket b, b_sale_basket b1\n\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\tNOT EXISTS (SELECT 1 FROM b_sale_product2product d WHERE d.PRODUCT_ID = b.PRODUCT_ID AND d.PARENT_PRODUCT_ID = b1.PRODUCT_ID)";
     $connection->query($sqlInsert);
     Sale\OrderProcessingTable::markProductsAdded($orderId);
     if (defined("BX_COMP_MANAGED_CACHE")) {
         $app = Main\Application::getInstance();
         $app->getTaggedCache()->clearByTag('sale_product_buy');
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:product2product.php

示例2: deleteByDeliveryIdClassName

 public static function deleteByDeliveryIdClassName($deliveryId, $className)
 {
     $con = \Bitrix\Main\Application::getConnection();
     $sqlHelper = $con->getSqlHelper();
     $strSql = "DELETE FROM " . self::getTableName() . " WHERE DELIVERY_ID=" . $sqlHelper->forSql($deliveryId) . " AND CLASS_NAME='" . $sqlHelper->forSql($className) . "'";
     $con->queryExecute($strSql);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:7,代码来源:table.php

示例3: Set

 public static function Set($user_id, $page_last_date, $page_size, $page_num = 1, $site_id = SITE_ID, $group_code = '**', $traffic_avg = false, $traffic_cnt = false)
 {
     global $DB;
     $user_id = intval($user_id);
     $page_size = intval($page_size);
     $page_num = intval($page_num);
     $traffic_avg = intval($traffic_avg);
     $traffic_cnt = intval($traffic_cnt);
     if ($user_id <= 0 || $page_size <= 0 || strlen($page_last_date) <= 0) {
         return false;
     }
     $page_last_date = new \Bitrix\Main\Type\DateTime($page_last_date);
     $connection = \Bitrix\Main\Application::getConnection();
     $helper = $connection->getSqlHelper();
     $arInsertFields = array("USER_ID" => $user_id, "SITE_ID" => $DB->ForSQL($site_id), "GROUP_CODE" => $DB->ForSQL($group_code), "PAGE_SIZE" => $page_size, "PAGE_NUM" => $page_num, "PAGE_LAST_DATE" => $page_last_date);
     $arUpdateFields = array("PAGE_LAST_DATE" => $page_last_date);
     if ($traffic_cnt) {
         $arInsertFields["TRAFFIC_AVG"] = $arUpdateFields["TRAFFIC_AVG"] = $traffic_avg;
         $arInsertFields["TRAFFIC_CNT"] = $arUpdateFields["TRAFFIC_CNT"] = $traffic_cnt;
         $arInsertFields["TRAFFIC_LAST_DATE"] = $arUpdateFields["TRAFFIC_LAST_DATE"] = new \Bitrix\Main\DB\SqlExpression($helper->getCurrentDateTimeFunction());
     }
     $merge = $helper->prepareMerge("b_sonet_log_page", array("USER_ID", "SITE_ID", "GROUP_CODE", "PAGE_SIZE", "PAGE_NUM"), $arInsertFields, $arUpdateFields);
     if ($merge[0] != "") {
         $connection->query($merge[0]);
         if ($traffic_cnt) {
             CSocNetLogFollow::checkAutoUnfollow($traffic_cnt, $traffic_avg, $user_id);
         }
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:29,代码来源:log_pages.php

示例4: clearValues

 function clearValues()
 {
     $connection = \Bitrix\Main\Application::getConnection();
     $connection->query("\n\t\t\tDELETE FROM b_iblock_element_iprop\n\t\t\tWHERE IBLOCK_ID = " . $this->iblock_id . "\n\t\t");
     $connection->query("\n\t\t\tDELETE FROM b_iblock_section_iprop\n\t\t\tWHERE IBLOCK_ID = " . $this->iblock_id . "\n\t\t");
     $connection->query("\n\t\t\tDELETE FROM b_iblock_iblock_iprop\n\t\t\tWHERE IBLOCK_ID = " . $this->iblock_id . "\n\t\t");
 }
开发者ID:spas-viktor,项目名称:books,代码行数:7,代码来源:iblockvalues.php

示例5: getMap

 public static function getMap()
 {
     global $DB, $DBType;
     $connection = Main\Application::getConnection();
     $helper = $connection->getSqlHelper();
     return array('ID' => array('data_type' => 'integer', 'primary' => true, 'autocomplete' => true), 'LID' => array('data_type' => 'string', 'required' => true, 'validation' => array(__CLASS__, 'validateLid')), 'FUSER_ID' => array('data_type' => 'integer', 'required' => true), new Main\Entity\ReferenceField('FUSER', 'Bitrix\\Sale\\Internals\\Fuser', array('=this.FUSER_ID' => 'ref.ID'), array('join_type' => 'INNER')), new Main\Entity\ReferenceField('USER', 'Bitrix\\Main\\User', array('=this.ID' => 'FUSER.USER_ID')), 'ORDER_ID' => array('data_type' => 'integer'), new Main\Entity\ReferenceField('ORDER', 'Bitrix\\Sale\\Internals\\Order', array('=this.ORDER_ID' => 'ref.ID')), 'PRODUCT_ID' => array('data_type' => 'integer', 'required' => true), 'PRODUCT' => array('data_type' => 'Product', 'reference' => array('=this.PRODUCT_ID' => 'ref.ID')), 'PRODUCT_PRICE_ID' => array('data_type' => 'integer'), 'NAME' => array('data_type' => 'string'), new Main\Entity\ExpressionField('NAME_WITH_IDENT', $helper->getConcatFunction("%s", "' ['", "%s", "']'"), array('NAME', 'PRODUCT_ID')), 'PRICE' => array('data_type' => 'float'), 'CURRENCY' => array('data_type' => 'string', 'required' => true, 'validation' => array(__CLASS__, 'validateCurrency')), 'BASE_PRICE' => array('data_type' => 'float'), 'VAT_INCLUDED' => array('data_type' => 'boolean', 'values' => array('Y', 'N')), 'DATE_INSERT' => array('data_type' => 'datetime'), 'DATE_INS' => array('data_type' => 'datetime', 'expression' => array($DB->datetimeToDateFunction('%s'), 'DATE_INSERT')), 'DATE_UPDATE' => array('data_type' => 'datetime'), 'DATE_UPD' => array('data_type' => 'datetime', 'expression' => array($DB->datetimeToDateFunction('%s'), 'DATE_UPDATE')), 'WEIGHT' => array('data_type' => 'float'), 'QUANTITY' => array('data_type' => 'float', 'required' => true), 'DELAY' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'SUMMARY_PRICE' => array('data_type' => 'float', 'expression' => array('(%s * %s)', 'QUANTITY', 'PRICE')), 'CAN_BUY' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'MODULE' => array('data_type' => 'string'), 'PRODUCT_PROVIDER_CLASS' => array('data_type' => 'string'), 'NOTES' => array('data_type' => 'string'), 'DETAIL_PAGE_URL' => array('data_type' => 'string'), 'DISCOUNT_PRICE' => array('data_type' => 'float'), 'CATALOG_XML_ID' => array('data_type' => 'string'), 'PRODUCT_XML_ID' => array('data_type' => 'string'), 'DISCOUNT_NAME' => array('data_type' => 'string', 'validation' => array(__CLASS__, 'validateDiscountName')), 'DISCOUNT_VALUE' => array('data_type' => 'string', 'validation' => array(__CLASS__, 'validateDiscountValue')), 'DISCOUNT_COUPON' => array('data_type' => 'string', 'validation' => array(__CLASS__, 'validateDiscountCoupon')), 'VAT_RATE' => array('data_type' => 'float'), 'VAT_RATE_PRC' => array('data_type' => 'float', 'expression' => array('100 * %s', 'VAT_RATE')), 'SUBSCRIBE' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'N_SUBSCRIBE' => array('data_type' => 'integer', 'expression' => array('CASE WHEN %s = \'Y\' THEN 1 ELSE 0 END', 'SUBSCRIBE')), 'RESERVED' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'RESERVE_QUANTITY' => array('data_type' => 'float'), 'BARCODE_MULTI' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'CUSTOM_PRICE' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'DIMENSIONS' => array('serialized' => true, 'data_type' => 'string'), 'TYPE' => array('data_type' => 'integer'), 'SET_PARENT_ID' => array('data_type' => 'integer'), 'MEASURE_CODE' => array('data_type' => 'integer'), 'MEASURE_NAME' => array('data_type' => 'string'), 'CALLBACK_FUNC' => array('data_type' => 'string'), 'ORDER_CALLBACK_FUNC' => array('data_type' => 'string'), 'CANCEL_CALLBACK_FUNC' => array('data_type' => 'string'), 'PAY_CALLBACK_FUNC' => array('data_type' => 'string'), 'RECOMMENDATION' => array('data_type' => 'string'), 'ALL_PRICE' => array('data_type' => 'float', 'expression' => array('(%s + %s)', 'QUANTITY', 'DISCOUNT_PRICE')), 'SUMMARY_PURCHASING_PRICE' => array('data_type' => 'float', 'expression' => array('(%s) * %s', 'PRODUCT.PURCHASING_PRICE_IN_SITE_CURRENCY', 'QUANTITY')), 'GROSS_PROFIT' => array('data_type' => 'float', 'expression' => array('(%s) - (%s)', 'SUMMARY_PRICE', 'SUMMARY_PURCHASING_PRICE')), 'PROFITABILITY' => array('data_type' => 'float', 'expression' => array('CASE WHEN %s is NULL OR %s=0 THEN NULL ELSE (%s) * 100 / (%s) END', 'SUMMARY_PURCHASING_PRICE', 'SUMMARY_PURCHASING_PRICE', 'GROSS_PROFIT', 'SUMMARY_PURCHASING_PRICE')), 'SHIPMENT_ITEM' => array('data_type' => 'ShipmentItem', 'reference' => array('=ref.BASKET_ID' => 'this.ID')), 'SHIPMENT' => array('data_type' => 'Shipment', 'reference' => array('=ref.ID' => 'this.SHIPMENT_ITEM.ORDER_DELIVERY_ID')), 'PAYMENT' => array('data_type' => 'Payment', 'reference' => array('=ref.ORDER_ID' => 'this.ORDER_ID')));
 }
开发者ID:Satariall,项目名称:izurit,代码行数:7,代码来源:basket.php

示例6: upsert

 public static function upsert(array $data)
 {
     $connection = Main\Application::getConnection();
     $sqlHelper = $connection->getSqlHelper();
     $entityTypeID = isset($data['ENTITY_TYPE_ID']) ? (int) $data['ENTITY_TYPE_ID'] : 0;
     $entityID = isset($data['ENTITY_ID']) ? (int) $data['ENTITY_ID'] : 0;
     $typeID = isset($data['TYPE_ID']) ? (int) $data['TYPE_ID'] : 0;
     $address1 = isset($data['ADDRESS_1']) && $data['ADDRESS_1'] !== '' ? "'{$sqlHelper->forSql($data['ADDRESS_1'], 255)}'" : 'NULL';
     $address2 = isset($data['ADDRESS_2']) && $data['ADDRESS_2'] !== '' ? "'{$sqlHelper->forSql($data['ADDRESS_2'], 255)}'" : 'NULL';
     $city = isset($data['CITY']) && $data['CITY'] !== '' ? "'{$sqlHelper->forSql($data['CITY'], 128)}'" : 'NULL';
     $postalCode = isset($data['POSTAL_CODE']) && $data['POSTAL_CODE'] !== '' ? "'{$sqlHelper->forSql($data['POSTAL_CODE'], 16)}'" : 'NULL';
     $region = isset($data['REGION']) && $data['REGION'] !== '' ? "'{$sqlHelper->forSql($data['REGION'], 128)}'" : 'NULL';
     $province = isset($data['PROVINCE']) && $data['PROVINCE'] !== '' ? "'{$sqlHelper->forSql($data['PROVINCE'], 128)}'" : 'NULL';
     $country = isset($data['COUNTRY']) && $data['COUNTRY'] !== '' ? "'{$sqlHelper->forSql($data['COUNTRY'], 128)}'" : 'NULL';
     $countryCode = isset($data['COUNTRY_CODE']) && $data['COUNTRY_CODE'] !== '' ? "'{$sqlHelper->forSql($data['COUNTRY_CODE'], 100)}'" : 'NULL';
     if ($connection instanceof Main\DB\MysqlCommonConnection) {
         $connection->queryExecute("INSERT INTO b_crm_addr(ENTITY_TYPE_ID, ENTITY_ID, TYPE_ID, ADDRESS_1, ADDRESS_2, CITY, POSTAL_CODE, REGION, PROVINCE, COUNTRY, COUNTRY_CODE)\n\t\t\t\t\tVALUES({$entityTypeID}, {$entityID}, {$typeID}, {$address1}, {$address2}, {$city}, {$postalCode}, {$region}, {$province}, {$country}, {$countryCode})\n\t\t\t\t\tON DUPLICATE KEY UPDATE ADDRESS_1 = {$address1}, ADDRESS_2 = {$address2}, CITY = {$city}, POSTAL_CODE = {$postalCode}, REGION = {$region}, PROVINCE = {$province}, COUNTRY = {$country}, COUNTRY_CODE = {$countryCode}");
     } elseif ($connection instanceof Main\DB\MssqlConnection) {
         $dbResult = $connection->query("SELECT 'X' FROM b_crm_addr WHERE ENTITY_TYPE_ID = {$entityTypeID} AND ENTITY_ID = {$entityID} AND TYPE_ID = {$typeID}");
         if (is_array($dbResult->fetch())) {
             $connection->queryExecute("UPDATE b_crm_addr SET ADDRESS_1 = {$address1}, ADDRESS_2 = {$address2}, CITY = {$city}, POSTAL_CODE = {$postalCode}, REGION = {$region}, PROVINCE = {$province}, COUNTRY = {$country}, COUNTRY_CODE = {$countryCode}\n\t\t\t\t\t\tWHERE ENTITY_TYPE_ID = {$entityTypeID} AND ENTITY_ID = {$entityID} AND TYPE_ID = {$typeID}");
         } else {
             $connection->queryExecute("INSERT INTO b_crm_addr(ENTITY_TYPE_ID, ENTITY_ID, TYPE_ID, ADDRESS_1, ADDRESS_2, CITY, POSTAL_CODE, REGION, PROVINCE, COUNTRY, COUNTRY_CODE)\n\t\t\t\t\t\tVALUES({$entityTypeID}, {$entityID}, {$typeID}, {$address1}, {$address2}, {$city}, {$postalCode}, {$region}, {$province}, {$country}, {$countryCode})");
         }
     } elseif ($connection instanceof Main\DB\OracleConnection) {
         $connection->queryExecute("MERGE INTO b_crm_addr USING (SELECT {$entityTypeID} ENTITY_TYPE_ID, {$entityID} ENTITY_ID, {$typeID} TYPE_ID FROM dual)\n\t\t\t\tsource ON\n\t\t\t\t(\n\t\t\t\t\tsource.ENTITY_TYPE_ID = b_crm_addr.ENTITY_TYPE_ID\n\t\t\t\t\tAND source.ENTITY_ID = b_crm_addr.ENTITY_ID\n\t\t\t\t\tAND source.TYPE_ID = b_crm_addr.TYPE_ID\n\t\t\t\t)\n\t\t\t\tWHEN MATCHED THEN\n\t\t\t\t\tUPDATE SET b_crm_addr.ADDRESS_1 = {$address1},\n\t\t\t\t\t\tb_crm_addr.ADDRESS_2 = {$address2},\n\t\t\t\t\t\tb_crm_addr.CITY = {$city},\n\t\t\t\t\t\tb_crm_addr.POSTAL_CODE = {$postalCode},\n\t\t\t\t\t\tb_crm_addr.REGION = {$region},\n\t\t\t\t\t\tb_crm_addr.PROVINCE = {$province},\n\t\t\t\t\t\tb_crm_addr.COUNTRY = {$country},\n\t\t\t\t\t\tb_crm_addr.COUNTRY_CODE = {$countryCode}\n\t\t\t\tWHEN NOT MATCHED THEN\n\t\t\t\t\tINSERT (ENTITY_TYPE_ID, ENTITY_ID, TYPE_ID, ADDRESS_1, ADDRESS_2, CITY, POSTAL_CODE, REGION, PROVINCE, COUNTRY, COUNTRY_CODE)\n\t\t\t\t\tVALUES({$entityTypeID}, {$entityID}, {$typeID}, {$address1}, {$address2}, {$city}, {$postalCode}, {$region}, {$province}, {$country}, {$countryCode})");
     } else {
         $dbType = $connection->getType();
         throw new Main\NotSupportedException("The '{$dbType}' is not supported in current context");
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:address.php

示例7: upsert

 /**
  * @return void
  */
 public static function upsert(array $data)
 {
     $connection = Main\Application::getConnection();
     $sqlHelper = $connection->getSqlHelper();
     $srcTypeID = isset($data['SRC_TYPE_ID']) ? (int) $data['SRC_TYPE_ID'] : 0;
     $dstTypeID = isset($data['DST_TYPE_ID']) ? (int) $data['DST_TYPE_ID'] : 0;
     $dateField = new DatetimeField('D');
     $lastUpdated = $sqlHelper->convertToDb(new DateTime(), $dateField);
     $data = isset($data['DATA']) ? $sqlHelper->forSql($data['DATA']) : '';
     if ($connection instanceof Main\DB\MysqlCommonConnection) {
         $connection->queryExecute("INSERT INTO b_crm_conv_map(SRC_TYPE_ID, DST_TYPE_ID, LAST_UPDATED, DATA)\n\t\t\t\t\tVALUES({$srcTypeID}, {$dstTypeID}, {$lastUpdated}, '{$data}')\n\t\t\t\t\tON DUPLICATE KEY UPDATE LAST_UPDATED = {$lastUpdated}, DATA = '{$data}'");
     } elseif ($connection instanceof Main\DB\MssqlConnection) {
         $dbResult = $connection->query("SELECT 'X' FROM b_crm_conv_map WHERE SRC_TYPE_ID = {$srcTypeID} AND DST_TYPE_ID = {$dstTypeID}");
         if (is_array($dbResult->fetch())) {
             $connection->queryExecute("UPDATE b_crm_conv_map SET LAST_UPDATED = {$lastUpdated}, DATA = '{$data}'\n\t\t\t\t\t\tWHERE SRC_TYPE_ID = {$srcTypeID} AND DST_TYPE_ID = {$dstTypeID}");
         } else {
             $connection->queryExecute("INSERT INTO b_crm_conv_map(SRC_TYPE_ID, DST_TYPE_ID, LAST_UPDATED, DATA)\n\t\t\t\t\t\tVALUES({$srcTypeID}, {$dstTypeID}, {$lastUpdated}, '{$data}')");
         }
     } elseif ($connection instanceof Main\DB\OracleConnection) {
         $connection->queryExecute("MERGE INTO b_crm_conv_map USING (SELECT {$srcTypeID} SRC_TYPE_ID, {$dstTypeID} DST_TYPE_ID FROM dual)\n\t\t\t\tsource ON\n\t\t\t\t(\n\t\t\t\t\tsource.SRC_TYPE_ID = b_crm_conv_map.SRC_TYPE_ID\n\t\t\t\t\tAND source.DST_TYPE_ID = b_crm_conv_map.DST_TYPE_ID\n\t\t\t\t)\n\t\t\t\tWHEN MATCHED THEN\n\t\t\t\t\tUPDATE SET b_crm_conv_map.LAST_UPDATED = {$lastUpdated},\n\t\t\t\t\tb_crm_conv_map.DATA = '{$data}'\n\t\t\t\tWHEN NOT MATCHED THEN\n\t\t\t\t\tINSERT (SRC_TYPE_ID, DST_TYPE_ID, LAST_UPDATED, DATA)\n\t\t\t\t\tVALUES({$srcTypeID}, {$dstTypeID}, {$lastUpdated}, '{$data}')");
     } else {
         $dbType = $connection->getType();
         throw new Main\NotSupportedException("The '{$dbType}' is not supported in current context");
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:28,代码来源:entityconversionmap.php

示例8: getList

 /**
  * @param string $dbName
  * @return array List of all sites & their params
  */
 public static function getList($dbName = false)
 {
     if (!$dbName) {
         $connection = \Bitrix\Main\Application::getConnection();
         $dbName = $connection->getDbName();
     }
     $result = array();
     $shellAdapter = new ShellAdapter();
     $execRes = $shellAdapter->syncExec("sudo -u root /opt/webdir/bin/bx-sites -o json -a list -d " . $dbName);
     $sitesData = $shellAdapter->getLastOutput();
     if ($execRes) {
         $arData = json_decode($sitesData, true);
         if (isset($arData["params"])) {
             $result = $arData["params"];
         }
         $rsSite = \Bitrix\Main\SiteTable::getList();
         while ($site = $rsSite->fetch()) {
             foreach ($result as $siteId => $siteInfo) {
                 $docRoot = strlen($site["DOC_ROOT"]) > 0 ? $site["DOC_ROOT"] : \Bitrix\Main\Application::getDocumentRoot();
                 if ($siteInfo["DocumentRoot"] == $docRoot) {
                     $result[$siteId]["NAME"] = $site["NAME"] . " (" . $site["LID"] . ") ";
                 } else {
                     $result[$siteId]["NAME"] = $siteId;
                 }
             }
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:sitesdata.php

示例9: deleteByMapEntityId

 /**
  * Deletes all records with mapEntityId.
  * @param string $mapEntityId Map entity id.
  */
 public static function deleteByMapEntityId($mapEntityId)
 {
     $con = \Bitrix\Main\Application::getConnection();
     $sqlHelper = $con->getSqlHelper();
     $tableName = self::getTableName();
     $strSql = "DELETE FROM " . $tableName . " " . "WHERE ENTITY_ID=" . $sqlHelper->forSql($mapEntityId);
     $con->queryExecute($strSql);
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:12,代码来源:map.php

示例10: fillDescendants

 /**
  * Fills descendants simple rights by simple rights of object.
  * @internal
  * @param int $objectId Id of object.
  */
 public static function fillDescendants($objectId)
 {
     $tableName = static::getTableName();
     $pathTableName = ObjectPathTable::getTableName();
     $connection = Application::getConnection();
     $objectId = (int) $objectId;
     $connection->queryExecute("\n\t\t\tINSERT INTO {$tableName} (OBJECT_ID, ACCESS_CODE)\n\t\t\tSELECT path.OBJECT_ID, sright.ACCESS_CODE FROM {$pathTableName} path\n\t\t\t\tINNER JOIN {$tableName} sright ON sright.OBJECT_ID = path.PARENT_ID\n\t\t\tWHERE path.PARENT_ID = {$objectId}\n\t\t");
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:13,代码来源:simpleright.php

示例11: UnInstallDB

 function UnInstallDB()
 {
     Loader::includeModule($this->MODULE_ID);
     // Drop PersonTable
     Application::getConnection(\Adelshin\Person\PersonTable::getConnectionName())->queryExecute('drop table if exists ' . Base::getInstance('\\Adelshin\\Person\\PersonTable')->getDBTableName());
     // Drop GroupTable
     Application::getConnection(\Adelshin\Person\GroupsTable::getConnectionName())->queryExecute('drop table if exists ' . Base::getInstance('\\Adelshin\\Person\\GroupsTable')->getDBTableName());
     Option::delete($this->MODULE_ID);
 }
开发者ID:Orendev,项目名称:bitrx.local,代码行数:9,代码来源:index.php

示例12: deleteBatch

 /**
  * Deletes rows by filter.
  * @param array $filter Filter does not look like filter in getList. It depends by current implementation.
  * @internal
  * @return void
  */
 public static function deleteBatch(array $filter)
 {
     $tableName = static::getTableName();
     $connection = Application::getConnection();
     if (!empty($filter['ACCESS_CODE'])) {
         $accessCode = $connection->getSqlHelper()->forSql($filter['ACCESS_CODE']);
         $connection->queryExecute("DELETE FROM {$tableName} WHERE ACCESS_CODE = '{$accessCode}'");
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:15,代码来源:right.php

示例13: getActiveUsersCount

 public static function getActiveUsersCount()
 {
     $sql = "SELECT COUNT(ID) " . "FROM b_user " . "WHERE ACTIVE = 'Y' " . "   AND LAST_LOGIN IS NOT NULL";
     if (ModuleManager::isModuleInstalled("intranet")) {
         $sql = "SELECT COUNT(U.ID) " . "FROM b_user U " . "WHERE U.ACTIVE = 'Y' " . "   AND U.LAST_LOGIN IS NOT NULL " . "   AND EXISTS(" . "       SELECT 'x' " . "       FROM b_utm_user UF, b_user_field F " . "       WHERE F.ENTITY_ID = 'USER' " . "           AND F.FIELD_NAME = 'UF_DEPARTMENT' " . "           AND UF.FIELD_ID = F.ID " . "           AND UF.VALUE_ID = U.ID " . "           AND UF.VALUE_INT IS NOT NULL " . "           AND UF.VALUE_INT <> 0" . "   )";
     }
     $connection = Application::getConnection();
     return $connection->queryScalar($sql);
 }
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:9,代码来源:user.php

示例14: deleteByShipmentId

 public static function deleteByShipmentId($shipmentId)
 {
     if (intval($shipmentId) > 0) {
         $con = \Bitrix\Main\Application::getConnection();
         $sqlHelper = $con->getSqlHelper();
         $strSql = "DELETE FROM " . self::getTableName() . " WHERE SHIPMENT_ID=" . $sqlHelper->forSql($shipmentId);
         $con->queryExecute($strSql);
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:9,代码来源:shipmentextraservice.php

示例15: clean

 public static function clean()
 {
     $connection = Application::getConnection();
     $sqlHelper = $connection->getSqlHelper();
     $tableName = static::getTableName();
     $deleteBorder = $sqlHelper->addSecondsToDateTime(-static::TTL, $sqlHelper->getCurrentDateTimeFunction());
     $connection->queryExecute("DELETE FROM {$tableName} WHERE TIMESTAMP_X < {$deleteBorder}");
     return __CLASS__ . "::clean();";
 }
开发者ID:Satariall,项目名称:izurit,代码行数:9,代码来源:log.php


注:本文中的Bitrix\Main\Application::getConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。