This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-Type: text/html; charset=utf-8'); | |
ini_set('display_errors',1); | |
ini_set('display_startup_errors',1); | |
error_reporting(-1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* ################################ | |
* ## Page ## | |
* ################################ | |
*/ | |
$isAdminSection = function() { | |
$requestedDir = \Bitrix\Main\Context::getCurrent()->getRequest()->getRequestedPageDirectory(); | |
return (substr($requestedDir, 0, strlen("/bitrix/admin/")) == "/bitrix/admin/" | |
|| substr($requestedDir, 0, strlen("/bitrix/updates/")) == "/bitrix/updates/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// === deferred реьд идщсл | |
// in template | |
$this->SetViewTarget('name_block'); | |
// html | |
$this->EndViewTarget(); | |
$APPLICATION->ShowViewContent('name_block'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# все файлы с датой изменения отсортированные по убыванию | |
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort -r | more | |
# размеры папок и файлов в текущей дериктории отсиртированные по размеру | |
du -s -B M * | sort -h | |
# список файлов в дериктории с правами доступа | |
ln -l | |
# поиск файлов размером болье 100М |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Плюс 24 часа к сейчас | |
$dateYestarday = (new \DateTime())->add(new \DateInterval('P1D'))->format('Y-m-d H:i:s'); | |
// Завтрашнее число время 00:00:00 | |
$dateYestarday = (\DateTime('tomorrow'))->format('Y-m-d H:i:s'); | |
// Год назад | |
$yearBack = (new \DateTime())->modify('1 year ago'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- При работе с breakpoints xdebug через 64 секунды (в моей версии) происходит обрыв соединения. | |
Используются разные версии PHP для разных хостов (PHP - Mode - Individual PHP version for every host (CGI). | |
Для увеличения времени timeout нужно изменить дериктиву FcgidIOTimeout модуля fcgid_module: | |
- Открываем шаблно настроек Apache (File - Edit template - Apache - httpd.conf) | |
- Сразу за строкой "MAMP_FastCgiServer_MAMP" добавляем "FcgidIOTimeout 600" (чтобы соединение не рвалось 600 секунд) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# если при обновлении через git composer файлов ошибка autoload, то может помочь запуск непосредственно на сервере | |
composer dumpautoload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Меню имеет встроенной внутренний кеш, см. bitrix/modules/main/classes/general/menu.php:192 | |
`$bCacheIsAllowed = CACHED_menu!==false && !$USER->IsAuthorized() && $this->MenuExtDir == '';` | |
В кеш сохраняются значения LINK, LINKS, PERM | |
Это единственное место использования CACHED_menu, и самое тяжелое что там есть - права доступа к файлу | |
Т.е. получаем что CACHED_menu - это кеш меню для неавторизованного пользователя, для экономии на получении | |
прав доступа. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### use blank image instead of missing picture | |
# | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f | |
RewriteRule \.(gif|jpe?g|png|bmp) /local/images/blank.gif [NC,L] | |
### Redirect to https | |
# | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |