Skip to content

Instantly share code, notes, and snippets.

@Mausglov
Created March 30, 2014 21:13
Show Gist options
  • Save Mausglov/9879902 to your computer and use it in GitHub Desktop.
Save Mausglov/9879902 to your computer and use it in GitHub Desktop.
бутстрап для любых консольных скриптов под Битрикс
<?php
/**
* бутстрап для любых консольных скриптов под Битрикс
*/
define("LANG", "ru");
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
define("BX_BUFFER_USED", true);
// это отключает исполнение агентов
define("BX_CLUSTER_GROUP", 2);
$_SERVER["DOCUMENT_ROOT"] = "set path here";
chdir($_SERVER["DOCUMENT_ROOT"]);
// windows workaround
if ( strpos($_SERVER["DOCUMENT_ROOT"], '\\') !== false ) {
$_SERVER["DOCUMENT_ROOT"] = str_replace('\\', '/', substr( $_SERVER["DOCUMENT_ROOT"], 2 ));
}
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
while (ob_get_level()) {
ob_end_flush();
}
// include all needful modules
CModule::IncludeModule("iblock") or die();
CModule::IncludeModule("catalog") or die();
CModule::IncludeModule("sale") or die();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment