Nástroj pro přesun WordPressu jinam

When you’re migrating WordPress (or any other platform using serialized PHP strings in the database) between domains, you must use a safe search and replace method that preserves the integrity of the serialized string lengths. A simple of a dump file for http://localhost to, for example, http://thenewdomain.com is problematic because the length of the string changes but the indexes for the serialized strings does not. Consequently settings are lost and widgets disappear. Not good.

This script can now also handle multiply nested serializations, which can happen in transient values in WP at times, and it can also handle multi-byte Unicode changes safely. This is important now that internationalised domain names are allowed.

It’s worth mentioning that the code will work for any platform that stores PHP serialized arrays in a MySQL database. You can easily use this script on Drupal, Joomla and many other systems where you need to change items across a database without messing up your stored arrays.

„Search & Replace DB »“:http://interconnectit.com/products/search-and-replace-for-wordpress-databases/

*Související*

**How to Move WordPress to a New Server (without losing anything)**
„http://www.sitepoint.com/move-wordpress-new-server-without-losing-anything/“:http://www.sitepoint.com/move-wordpress-new-server-without-losing-anything/

Struktura databáze WordPressu

Pokud chcete pochopit, jak vlastně samotný WordPress funguje, určitě vám pomůže základní znalost struktury jeho databáze. Ta se zkládá z celkem 11 tabulek, které ještě mohou rozšiřovat pluginy. Každá má svůj prefix, nejčastěji wp_, který se nastavuje běhěm instalace WordPressu a vytváření databáze. comments, commentmeta První dvě tabulky obsahují informace o komentářích na webu. V […]

Práce s databází pomocí třídy $wpdb

**Načtení** ID a nadpisů čtyř nejnovějších příspěvků a jejich seřazení podle počtu komentářů (sestupně):

/—code php
get_results(„SELECT ID, post_title FROM $wpdb->posts WHERE post_status = ‚publish‘
AND post_type=’post‘ ORDER BY comment_count DESC LIMIT 0,4“)

// Echo the title of the first scheduled post
echo $posts[0]->post_title;
?>
\—

Objekt $results obsahuje pole s výsledky.

**get_row** načte pouze jediný záznam z tabulky:

/—code php
get_row(„SELECT ID, post_title FROM wp_posts WHERE post_status = ‚publish‘
AND post_type=’post‘ ORDER BY comment_count DESC LIMIT 0,1“)

// Echo the title of the most commented post
echo $posts->post_title;
?>
\—

**get_col** načte celý sloupec:

/—code php
get_col(„SELECT ID FROM wp_posts WHERE post_status = ‚publish‘
AND post_type=’post‘ ORDER BY comment_count DESC LIMIT 0,10“)

// Echo the ID of the 4th most commented post
echo $posts[3]->ID;
?>
\—

**get_var** načte jedinou hodnotu:

/—code php
get_var(„SELECT user_email FROM wp_users WHERE user_login = ‚danielpataki‘ „)

// Echo the user’s email address
echo $email;
?>
\—

**Vkládání do databáze**

/—code php
insert( $table, $data, $format);
$wpdb->insert($wpdb->usermeta, array(„user_id“ => 1, „meta_key“ => „awesome_factor“, „meta_value“ => 10), array(„%d“, %s“, „%d“));

// odpovídá:
// INSERT INTO wp_usermeta (user_id, meta_key, meta_value) VALUES (1, „awesome_factor“, 10);
?>
\—

**Updatování databáze:**

/—code php
// $wpdb->update($table, $data, $where, $format = null, $where_format = null);

// $where parameter – can be an array in the form of column-value pairs:
$wpdb->update( $wpdb->posts, array(„post_title“ => „Modified Post Title“), array(„ID“ => 5), array(„%s“), array(„%d“) );
\—

„Zdroj »“:http://wp.smashingmagazine.com/2011/09/21/interacting-with-the-wordpress-database/

Databázové aplikace

**WP CSV to Database**
„http://wordpress.org/extend/plugins/wp-csv-to-database/“:http://wordpress.org/extend/plugins/wp-csv-to-database/
„http://www.tipsandtricks-hq.com/?p=2116“:http://www.tipsandtricks-hq.com/?p=2116

WP CSV to Database plugin allows you to insert CSV file content into WordPress database. Useful when you want to bulk upload data from your CSV file (e.g. product details) to the WordPress database in one go.

**DB Toolkit**
„http://wordpress.org/extend/plugins/db-toolkit/“:http://wordpress.org/extend/plugins/db-toolkit/

DB-Toolkit allows you to build web applications within WordPress. From manager interfaces to capture forms to content viewers or almost any type. DB-Toolkit is not a simple plugin and has a steep learning curve, but the results are very rewarding.

Some Features:
– Field-by-field data type handling makes data management very powerful and flexible.
– Data exporting in PDF and CSV * Create API’s to connect to your data. This allows you to build mobile apps that feed from your content.
– Multi Interface Layouts using clusters * Build custom content managers, like galleries, contact lists, application forms, employee databases… and so on.
– Import data from an XML or CSV source * Visually build forms that capture data to a database existing or not.

**Database Table Manager**
„http://wordpress.org/extend/plugins/database-table-manager/“:http://wordpress.org/extend/plugins/database-table-manager/

Want to add and manage custom database tables from the admin area? This plugin contains several easily modified examples.
This plugin folder contains 2 suites of plugins. The Club Manager Plugin contains 4 Plugins – Programme (of Events), Stop Press, Recent Events and News. The Specialists Plugin contains a more generic example of the management of a many to many link table between a number of „specialists“ and their „specialisms“. It also demonstrates the use of left joins and lookup tables. Code to sort data by clicking on the table head and to filter the selection set has also been added. They are based upon a more generic system which allows creating and adding data to custom database tables from the wordpress control panel. These plugins can be used as a template for creating different types of table and display or you can just use them as they are if they do what you want to do.

**[GWA] db Editor**
„http://wordpress.org/extend/plugins/gwa-db-editor/“:http://wordpress.org/extend/plugins/gwa-db-editor/

A dangerously powerful plugin that will allow you to access and update your database tables in your weblog administrator. Uses AJAX and TableKit to update field data. Simple and fast. Just click, edit, and submit.

Jak zjednodušit databázové dotazy když nepotřebujete stránkování?

Chystaný WordPress 3.2 se zaměřuje hlavně na optimalizaci a zrychlení načítání webu a v této souvislosti byl objeven docela zajímavý trik. Jde o „neveřejný“ parametr no_found_rows, který může být využit např. ve funkcích query_posts(), WP_Query() či get_posts(), ale skoro nikdo o něm neví a moc se nepoužívá, i když dokáže v mnoha případech zjednodušit některé prováděné […]

Údržba systému a databáze

**WP-Sweep**
„https://wordpress.org/plugins/wp-sweep/“:https://wordpress.org/plugins/wp-sweep/

WP-Sweep allows you to clean up unused, orphaned and duplicated data in your WordPress. It also optimizes your database tables.
Autorem tohoto pluginu je Lester Chan, což je určitou zárukou kvality.

*Alternativy*

**WP CleanFix**
„http://wordpress.org/extend/plugins/wp-cleanfix/“:http://wordpress.org/extend/plugins/wp-cleanfix/

WP CleanFix is a management tool for for check, repair, fix and optimize your WordPress blog. The Ajax interface allow to manage all status in one only page!

FEATURES

– Database Tables optimization
– Check/Remove for unused UserMeta
– Check/Remove for Post Revision and Trash
– Check/Remove for unused Post Meta
– Check/Remove for unused Tags
– Check/Remove/Relink for Posts without Authors
– Check/Remove/Relink for Pages without Authors
– Check/Remove for Attachments without Post/Page
– Check/Remove for unused Categories
– Check/Remove for unlink Categories (terms)
– Check/Remove for unlink Categories Taxonomy
– Check/Remove for unapproved and Trash comments
– Check/Remove for spam comments
– Find & Replace on Posts Content
– Find & Replace on Comments Content
– WordPress MU compatibility
– English/French/Italian Localization
– Added Bubble repair count on item menu

„10 Quick Ways to Clean Up and Optimize Your WordPress Site »“:http://premium.wpmudev.org/blog/clean-up-optimize-wordpress/

Čištění databáze po pluginech

**Plugins Garbage Collector**
„http://wordpress.org/extend/plugins/plugins-garbage-collector/“:http://wordpress.org/extend/plugins/plugins-garbage-collector/
„http://www.shinephp.com/plugins-garbage-collector-wordpress-plugin/“:http://www.shinephp.com/plugins-garbage-collector-wordpress-plugin/

Plugin maps tables and entries created by plugins in your database. It also shows you which ones are used by which plugin and whether this plugin is active, inactive or deleted, so you can decide if you want to keep or delete those tables.

Zálohování a obnova

**UpdraftPlus Backup and Restoration**
„https://wordpress.org/plugins/updraftplus/“:https://wordpress.org/plugins/updraftplus/

Simplifies backups (and restoration). Backup into the cloud (Amazon S3 (or compatible), Dropbox, Google Drive, Rackspace Cloud, DreamObjects, FTP, SFTP, SCP, WebDAV, OpenStack Swift and email) and restore with a single click. Backups of files and database can have separate schedules.

UpdraftPlus is the highest-ranking backup plugin on rankwp.com (ranks in the top 40 out of 30,000 WordPress plugins for quality on rankwp.com – last checked 21 September 2014).

Widely tested and reliable (over 1.8 million downloads). Ranks in the top 100 most used of all WordPress plugins on rankwp.com. Millions of backups completed!

*Alternativy*

**XCloner – Backup and Restore**
„http://wordpress.org/extend/plugins/xcloner-backup-and-restore/“:http://wordpress.org/extend/plugins/xcloner-backup-and-restore/

XCloner is a Backup and Restore component designed for PHP/Mysql websites, it can work as a native plugin for WordPress and Joomla!.

XCloner design was specifically created to Generate custom backups of any LAMP website through custom admin inputs, and to be able to Restore the clone on any other location with the help of the automatic Restore script we provide, independent from the main package!

XCloner Backup tool uses Open Source standards like TAR and Mysql formats so you can rest assured your backups can be restored in a variety of ways, giving you more flexibility and full control.

XCloner Generate, Move and Restore process:

1. Generate and Store the backups
2. Move the backup and restore script to the new location
3. Restore the backup by launching the XCloner.php restore script

**Duplicator**
„http://wordpress.org/extend/plugins/duplicator/“:http://wordpress.org/extend/plugins/duplicator/

The Duplicator plugin is designed to give WordPress Administrators the ability to migrate a site from one location to another location in 3 easy steps. Just create a package, download it and install. No need to change all your settings and re-run import/export scripts. The plugin also serves as a simple backup utility.
This tool is great for pulling a production site down onto your local machine for testing and validation. It also works great for developing locally and then pushing up to a production server.

It reduces the process to three easy steps:

1. Create a package

2. Download

3. Install in the new location

**EZPZ One Click Backup**
„http://wordpress.org/extend/plugins/ezpz-one-click-backup/“:http://wordpress.org/extend/plugins/ezpz-one-click-backup/

EZPZ One Click Backup is a very easy way to do a complete backup and restoring of your entire WordPress site. In fact it’s so easy to use there are no required user settings, everything is automatic. Just one click and presto, you’ll have a complete backup stored on your server. One more click and you can download the entire backup to your own computer.

If you prefer to download your backup via FTP the path you’ll need is also included. EZPZ OCB also stores your last backup on the server in case you ever need to download it again.

With the new EZPZ Easy Restore restoring your site is a simple two step process.

**BackUpWordPress**
„http://wordpress.org/extend/plugins/backupwordpress/“:http://wordpress.org/extend/plugins/backupwordpress/

Simple automated backups of your WordPress powered website. BackUpWordPress will back up your entire site including your database and all your files.

**WordPress Database Backup**
„http://austinmatzko.com/wordpress-plugins/wp-db-backup/“:http://austinmatzko.com/wordpress-plugins/wp-db-backup/

(Pouze) databázi lze zazálohovat manuálně uložením na server, vlastní počítač nebo posláním na email, ev. automaticky ve zvoleném intervalu.

**myEASYbackup**
„http://wordpress.org/extend/plugins/myeasybackup/“:http://wordpress.org/extend/plugins/myeasybackup/

Backup, restore, migrate your WP installation, both code and MySQL tables, with a single click.

**WP Staging – DB & File Duplicator & Migration**
„https://wordpress.org/plugins/wp-staging/“:https://wordpress.org/plugins/wp-staging/

This duplicator plugin allows you to create an staging or development environment in seconds.
It creates a file clone of your website into a subfolder of your current WordPress installation with an entire copy of your database. This sounds pretty simple and yes it is! All the hard time consumptive database and file copy stuff including url replacements is done in the background. For testing new plugins and updates first before installing them on live website.

Údržba databáze

**WP-Cleanup**
„http://wordpress.org/extend/plugins/wp-cleanup/“:http://wordpress.org/extend/plugins/wp-cleanup/

This WordPress plugin will cleanup your WordPress database, which means that it will perform the following actions:

– Remove all post revisions
– Remove all spam comments
– Remove all unapproved comments
– Remove all unused tags
– Remove all unused post meta
– Optimize MySQL tables by removing all unused table space

**Optimize Database after Deleting Revisions**
„http://wordpress.org/extend/plugins/rvg-optimize-database/“:http://wordpress.org/extend/plugins/rvg-optimize-database/

A ‚One Click‘ WordPress Database Cleaner / Optimizer.

– Deletes redundant revisions of posts and pages (you optionally can keep an ‚x‘-amount of the most recent revisions)
– Deletes trashed posts, pages and comments (optional)
– Deletes spammed comments (optional)
– Deletes ‚orphan postmeta items‘
– Optimizes the database tables (optionally you can exclude certain tables from optimization)
– Creates a log file of the optimizations (optional)
– Optimization can be scheduled to automatically run once hourly, twice daily, once daily or once weekly (optional)

**Plugins Garbage Collector**

Vymaže tabulky po deaktivovaných a nepoužívaných pluginech.
„http://wordpress.org/extend/plugins/plugins-garbage-collector/“:http://wordpress.org/extend/plugins/plugins-garbage-collector/