/home/bitrix/www/bitrix/modules/main/lib/db/mysqlcommonconnection.php
$res = $this->query("SHOW VARIABLES LIKE 'max_allowed_packet'")->fetch();
if ($res['Variable_name'] == 'max_allowed_packet')
{
$mtu = intval($res['Value']);
}
}
return $mtu;
}
/**
* @inheritdoc
*/
public function createQueryException($code = 0, $databaseMessage = '', $query = '')
{
if ($code == 1062)
{
return new DuplicateEntryException('Mysql query error', $databaseMessage, $query);
}
return new SqlQueryException('Mysql query error', $databaseMessage, $query);
}
}
Arguments
"Mysql query error: (1114) The table 'b_composite_page' is full"
/home/bitrix/www/bitrix/modules/main/lib/db/mysqliconnection.php
*********************************************************/
/**
* @inheritDoc
*/
protected function queryInternal($sql, array $binds = null, Diag\SqlTrackerQuery $trackerQuery = null)
{
$this->connectInternal();
$trackerQuery?->startQuery($sql, $binds);
$result = $this->resource->query($sql);
$trackerQuery?->finishQuery();
$this->lastQueryResult = $result;
if (!$result)
{
throw $this->createQueryException($this->getErrorCode(), $this->getErrorMessage(), $sql);
}
return $result;
}
/**
* @inheritDoc
*/
protected function createResult($result, Diag\SqlTrackerQuery $trackerQuery = null)
{
return new MysqliResult($result, $this, $trackerQuery);
}
/**
* @inheritDoc
*/
public function getInsertedId()
{
return $this->getResource()->insert_id;
}
/home/bitrix/www/bitrix/modules/main/lib/db/connection.php
$sql = $this->getSqlHelper()->getTopSql($sql, $limit, $offset);
}
$trackerQuery = null;
if ($this->queryExecutingEnabled)
{
$connection = Main\Application::getInstance()->getConnectionPool()->getSlaveConnection($sql);
if ($connection === null)
{
$connection = $this;
}
if ($this->trackSql)
{
$trackerQuery = $this->sqlTracker->getNewTrackerQuery();
$trackerQuery->setNode($connection->getNodeId());
}
$result = $connection->queryInternal($sql, $binds, $trackerQuery);
}
else
{
if ($this->disabledQueryExecutingDump === null)
{
$this->disabledQueryExecutingDump = [];
}
$this->disabledQueryExecutingDump[] = $sql;
$result = true;
}
return $this->createResult($result, $trackerQuery);
}
/**
* Executes a query, fetches a row and returns single field value
* from the first column of the result.
*
* @param string $sql Sql text.
/home/bitrix/www/bitrix/modules/main/lib/db/connection.php
if ($row = $result->fetch())
{
return array_shift($row);
}
return null;
}
/**
* Executes a query without returning result, i.e. INSERT, UPDATE, DELETE
*
* @param string $sql Sql text.
* @param array|null $binds Binding array.
*
* @return void
* @throws SqlQueryException
*/
public function queryExecute($sql, array $binds = null)
{
$this->query($sql, $binds);
}
/**
* Helper function for parameters handling.
*
* @param mixed $args Variable list of parameters.
*
* @return array
* @throws ArgumentNullException
*/
protected static function parseQueryFunctionArgs($args)
{
/*
* query($sql)
* query($sql, $limit)
* query($sql, $offset, $limit)
* query($sql, $arBinds)
* query($sql, $arBinds, $limit)
* query($sql, $arBinds, $offset, $limit)
*/
/home/bitrix/www/bitrix/modules/main/lib/db/connection.php
* Adds row to table and returns ID of the added row.
* <p>
* $identity parameter must be null when table does not have autoincrement column.
*
* @param string $tableName Name of the table for insertion of new row.
* @param array $data Array of columnName => Value pairs.
* @param string $identity For Oracle only.
*
* @return integer
* @throws SqlQueryException
*/
public function add($tableName, array $data, $identity = "ID")
{
$insert = $this->getSqlHelper()->prepareInsert($tableName, $data);
$sql =
"INSERT INTO " . $this->getSqlHelper()->quote($tableName) . "(" . $insert[0] . ") " .
"VALUES (" . $insert[1] . ")";
$this->queryExecute($sql);
return $this->getInsertedId();
}
/**
* @param string $tableName
* @param array $rows
* @param string $identity
*
* @return int
* @throws SqlQueryException
*/
public function addMulti($tableName, $rows, $identity = "ID")
{
$uniqueColumns = [];
$inserts = [];
// prepare data
foreach ($rows as $data)
{
/home/bitrix/www/bitrix/modules/main/lib/orm/data/addstrategy/insert.php
use Bitrix\Main\ORM\Entity;
final class Insert implements AddStrategy
{
public function __construct(
private readonly Entity $entity,
)
{
}
public function add(array $dbFields): AddedData
{
// save data
$connection = $this->entity->getConnection();
$tableName = $this->entity->getDBTableName();
$identity = $this->entity->getAutoIncrement();
/** @noinspection PhpCastIsUnnecessaryInspection - typehints are lying */
$id = (int)$connection->add($tableName, $dbFields, $identity);
return new AddedData($id);
}
public function addMulti(array $multiDbFields): AddedMultiData
{
$connection = $this->entity->getConnection();
$tableName = $this->entity->getDBTableName();
$identity = $this->entity->getAutoIncrement();
$connection->addMulti($tableName, $multiDbFields, $identity);
return new AddedMultiData();
}
}
/home/bitrix/www/bitrix/modules/main/lib/orm/data/datamanager.php
{
//event on adding
self::callOnAddEvent($object, $fields, $ufdata);
}
// use save modifiers
$fieldsToDb = $fields;
foreach ($fieldsToDb as $fieldName => $value)
{
$field = $entity->getField($fieldName);
if ($field->isPrimary() && $field->isAutocomplete() && is_null($value))
{
unset($fieldsToDb[$fieldName]); // postgresql compatibility
continue;
}
$fieldsToDb[$fieldName] = $field->modifyValueBeforeSave($value, $fields);
}
$addedData = $strategy->add(static::replaceFieldName($fieldsToDb));
$id = $addedData->id;
// build standard primary
$primary = null;
$isGuessedPrimary = false;
if (!empty($id))
{
if (!empty($entity->getAutoIncrement()))
{
$primary = [$entity->getAutoIncrement() => $id];
static::normalizePrimary($primary);
}
else
{
// for those who did not set 'autocomplete' flag but wants to get id from result
$primary = ['ID' => $id];
$isGuessedPrimary = true;
}
}
/home/bitrix/www/bitrix/modules/main/lib/orm/data/datamanager.php
*
* @param array $data An array with fields like
* array(
* "fields" => array(
* "FIELD1" => "value1",
* "FIELD2" => "value2",
* ),
* "auth_context" => \Bitrix\Main\Authentication\Context object
* )
* or just a plain array of fields.
*
* This method uses the default strategy defined in the class.
*
* @return AddResult Contains ID of inserted row
*
* @throws \Exception
*/
public static function add(array $data)
{
return self::sysAddInternal(static::getAddStrategy(), $data);
}
/**
* @internal For internal system usage only.
*/
final protected static function sysAddInternal(
AddStrategy $strategy,
array $data,
bool $ignoreEvents = false,
): AddResult
{
global $USER_FIELD_MANAGER;
// compatibility
$fields = $data;
// prepare entity object for compatibility with new code
$object = static::convertArrayToObject($fields, true);
$entity = static::getEntity();
/home/bitrix/www/bitrix/modules/main/lib/composite/internals/pagemanager.php
$result = null;
if ($page)
{
$data["LAST_VIEWED"] = new DateTime();
$data["VIEWS"] = $page["VIEWS"] + 1;
if (isset($params["CHANGED"]) && $params["CHANGED"] === true)
{
$data["CHANGED"] = new DateTime();
$data["REWRITES"] = $page["REWRITES"] + 1;
$data["SIZE"] = $pageSize;
}
$result = PageTable::update($page["ID"], $data);
}
else
{
$data["SIZE"] = $pageSize;
$data["CACHE_KEY"] = $cacheKey;
$result = PageTable::add($data);
}
$GLOBALS["DB"]->StopUsingMasterOnly();
return $result !== null ? $result->getId() : null;
}
public static function getByCacheKey($cacheKey)
{
$records = PageTable::getList(array(
"filter" => array(
"=CACHE_KEY" => $cacheKey
),
"order" => array(
"ID" => "ASC"
)
));
$result = null;
while ($record = $records->fetch())
/home/bitrix/www/bitrix/modules/main/lib/composite/engine.php
self::ensureFileQuota($freeSpace);
}
$success = $page->write($dividedData["static"], $dividedData["md5"]);
if ($success)
{
$htmlCacheChanged = true;
$page->setUserPrivateKey();
}
Locker::unlock($page->getCacheKey());
}
}
$pageId = PageManager::register(
$page->getCacheKey(),
array(
"CHANGED" => $htmlCacheChanged,
"SIZE" => $page->getSize()
)
);
if ($oldContent !== null)
{
Logger::log(
array(
"TYPE" => Logger::TYPE_CACHE_REWRITING,
"MESSAGE" => $oldContent,
"PAGE_ID" => $pageId
)
);
}
}
else
{
$page->delete();
return self::getAjaxError();
}
/home/bitrix/www/bitrix/modules/main/lib/composite/engine.php
if (self::isAjaxRequest() && self::$isRedirect === false)
{
$originalContent = self::getAjaxError();
Page::getInstance()->delete();
return true;
}
return false;
}
if (function_exists("getmoduleevents"))
{
foreach (GetModuleEvents("main", "OnEndBufferContent", true) as $arEvent)
{
ExecuteModuleEventEx($arEvent, array(&$compositeContent));
}
}
$compositeContent = self::processPageContent($compositeContent);
if (self::isAjaxRequest() || self::getUseAppCache())
{
$originalContent = $compositeContent;
return true;
}
return false;
}
/**
* * There are two variants of content's modification in this method.
* The first one:
* If it's ajax-hit the content will be replaced by json data with dynamic blocks,
* javascript files and etc. - dynamic part
*
* The second one:
* If it's simple hit the content will be modified also,
* all dynamic blocks will be cut out of the content - static part.
*
/home/bitrix/www/bitrix/modules/main/classes/general/main.php
{
$cnt = count($this->buffer_content_type);
for ($i = 0; $i < $cnt; $i++)
{
$this->buffer_content[$i * 2 + 1] = call_user_func_array($this->buffer_content_type[$i]["F"], $this->buffer_content_type[$i]["P"]);
}
}
$compositeContent = Composite\Engine::startBuffering($content);
$content = implode("", $this->buffer_content) . $content;
if (function_exists("getmoduleevents"))
{
foreach (GetModuleEvents("main", "OnEndBufferContent", true) as $arEvent)
{
ExecuteModuleEventEx($arEvent, [&$content]);
}
}
$wasContentModified = Composite\Engine::endBuffering($content, $compositeContent);
if (!$wasContentModified && $asset->canMoveJsToBody())
{
$asset->moveJsToBody($content);
}
return $content;
}
public function ResetException()
{
if ($this->LAST_ERROR)
{
$this->ERROR_STACK[] = $this->LAST_ERROR;
}
$this->LAST_ERROR = false;
}
public function ThrowException($msg, $id = false)
{
$this->ResetException();
/home/bitrix/www/bitrix/modules/main/classes/general/main.php
public function &EndBufferContentMan()
{
$res = null;
if (!$this->buffered)
{
return $res;
}
$content = ob_get_contents();
$this->buffer_man = true;
ob_end_clean();
$this->buffered = false;
$this->buffer_man = false;
$this->buffer_manual = true;
$res = $this->EndBufferContent($content);
$this->buffer_manual = false;
$this->buffer_content_type = [];
$this->buffer_content = [];
return $res;
}
public function EndBufferContent($content = "")
{
if ($this->buffer_man)
{
$this->auto_buffer_cleaned = true;
return "";
}
Composite\Engine::checkAdminPanel();
if (function_exists("getmoduleevents"))
{
/home/bitrix/www/bitrix/modules/main/include/epilog_after.php
{
$bShowTime = isset(\Bitrix\Main\Application::getInstance()->getKernelSession()["SESS_SHOW_TIME_EXEC"]) && (\Bitrix\Main\Application::getInstance()->getKernelSession()["SESS_SHOW_TIME_EXEC"] == 'Y');
$bShowStat = ($DB->ShowSqlStat && ($canEditPHP || \Bitrix\Main\Application::getInstance()->getKernelSession()["SHOW_SQL_STAT"]=="Y"));
$bShowCacheStat = (\Bitrix\Main\Data\Cache::getShowCacheStat() && ($canEditPHP || \Bitrix\Main\Application::getInstance()->getKernelSession()["SHOW_CACHE_STAT"]=="Y"));
if(($bShowStat || $bShowCacheStat) && !$USER->IsAuthorized())
{
require_once($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/interface/init_admin.php");
$GLOBALS["APPLICATION"]->AddHeadString($GLOBALS["adminPage"]->ShowScript());
$GLOBALS["APPLICATION"]->AddHeadString('<script src="/bitrix/js/main/public_tools.js"></script>');
$GLOBALS["APPLICATION"]->AddHeadString('<link rel="stylesheet" type="text/css" href="/bitrix/themes/.default/pubstyles.css" />');
}
if($bShowTime || $bShowStat || $bShowCacheStat)
{
CUtil::InitJSCore(array('window', 'admin'));
}
}
$buffer = $APPLICATION->EndBufferContentMan();
//used in debug_info.php
$main_exec_time = round(microtime(true) - START_EXEC_TIME, 4);
if(!defined('PUBLIC_AJAX_MODE') && (($_REQUEST["mode"] ?? '') != 'excel'))
{
if($bShowTime || $bShowStat || $bShowCacheStat)
{
ob_start();
include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/interface/debug_info.php");
$buffer .= ob_get_clean();
}
}
CMain::FinalActions($buffer);
/home/bitrix/www/bitrix/modules/main/include/epilog.php
<?
require($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/include/epilog_before.php");
require($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/include/epilog_after.php");
?>
Arguments
"/home/bitrix/www/bitrix/modules/main/include/epilog_after.php"
/home/bitrix/www/bitrix/footer.php
<?
if(defined("B_PROLOG_INCLUDED") && B_PROLOG_INCLUDED===true)
{
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog.php");
}
?>
Arguments
"/home/bitrix/www/bitrix/modules/main/include/epilog.php"
/home/bitrix/www/catalog/equipment/index.php
"MOBILE_VIEW_MINIMAL" => "ADMIN",
"STORES_MAP" => "YANDEX",
"SECTIONS_ROOT_VIEW" => "1",
"CURRENCY_ID" => "RUB",
"SEF_URL_TEMPLATES" => array(
"sections" => "/catalog/equipment/",
"section" => "#SECTION_CODE_PATH#/",
"element" => "#SECTION_CODE_PATH#/?el=#ELEMENT_ID#",
"compare" => "compare/",
"smart_filter" => "#SECTION_CODE_PATH#/filter/#SMART_FILTER_PATH#/apply/",
),
"VARIABLE_ALIASES" => array(
"element" => array(
"ELEMENT_ID" => "el",
),
)
),
false
);
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");
?>
Arguments
"/home/bitrix/www/bitrix/footer.php"
/home/bitrix/www/bitrix/modules/main/include/urlrewrite.php
}
$ext = strtolower(GetFileExtension($url));
if ($ext != "php")
{
continue;
}
// D7 response is not available here
if (stristr(php_sapi_name(), "cgi") !== false && (!defined("BX_HTTP_STATUS") || !BX_HTTP_STATUS))
{
header("Status: 200 OK");
}
else
{
header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
}
$_SERVER["REAL_FILE_PATH"] = $url;
include_once $io->GetPhysicalName($_SERVER['DOCUMENT_ROOT'] . $url);
die();
}
}
}
//admin section 404
if (str_starts_with($requestUri, "/bitrix/admin/"))
{
$_SERVER["REAL_FILE_PATH"] = "/bitrix/admin/404.php";
include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/admin/404.php";
die();
}
define("BX_CHECK_SHORT_URI", true);
Arguments
"/home/bitrix/www/catalog/equipment/index.php"
/home/bitrix/www/bitrix/urlrewrite.php
<?
include_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/urlrewrite.php');
if(file_exists($_SERVER['DOCUMENT_ROOT'].'/404.php'))
include_once($_SERVER['DOCUMENT_ROOT'].'/404.php');
?>
Arguments
"/home/bitrix/www/bitrix/modules/main/include/urlrewrite.php"