top
htop
atop
iotop
sysstat: sar iostat
vmstat
ps .....
netstat .....
lsof
fuser
smem
pmap
ps -e -O rss,user | awk '/php[^[]/{sum+=$2}END{print sum}'
понедельник, 27 февраля 2012 г.
Prestashop multishop
1) make soft link of image folder from main shop to new shop
ln -fs main_shop/img new_shop/img2)Rename new_shop_db and main_shop_db to your names in sql procedure and run sql script
DELIMITER $$ DROP PROCEDURE if exists make_linked_tables $$ CREATE PROCEDURE make_linked_tables() BEGIN DECLARE done INT DEFAULT FALSE; DECLARE str VARCHAR(250); DECLARE cur CURSOR FOR SELECT table_name FROM information_schema.tables WHERE table_schema = 'new_shop_db' AND (table_name LIKE 'ps_product%' OR table_name LIKE 'ps_category%') UNION SELECT 'ps_image' UNION SELECT 'ps_image_lang' ; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN cur; REPEAT FETCH cur INTO str; SET @s = CONCAT("RENAME TABLE ", str," TO "); SET @s = CONCAT(@s,str,"_orig"); PREPARE sth FROM @s; EXECUTE sth; DEALLOCATE PREPARE sth; SET @s = CONCAT("CREATE VIEW ",str," as SELECT * FROM main_shop_db.",str); PREPARE sth2 FROM @s; EXECUTE sth2; DEALLOCATE PREPARE sth2; UNTIL done END REPEAT; CLOSE cur; END$$ DELIMITER ;3)Run procedure
CALL make_linked_tables(); DROP PROCEDURE if exists make_linked_tables;Manually customize categories list of new shop:
drop table if exists ps_category; create OR replace view ps_category AS SELECT * FROM MAIN_SHOP_DB.`ps_category` WHERE id_category in ( 1,17,28,35) OR id_parent in (17,28,35); drop table if exists ps_category_group; create OR replace view ps_category_group AS SELECT * FROM MAIN_SHOP_DB.`ps_category_group` WHERE id_category in ( SELECT id_category FROM `ps_category` ) ; drop table if exists ps_category_lang; create OR replace view ps_category_lang AS SELECT * FROM MAIN_SHOP_DB.`ps_category_lang` WHERE id_category in ( SELECT id_category FROM `ps_category`); drop table if exists ps_category_product; create OR replace view ps_category_product AS SELECT * FROM MAIN_SHOP_DB.`ps_category_product` WHERE id_category in ( SELECT id_category FROM `ps_category`) ; There are id_category = 1 - main category(required), 17(subcategory optional) ....
Подписаться на:
Сообщения (Atom)