$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>plugin development - Is it possible to replace MySQL with JSON files for WordPress|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

plugin development - Is it possible to replace MySQL with JSON files for WordPress

matteradmin9PV0评论

I'm interested in the question, Is it possible to replace MySQL database with JSON files for WordPress? Let me explain what I mean. We have 12 standard tables after WordPress installation. We can write each of them into separate JSON file so that each file will be named as its respective table e.g. wp_posts.json, wp_options.json etc. And each file will contain table rows like

wp_options.json

"1":{"option_name":"siteurl","option_value":"http://localhost","autoload":"yes"},
"2":{"option_name":"home","option_value":"http://localhost","autoload":"yes"},
...

or some other format

So the main question is, How to listen or intercept every SQL-query made by WordPress and give back the right result from the right JSON file? And write data into JSON file if the SQL-query is UPDATE or INSERT

For example if SQL-query from WordPress is like

SELECT siteurl FROM wp_options WHERE id = 1

we read the wp_options.json, find the row no. 1 and give back the option_value

As I can understand, all queries are being handled in the wp-includes/wp-db.php file but I don't know what should I start from. Could you at least describe the general steps or maybe there is a tutorial in details or plugin for the purpose?

Or maybe we can listen MySQL host and port?

Post a comment

comment list (0)

  1. No comments so far