#StackBounty: #magento-2.1 #database #upgrade #magento2.2.2 Upgrading M2.1.9 to Magento 2.2.2 is very slow

Bounty: 50

We are trying to upgrade a Magento 2.1.9 site to Magento 2.2.2
We have more than 130k products and the process seems to be stuck for more than 3 hours on

Upgrading data..
Module 'Magento_Backend':
Module 'Magento_Catalog':

I used xdebug to profile what process takes so long and apparently problem is:

if (version_compare($context->getVersion(), '2.2.2') < 0) {
            $this->upgradeWebsiteAttributes->upgrade($setup);
        }

Having many products and many attributes the process takes ages. Actually it’s still stuck there so it’s been 3 days. The database size it’s 47GB


Get this bounty!!!

#StackBounty: #magento-2.1 #database #configurable-product #stock #indexing Magento2 – index modes issue

Bounty: 200

We have this Magento 2.1 project running Production mode with “Update on save” mode for all indexes

Our customer manages catalog himself, and reported us some stock issues. Problem was changing quantity for a new product was not working. Process apparently ends fine, regarding the admin message (“Product was saved ok”) but stock was not changed. We look in Magento log files, but we don’t see any related report there

Our solution, finally, was to change indexes to “Update by schedule” and then force a reindex by console command. This solution, as far as I understand, means there is something wrong with that partial reindex fired when saving a product with “Update on save” index mode. What I am asking is for a confirmation about this… should not this problem be reported in Magento log files?

Assuming there is something wrong with our catalog data, I’d like to trace the problem, so I’d like to know which processes (the complete code trace) are fired after a product save in admin, with “Update on save” index mode. In this case, I suppose catalog_inventory ones are the most relevant

Apart from that, and checking the catalog, we’ve noticed some configurable products were sharing simple products, which is rare & we are not sure if could be the origin of the problem (although we assume system wouldn’t let to do that if that’s not allowed). Maybe this could have registered some wrong data in catalog database tables, and causing the problems with partial reindex? If that’s the case… Where can I find in database which data is pending to be processed in the next full reindex process?


Get this bounty!!!

#StackBounty: #sql-server #database #sql-server-2012 #database-replication SQL Server : Replicate Schema changes to another database

Bounty: 50

I am working on a requirement in ASP.NET Web API which needs two identical databases.

I have created two identical databases on the same server. Let’s say one is for the development and another for testing.

I want to replicate all schema (like stored procedure, view & table) changes instantly from one another database to the other.

I am not worried about the data replication, I just need to make sure both the databases have exactly the same schema definition.

I have tried generating a schema from one database and updating the other one periodically. But now, I want to replicate changes instantly to the other database. So when I update a stored procedure or view in the development database, the same changes should also be applied to the testing database immediately.

Request you to tell me if it’s possible or if there’s another approach to achieve this


Get this bounty!!!

#StackBounty: #mysql #database #postgresql How to map a table row to multiple parent rows using mapping table?

Bounty: 50

I have a master_data with all types of data such as Learning, Program and Course. Another table mapping tells you parent/child relationship.

Here is the grouping/heirarichy

Learning -> Programs -> Course

A Learning may have multiple Programs, a Program may have multiple
Courses. Also, a Program can be part of multiple Learnings and a
Course can be part of multiple Programs.

How to bring the data by keeping an extra column some thing like parent to identify a parent, so that it helps to group the rows.

Master_data

    id  title                           description type
    ----------------------------------------------------------------
    1   How to Present                  some info   Learning
    2   Securing Data                   more info   Learning
    3   Preparation plan                more info   Program
    4   Protecting System               info        Program
    5   Presentation mediums            some info   Program
    6   know the importance             some info   Course
    7   Notice the key concepts         some info   Course
    8   Presenting in PPT               some info   Course
    9   Presenting in Video format      some info   Course
    10  Update the System               some info   Course
    11  Chose a Strong password         some info   Course

Mapping

    id  learning_id  program_id      course_id
    ---------------- ----------- --------------
    1   1               3               6
    2   1               5               6
    3   1               3               7
    4   1               5               8
    5   1               5               9
    6   2               4               6
    7   2               4               10
    8   2               4               11

Result

    id  title                           description type       parent
    -------------------------------------------------------------------------
    1   How to Present                  some info   Learning   1 (itself)
    3   Preparation plan                more info   Program    1
    5   Presentation mediums            some info   Program    1
    6   know the importance             some info   Course     3 
    7   Notice the key concepts         some info   Course     3
    8   Presenting in PPT               some info   Course     5
    9   Presenting in Video format      some info   Course     5

Here, Programs 3,5 are part of learning 1. Courses 6,7 are belongs to Program 3 and 8,9 belongs to Program 5

Queries of Above in Mysql

    CREATE TABLE `master_data` (
      `id` INT NOT NULL AUTO_INCREMENT,
      `title` VARCHAR(255) NOT NULL,
      `description` TEXT NOT NULL,
      `type` VARCHAR(45) NOT NULL,
      PRIMARY KEY (`id`));


    INSERT INTO `master_data` (`id`, `title`, `description`, `type`) VALUES 
('1', 'How to Present', 'some info', 'Learning'),
('2', 'Securing Data', 'few more info', 'Learning'),
('3', 'Preparation plan', 'informatoin abt this', 'Program'),
('4', 'Protecting System', 'security info', 'Program'),
('5', 'Presentation mediums', 'some info', 'Program'),
('6', 'You should know the importance', 'some info', 'Course'),
('7', 'Notice the key concepts', 'some info', 'Course'),
('8', 'Presenting in PPT', 'some info', 'Course'),
('9', 'Presenting in Vedio format', 'some info', 'Course'),
('10', 'Update the System', 'some info', 'Course'),
('11', 'Chose a Strong password', 'some info', 'Course');


    CREATE TABLE `mapping` (
      `id` INT NOT NULL AUTO_INCREMENT,
      `learning_id` INT NOT NULL,
      `program_id` INT NOT NULL,
      `course_id` INT NOT NULL,
      PRIMARY KEY (`id`));


    INSERT INTO `mapping` (`id`, `learning_id`, `program_id`, `course_id`) VALUES 
('1', '1', '3', '6'),
('2', '1', '5', '6'),
('3', '1', '3', '7'),
('4', '1', '5', '8'),
('5', '1', '5', '9'),
('6', '2', '4', '6'),
('7', '2', '4', '10'),
('8', '2', '4', '11');


Get this bounty!!!

#StackBounty: #8 #entities #database #multi-site #testing Unit testig on multisite

Bounty: 50

I am trying to simulate a multi-site environment in an integration test with phpunit. I know how to init a new database connection with Database::addConnectionInfo but how can I cleanly switch the database used by the current environment?

Database::setActiveConnection will only work for SQL queries but I would like to use the entity_type.manager service and the only way I found is to replace the database service in the container and call KernelTest::setUp. Switching back an forth between the databases is still pretty buggy and complex.

Any ideas?


Get this bounty!!!

#StackBounty: #nginx #mysql #database #wordpress #documentroot Duplicated version of a local (WordPress) site isn't available onlin…

Bounty: 100

In my Ubuntu 16.04 Nginx environment I tried to create an online test version of a local WordPress site. The original site works fine and is accessed in HTTPS (the lock favicon is green in all pages).

My current state and problem

When I browse into my_ip_addrres/test I land on a 404 page in the original site (the local site I desire to duplicate), even though the URL remains my_ip_addrres/test. Moreover, all main menu links in that 404 page with my_ip_addrres/test URL point to the original site.

My desired end state

When I’ll navigate to my_ip_addrres/test in whatever browser, I’ll land on the duplicated version of the original site, and will operate it just as I would operate the original site, so I could go to my_ip_addrres/test/wp-admin, log in, and change that test site.

What I did so far to duplicate the original site

I basically did everything with the following bash commands. Please use these if you wish to reproduce in your end:

cd /var/www/html/
read domain # Domain of the site for duplication.
read -s rps # Password for Mysql root user.
read -s sps # Password for Mysql DB user.

cp -r ./${domain} ./test/
sed -i "s/${domain}/test"/g ./test/wp-config.php
cp -r /etc/nginx/sites-available/${domain}.conf /etc/nginx/sites-available/test.conf
sed -i "s/${domain}/test"/g /etc/nginx/sites-available/test.conf
ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled/test.conf

echo "CREATE USER 'test'@'localhost' IDENTIFIED BY "${sps}";" | mysql -u root -p"${rps}"
echo "CREATE database test;" | mysql -u root -p"${rps}"
echo "GRANT ALL PRIVILEGES ON test.* TO test@localhost;" | mysql -u root -p"${rps}"

mysqldump -u root -p"${rps}" "${domain}" > test.sql
mysql -u test -p"${sps}" test < ./test.sql

cd test 
wp search-replace "${domain}" "MY_IP_ADDRESS/test" --allow-root

Further details

1) I had about 1300 replacements in the database after running the above WP-CLI search and replace command.

2) /var/www/html/test/wp-config.php:

define('DB_NAME', 'test');
define('DB_USER', 'test');

Nginx confs

Logs:

nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

tail /var/log/nginx/error.log
tail /var/log/nginx/access.log
  • Both tails show no errors regarding /var/www/html/test/.

My question

What remains a possible cause for the test site not to go up from my_ip_addrres/test? As an Nginx newbie, I really feel I tried everything in the arsenal…


Get this bounty!!!

#StackBounty: #nginx #mysql #database #wordpress #documentroot Duplicated version of a local (WordPress) site isn't available onlin…

Bounty: 100

In my Ubuntu 16.04 Nginx environment I tried to create an online test version of a local WordPress site. The original site works fine and is accessed in HTTPS (the lock favicon is green in all pages).

My current state and problem

When I browse into my_ip_addrres/test I land on a 404 page in the original site (the local site I desire to duplicate), even though the URL remains my_ip_addrres/test. Moreover, all main menu links in that 404 page with my_ip_addrres/test URL point to the original site.

My desired end state

When I’ll navigate to my_ip_addrres/test in whatever browser, I’ll land on the duplicated version of the original site, and will operate it just as I would operate the original site, so I could go to my_ip_addrres/test/wp-admin, log in, and change that test site.

What I did so far to duplicate the original site

I basically did everything with the following bash commands. Please use these if you wish to reproduce in your end:

cd /var/www/html/
read domain # Domain of the site for duplication.
read -s rps # Password for Mysql root user.
read -s sps # Password for Mysql DB user.

cp -r ./${domain} ./test/
sed -i "s/${domain}/test"/g ./test/wp-config.php
cp -r /etc/nginx/sites-available/${domain}.conf /etc/nginx/sites-available/test.conf
sed -i "s/${domain}/test"/g /etc/nginx/sites-available/test.conf
ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled/test.conf

echo "CREATE USER 'test'@'localhost' IDENTIFIED BY "${sps}";" | mysql -u root -p"${rps}"
echo "CREATE database test;" | mysql -u root -p"${rps}"
echo "GRANT ALL PRIVILEGES ON test.* TO test@localhost;" | mysql -u root -p"${rps}"

mysqldump -u root -p"${rps}" "${domain}" > test.sql
mysql -u test -p"${sps}" test < ./test.sql

cd test 
wp search-replace "${domain}" "MY_IP_ADDRESS/test" --allow-root

Further details

1) I had about 1300 replacements in the database after running the above WP-CLI search and replace command.

2) /var/www/html/test/wp-config.php:

define('DB_NAME', 'test');
define('DB_USER', 'test');

Nginx confs

Logs:

nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

tail /var/log/nginx/error.log
tail /var/log/nginx/access.log
  • Both tails show no errors regarding /var/www/html/test/.

My question

What remains a possible cause for the test site not to go up from my_ip_addrres/test? As an Nginx newbie, I really feel I tried everything in the arsenal…


Get this bounty!!!

#StackBounty: #nginx #mysql #database #wordpress #documentroot Duplicated version of a local (WordPress) site isn't available onlin…

Bounty: 100

In my Ubuntu 16.04 Nginx environment I tried to create an online test version of a local WordPress site. The original site works fine and is accessed in HTTPS (the lock favicon is green in all pages).

My current state and problem

When I browse into my_ip_addrres/test I land on a 404 page in the original site (the local site I desire to duplicate), even though the URL remains my_ip_addrres/test. Moreover, all main menu links in that 404 page with my_ip_addrres/test URL point to the original site.

My desired end state

When I’ll navigate to my_ip_addrres/test in whatever browser, I’ll land on the duplicated version of the original site, and will operate it just as I would operate the original site, so I could go to my_ip_addrres/test/wp-admin, log in, and change that test site.

What I did so far to duplicate the original site

I basically did everything with the following bash commands. Please use these if you wish to reproduce in your end:

cd /var/www/html/
read domain # Domain of the site for duplication.
read -s rps # Password for Mysql root user.
read -s sps # Password for Mysql DB user.

cp -r ./${domain} ./test/
sed -i "s/${domain}/test"/g ./test/wp-config.php
cp -r /etc/nginx/sites-available/${domain}.conf /etc/nginx/sites-available/test.conf
sed -i "s/${domain}/test"/g /etc/nginx/sites-available/test.conf
ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled/test.conf

echo "CREATE USER 'test'@'localhost' IDENTIFIED BY "${sps}";" | mysql -u root -p"${rps}"
echo "CREATE database test;" | mysql -u root -p"${rps}"
echo "GRANT ALL PRIVILEGES ON test.* TO test@localhost;" | mysql -u root -p"${rps}"

mysqldump -u root -p"${rps}" "${domain}" > test.sql
mysql -u test -p"${sps}" test < ./test.sql

cd test 
wp search-replace "${domain}" "MY_IP_ADDRESS/test" --allow-root

Further details

1) I had about 1300 replacements in the database after running the above WP-CLI search and replace command.

2) /var/www/html/test/wp-config.php:

define('DB_NAME', 'test');
define('DB_USER', 'test');

Nginx confs

Logs:

nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

tail /var/log/nginx/error.log
tail /var/log/nginx/access.log
  • Both tails show no errors regarding /var/www/html/test/.

My question

What remains a possible cause for the test site not to go up from my_ip_addrres/test? As an Nginx newbie, I really feel I tried everything in the arsenal…


Get this bounty!!!

#StackBounty: #nginx #mysql #database #wordpress #documentroot Duplicated version of a local (WordPress) site isn't available onlin…

Bounty: 100

In my Ubuntu 16.04 Nginx environment I tried to create an online test version of a local WordPress site. The original site works fine and is accessed in HTTPS (the lock favicon is green in all pages).

My current state and problem

When I browse into my_ip_addrres/test I land on a 404 page in the original site (the local site I desire to duplicate), even though the URL remains my_ip_addrres/test. Moreover, all main menu links in that 404 page with my_ip_addrres/test URL point to the original site.

My desired end state

When I’ll navigate to my_ip_addrres/test in whatever browser, I’ll land on the duplicated version of the original site, and will operate it just as I would operate the original site, so I could go to my_ip_addrres/test/wp-admin, log in, and change that test site.

What I did so far to duplicate the original site

I basically did everything with the following bash commands. Please use these if you wish to reproduce in your end:

cd /var/www/html/
read domain # Domain of the site for duplication.
read -s rps # Password for Mysql root user.
read -s sps # Password for Mysql DB user.

cp -r ./${domain} ./test/
sed -i "s/${domain}/test"/g ./test/wp-config.php
cp -r /etc/nginx/sites-available/${domain}.conf /etc/nginx/sites-available/test.conf
sed -i "s/${domain}/test"/g /etc/nginx/sites-available/test.conf
ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled/test.conf

echo "CREATE USER 'test'@'localhost' IDENTIFIED BY "${sps}";" | mysql -u root -p"${rps}"
echo "CREATE database test;" | mysql -u root -p"${rps}"
echo "GRANT ALL PRIVILEGES ON test.* TO test@localhost;" | mysql -u root -p"${rps}"

mysqldump -u root -p"${rps}" "${domain}" > test.sql
mysql -u test -p"${sps}" test < ./test.sql

cd test 
wp search-replace "${domain}" "MY_IP_ADDRESS/test" --allow-root

Further details

1) I had about 1300 replacements in the database after running the above WP-CLI search and replace command.

2) /var/www/html/test/wp-config.php:

define('DB_NAME', 'test');
define('DB_USER', 'test');

Nginx confs

Logs:

nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

tail /var/log/nginx/error.log
tail /var/log/nginx/access.log
  • Both tails show no errors regarding /var/www/html/test/.

My question

What remains a possible cause for the test site not to go up from my_ip_addrres/test? As an Nginx newbie, I really feel I tried everything in the arsenal…


Get this bounty!!!

#StackBounty: #nginx #mysql #database #wordpress #documentroot Duplicated version of a local (WordPress) site isn't available onlin…

Bounty: 100

In my Ubuntu 16.04 Nginx environment I tried to create an online test version of a local WordPress site. The original site works fine and is accessed in HTTPS (the lock favicon is green in all pages).

My current state and problem

When I browse into my_ip_addrres/test I land on a 404 page in the original site (the local site I desire to duplicate), even though the URL remains my_ip_addrres/test. Moreover, all main menu links in that 404 page with my_ip_addrres/test URL point to the original site.

My desired end state

When I’ll navigate to my_ip_addrres/test in whatever browser, I’ll land on the duplicated version of the original site, and will operate it just as I would operate the original site, so I could go to my_ip_addrres/test/wp-admin, log in, and change that test site.

What I did so far to duplicate the original site

I basically did everything with the following bash commands. Please use these if you wish to reproduce in your end:

cd /var/www/html/
read domain # Domain of the site for duplication.
read -s rps # Password for Mysql root user.
read -s sps # Password for Mysql DB user.

cp -r ./${domain} ./test/
sed -i "s/${domain}/test"/g ./test/wp-config.php
cp -r /etc/nginx/sites-available/${domain}.conf /etc/nginx/sites-available/test.conf
sed -i "s/${domain}/test"/g /etc/nginx/sites-available/test.conf
ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled/test.conf

echo "CREATE USER 'test'@'localhost' IDENTIFIED BY "${sps}";" | mysql -u root -p"${rps}"
echo "CREATE database test;" | mysql -u root -p"${rps}"
echo "GRANT ALL PRIVILEGES ON test.* TO test@localhost;" | mysql -u root -p"${rps}"

mysqldump -u root -p"${rps}" "${domain}" > test.sql
mysql -u test -p"${sps}" test < ./test.sql

cd test 
wp search-replace "${domain}" "MY_IP_ADDRESS/test" --allow-root

Further details

1) I had about 1300 replacements in the database after running the above WP-CLI search and replace command.

2) /var/www/html/test/wp-config.php:

define('DB_NAME', 'test');
define('DB_USER', 'test');

Nginx confs

Logs:

nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

tail /var/log/nginx/error.log
tail /var/log/nginx/access.log
  • Both tails show no errors regarding /var/www/html/test/.

My question

What remains a possible cause for the test site not to go up from my_ip_addrres/test? As an Nginx newbie, I really feel I tried everything in the arsenal…


Get this bounty!!!