I'm working on a project (WordPress) that using a custom data directory to store any_table.ibd (InnoDB files) files (mandatory requirement from customer).
So my requirement is, need to add DATA DIRECTORY = '/path/to/dir/' sql part to every create table statement.
Default WordPress create tables statements already customized via mu plugin with dbdelta_create_queries hook.
Is there any way to do same thing for any plugin that installed in WordPress site ?
Sample Query
CREATE TABLE table1 (id int PRIMARY KEY, name varchar (50))
DATA DIRECTORY = 'path/to/data/directory/'
Related
I'm trying to insert / modify / delete items from a Wordpress menu from a MYSQL query in a separate WordPress file.
Does anyone know how wordpress menus work at the database level?
They're nothing else than a default postype, specifically: nav_menu_item.
So like the rest of the postypes they are in the post table or wp_posts if you use that prefix.
As all the rest of postypes their meta values are stored in postmeta/wp_postsmeta with the corresponding id.
I have 2 projects, one in Wordpress, and the other one in Laravel 4.2.
Recently i had to merge both projects into one Laravel 4.2 App using jgrossi/corcel. This was my only option.
Everything works fantastic! I can even post directly into Wordpress without logging into Wordpress to get posts, comments, etc.
But there is something I can't figure out. Wordpress is using Jetpack for subscribers. The laravel app needs a field to add more subscribers. I have very little experience in Wordpress.
Is it possible to add subscribers from outside Wordpress directly into the database? If not, is there a way to use a Jetpack plugin outside of Wordpress?
Yes you can add new users in database with subscribers role.
Wordpress stores the users data in wp_users table and its meta info in wp_usermeta. So follow the following steps
Add a new entry in wp_users table. As a sample here is entry from my wp_users table. You can submit values for these attributes using your normal laravel form with post request.
Add its related data in wp_usermeta table. Here you need to set two key value attributes against user_id of newly inserted record.
meta_key = wp_capabilites and meta_value = a:1:{s:10:"subscriber";b:1;}. As you can note the meta_value for wp_capabilities is in serialzed form.
meta_key = show_admin_bar_front and meta_value = true.
So you added a new user with subscriber role.
Where can I find in Joomla 1.5 file system that file where in jos_core_acl_aro
and jos_core_acl_groups_aro_map table the values are inserted after registration ? Or some documentation for it.
I have a custom table with users(not jos_users). I want to display the user menu after login.
I think that the ACL system is querying the users from jos_users. I want to query them from my custom table and also insert my users values in those two acl tables.
There are only two relevant files, where the ACL maps are touched.
administrator/components/com_users/views/users/view.html.php (UsersViewUsers)
libraries/joomla/user/authorization.php (JAuthorization)
The JAuthorisation class uses the GACL library in libraries/joomla/phpgacl/, which you can use to learn about the interna, but should only be used through JAuthorisation.
I have about 800,000 products in my magento database, and I need to delete about half of those products (approx 400,000).
Running on magento 1.7.0.2
It's just taking me forever to do it from the "Manage Products" page. The process takes to long and the server keeps timing out.
Is there a SQL statement that can deleted selected products from within the database?
All the products that need to be deleted, the title starts with *NLA
I know magneto stores the product data in several different tables, so I'm trying to figure out how to delete all the data associated with the selected products from all tables.
I know MySQL statements, but I'm not an expert, and can't figure this one out.
For example if it was only one table I would do something like this:
DELETE FROM product_table WHERE title_value LIKE '*NLA%'
I would appreciate it if someone could point me in the right direction.
You can use this query
DELETE FROM product_table WHERE title_value LIKE '*NLA%
Magento used InnoDB engine Storage for MySQL with foreign keys. All data which has FK keys will be also deleted.
Your SQL statement should do the job IF you're deleting from a single table.
If stored on different tables, it depends on the way they are stored. If, for example, products are stored according to their key being a foreign key in the different tables, then all related tables will update when the products are deleted from the main table (depending on whether the foreign keys are set to CASCADE ON DELETE or not).
But be careful about the regex given in LIKE condition, make sure there are no other products that have 'NLA' somewhere in their title.
Edit: you said starting with 'NAL'? In that case your regex should be something like 'NAL*%'
DELETE FROM product_table WHERE title LIKE 'NAL*%'
In Magento product details are stored in data base using EAV concept so there are more then 30 tables where a product data will go.
I suggest you to use Magento import export facility for bulk delete.
refer this link :
magento: bulk delete products via import/export facility?
There is an extension Magmi which can be used as well.
In Magento, once Customer places Order, that data automatically goes to Sales_flat_order table or for item related information goes to sales_flat_order_item table etc.
Likewise I have selected some columns in Magento database & created 1 custom table in Magento database.
Now My requirement is, once customer places Order that data also must get copied to custom table along with Magento\’s default table.
So for that I created one mysql query through joins that will fetch all my needed data from Magento tables & insert it in my Custom table....
Now I am planning to create php file that includes my above query.
My doubt is how & where should I change My Magento code so that once customer places order, I will call to this file so that I can copy data in custom table through that query.
I get some reference as When customer places order, it will use saveOrder function in Onepage model which is at Checkout/Model/Type/Onepage.php
So can anybody tell me what exactly I need to do in this scenario....Anyone having such scenario or sample code for the same…
Or having any other idea…
Plz guide me…
Thanks..
You can follow my tip on this answer but observing the checkout_type_onepage_save_order_after event.
Why don't you use a MySQL Trigger?
# target table name target_table
# source table name Sales_flat_order table
DELIMITER $$
CREATE TRIGGER ON_INSERT_AFTER_SALES
AFTER INSERT ON Sales_flat_order
FOR EACH ROW
BEGIN
INSERT INTO target_table VALUES(field_one,field_two,...);
END $$
DELIMITER;
You can use magento's sales_order_place_after event, create an observer for this and put you code into it.