These set of scripts are for Magento 2. For Magento 1, see this Gist.
This file contains hidden or 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
SET FOREIGN_KEY_CHECKS=0; | |
-- Delete all products | |
TRUNCATE TABLE `catalog_product_bundle_option`; | |
TRUNCATE TABLE `catalog_product_bundle_option_value`; | |
TRUNCATE TABLE `catalog_product_bundle_selection`; | |
TRUNCATE TABLE `catalog_product_entity_datetime`; | |
TRUNCATE TABLE `catalog_product_entity_decimal`; | |
TRUNCATE TABLE `catalog_product_entity_gallery`; | |
TRUNCATE TABLE `catalog_product_entity_int`; |
This file contains hidden or 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 | |
//Normal way | |
function generateRandomString($length = 10) { | |
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
$randomString = ''; | |
for ($i = 0; $i < $length; $i++) { | |
$randomString .= $characters[rand(0, strlen($characters) - 1)]; | |
} | |
return $randomString; | |
} |
This file contains hidden or 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
//Get Magento Store Info | |
Get store data | |
Mage::app()->getStore(); | |
Store Id | |
Mage::app()->getStore()->getStoreId(); | |
Store code | |
Mage::app()->getStore()->getCode(); | |
Website Id | |
Mage::app()->getStore()->getWebsiteId(); | |
Store Name |
This file contains hidden or 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
cd /home/www | |
wget http://www.magentocommerce.com/downloads/assets/1.7.0.2/magento-1.7.0.2.tar.gz | |
wget http://www.magentocommerce.com/downloads/assets/1.6.1.0/magento-sample-data-1.6.1.0.tar.gz | |
tar -zxvf magento-1.7.0.2.tar.gz | |
tar -zxvf magento-sample-data-1.6.1.0.tar.gz | |
mv magento-sample-data-1.6.1.0/media/* magento/media/ | |
mv magento-sample-data-1.6.1.0/magento_sample_data_for_1.6.1.0.sql magento/data.sql | |
mv magento/* magento/.htaccess public_html | |
cd public_html | |
chmod o+w var var/.htaccess app/etc |
This file contains hidden or 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
#定义Nginx运行的用户和用户组 | |
user www www; | |
#nginx进程数,建议设置为等于CPU总核心数。 | |
worker_processes 8; | |
#全局错误日志定义类型,[ debug | info | notice | warn | error | crit ] | |
error_log /var/log/nginx/error.log info; | |
#进程文件 |
This file contains hidden or 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
set foreign_key_checks = 0; | |
truncate dataflow_batch_export; | |
truncate dataflow_batch_import; | |
truncate log_customer; | |
truncate log_quote; | |
truncate log_summary; | |
truncate log_summary_type; | |
truncate log_url; | |
truncate log_url_info; | |
truncate log_visitor; |