Skip to content

Instantly share code, notes, and snippets.

View genakim's full-sized avatar

Gennadiy Kim genakim

  • Uzbekistan, Tashkent city
View GitHub Profile
@genakim
genakim / foldersize.php
Created June 28, 2021 06:03 — forked from eusonlito/foldersize.php
PHP function to get the folder size including subfolders
<?php
function folderSize ($dir)
{
$size = 0;
foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {
$size += is_file($each) ? filesize($each) : folderSize($each);
}
diff --git a/app/addons/commerceml/schemas/cml/settings.php b/app/addons/commerceml/schemas/cml/settings.php
index 6eb8da9bcf..85c33d973d 100644
--- a/app/addons/commerceml/schemas/cml/settings.php
+++ b/app/addons/commerceml/schemas/cml/settings.php
@@ -109,10 +109,6 @@ $schema = [
'type' => 'bool',
'default' => true,
],
- 'catalog_importer.hide_out_of_stock_products' => [
- 'type' => 'bool',
<?php
/***************************************************************************
* *
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
diff --git a/app/schemas/permissions/vendor_multivendor.php b/app/schemas/permissions/vendor_multivendor.php
index 413d162027..878972cd81 100644
--- a/app/schemas/permissions/vendor_multivendor.php
+++ b/app/schemas/permissions/vendor_multivendor.php
@@ -349,6 +349,7 @@ $schema = [
'products' => true,
'translations' => false,
'users' => false,
+ 'states' => false,
],
diff --git a/app/functions/fn.features.php b/app/functions/fn.features.php
index b06227e6b9..31b49f1714 100644
--- a/app/functions/fn.features.php
+++ b/app/functions/fn.features.php
@@ -185,7 +185,19 @@ function fn_update_product_features_value($product_id, $product_features, $add_n
)
) {
$value = empty($value) ? [] : $value;
- $value[] = fn_update_product_feature_variant($feature_id, $feature_type, $add_new_variant[$feature_id], $lang_code);
+ $variant = $add_new_variant[$feature_id]['variant'];
@genakim
genakim / phpbrew-config.md
Created December 22, 2020 08:43 — forked from goodjack/phpbrew-config.md
How to use switch PHP(using phpbrew) version in nginx config
php -v
PHP 5.6.3 (cli) (built: Oct 28 2015 09:47:41)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

But this only changes in CLI. You have to tweak you nginx(same for apache) to make it works. Nginx will still using the native PHP-FPM.

> ps aux | grep php-fpm
@genakim
genakim / install-nginx-with-phpbrew.sh
Created December 22, 2020 08:43 — forked from abenevaut/# Install nginx & phpbrew 7.3.10.md
Install brew nginx with phpbrew php-fpm 7.3.10 on macOS (this installation allows to run nginx and php-fpm (from phpbrew) as root but chrooted with the current user - take care if there is multiple developper account on mac, that will potentially make trouble between accounts).
// First follow https://gist.github.com/abenevaut/fd21704ead845e5bc14ca93fa8d0a18f but modify the line 17 like follow
// add +fpm to compile php-fpm
phpbrew --debug install php-7.3.10 +gd +default +sqlite +mysql +fpm +bz2=/usr/local/Cellar/bzip2/1.0.6_1/ +zlib=/usr/local/Cellar/zlib/1.2.11/ -- --with-gd=shared
brew install nginx
sudo emacs /usr/local/etc/nginx/nginx.conf
sudo emacs /Users/YOUR_MACOS_USERNAME/.phpbrew/php/php-7.1.29/etc/php-fpm.d/www.conf
// In previous config files, we set user and group to run nginx and php-fpm as setted user and user group (logic)..
@genakim
genakim / paginate.js
Last active June 9, 2020 15:58
Логика пагинации (laravel + vuejs)
this.pages = [];
const pages = 5;
const currentPage = this.data.current_page;
const totalPages = this.data.last_page;
const offSide = Math.floor(pages / 2);
// первая страница
let startPage = currentPage - offSide;
if (startPage <= 1) {
startPage = 1;
@genakim
genakim / builder.php
Created May 22, 2020 04:47 — forked from ollieread/builder.php
Laravel query builder recursive CTE support
<?php
$recursive = $this->query()
->recursive('parents', function (Builder $query) {
$query
->select([
'*',
new Alias('slug', 'fullslug'),
new Alias(0, 'depth'),
new Alias('id', 'tree_id'),
new Alias('name', 'path'),
@genakim
genakim / function.sql
Created May 12, 2020 19:36
Пример функции MySQL
create
definer = root@`::1` function updatePublicWorksDate(serviceLogId int, date date, dateId varchar(255)) returns date
BEGIN
IF (dateId = 'REFERRAL_DATE') THEN
UPDATE m_service_public_works mspw
SET mspw.REFERRAL_DATE = date
WHERE mspw.SERVICE_LOG_ID = serviceLogId;
END IF;