PHPCS validation:
vendor/bin/phpcs --standard=Magento2 [path/to/folder]
PHPMD validation:
PHPCS validation:
vendor/bin/phpcs --standard=Magento2 [path/to/folder]
PHPMD validation:
| /* | |
| * @path vendor/magento/module-checkout/Controller/Onepage/Success.php | |
| * @function execute() | |
| */ | |
| ... | |
| /** | |
| * Order success action | |
| * |
After migrating a Wordpress site to a new host, you would need to change the URLs in the various MySQL database tables.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.oldurl', 'http://www.newurl');
There are many ways to add custom JS in Magento 2.
Magento 2 uses RequireJS and Knockout.js libraries to solve the page speed and manage the JS dependency.
The custom JS files should be placed in the following locations:
- view/[area]/web/js/
- [theme]/[module]/web/js/
- [theme]/web/js/
| ... | |
| <div class="container"> | |
| <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc lacinia et elit quis vehicula. Praesent fermentum finibus felis, vitae tristique lorem fringilla nec.</p> | |
| </div> | |
| ... |
composer config repositories.[vendor] artifact repo/[vendor]/
composer require ...
| /* | |
| * $path vendor/magento/framework/DB/Adapter/SqlVersionProvider.php | |
| * $function getVersionString(string $resource) | |
| */ | |
| ... | |
| $pattern = sprintf('/(%s)/', implode('|', $this->supportedVersionPatterns)); | |
| - $sqlVersionOutput = $this->fetchSqlVersion($resource); | |
| + $sqlVersionOutput = '10.2.37-MariaDB'; | |
| preg_match($pattern, $sqlVersionOutput, $match); |
Delete a branch locally:
git branch -d [branch-name]
Delete a branch remotely:
git push origin --delete [branch-name]
Run the following command in the terminal:
find -type f -mtime -[count_of_days] -ls
Sometimes when you try to run a database import, you encounter an error like the following:
ERROR 1227 (42000) at line XXXX: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
This means that there are DEFINER statements in the database dump file.
The easiest way to remove them is to run the following command: