Staging

**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.

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/

Jak přesunout wordpress na novou adresu/nový hosting

Poměrně častý dotaz mezi začínajícími uživateli wordpressu je, jak ho přesunout na novou adresu či na nový hosting a přitom si zachovat všechna nastavení, články i obrázky, které byly doposud vytvořeny. Existují na to pluginy, např. Backup and Move Plugin, ale v tomto tutoriálu si ukážeme ruční cestu. Tu jsem rozdělil do pěti jednoduchých kroků…. Číst dále

Změna trvalých odkazů

**Permalinks Migration**
„http://www.deanlee.cn/wordpress/permalinks-migration-plugin/“:http://www.deanlee.cn/wordpress/permalinks-migration-plugin/
„http://wordpress.org/extend/plugins/permalinks-migration-plugin-for-wordpress/“:http://wordpress.org/extend/plugins/permalinks-migration-plugin-for-wordpress/

With this plugin, you can safely change your permalink structure – for example, from */%year%/%monthnum%/%day%/%postname%/* to */%category%/%postname%/* – without breaking the old links to your website, and even doesn’t affect your search engine rankings.

But doing so will make all pages indexed by search engines become invalid, moreover, losing visitors from other sites or bookmarks that links to you.

Permalinks Migration plugin is a way to tell the search engines (and browsers) that the page has permenantly moved, and that the old address should be replaced by the new one . This plugin will generates a “301 Redirect” when user or spider visit your site through old permalinks and redirect them to the new permalinks of the same post.

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.

SQL dotazy k nezaplacení

**Náhrada jednoho řetězce za druhý v libovolné tabulce a poli**

/—code php
UPDATE table_name
SET field_name = replace( field_name, ‚tohle_najdi‘, ‚timhle_nahrad‘ );
\—

k nezaplacení např. při přesunu webu na jinou adresu, lze tak nahradit absolutní URL obrázků, siteurl-homeurl nebo guide

/—code php

UPDATE wp_posts SET post_content = REPLACE(post_content, ‚http://stara.cz‘, ‚http://nova.cz‘);
UPDATE wp_posts SET guid = REPLACE(guid, ‚http://stara.cz‘, ‚http://nova.cz‘);
UPDATE wp_options SET option_value = REPLACE(option_value, ‚http://stara.cz‘, ‚http://nova.cz‘);
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ‚http://stara.cz‘, ‚http://nova.cz‘);
\—

Tento způsob ale bohužel neřeší případ tzv. „serializovaných dat“:http://stackoverflow.com/questions/11817950/what-is-data-serialization. Při migraci WP na jiné url je proto jistější použít nějaký specializovaný nástroj pro náhradu v serializovaných datech, např.:

„http://pixelentity.com/wordpress-search-replace-domain/“:http://pixelentity.com/wordpress-search-replace-domain/,

„https://interconnectit.com/products/search-and-replace-for-wordpress-databases/“:https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

nebo pluginy „WP Migrate DB“:https://wordpress.org/plugins/wp-migrate-db/ či „Better Search Replace“:https://wordpress.org/plugins/better-search-replace/.

WP Migrate DB migrates your database by running find & replace on URLs and file paths, handling serialized data, and saving an SQL file.

Někdy je potřeba jen přidat text na konec obsahového pole

/—code php
UPDATE wp_posts SET post_content =
concat(post_content, ‚ …‘) WHERE post_type = ‚post‘;
\—

nebo hromadně nahradit url uvedené komentátorem

/—code php
UPDATE wp_comments
SET comment_author_url =
REPLACE( comment_author_url, ‚http://www.stara.cz‘, ‚http://www.nova.cz‘);
\—

**Změna hesla**

/—code php
UPDATE ‚wp_users‘
SET ‚user_pass‘ = MD5(‚PASSWORD‘) WHERE ‚user_login‘ =’admin‘ LIMIT 1;
\—

**Přesun příspěvků z jednoho autora na jiného**

/—code php
UPDATE wp_posts
SET post_author=NEW_AUTHOR_ID
WHERE post_author=OLD_AUTHOR_ID;
\—

**Vymazání revizí a souvisejících metainformací**

/—code php
DELETE a,b,c FROM wp_posts a
WHERE a.post_type = ‚revision‘
LEFT JOIN wp_term_relationships b
ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id);
\—

**Dávkové vymazání komentářů označených jako spam**

/—code php
DELETE from wp_comments WHERE comment_approved = ‚0‘;
\—

**Nalezení nevyužitých tagů**

/—code php
SELECT * From wp_terms wt
INNER JOIN wp_term_taxonomy wtt ON wt.term_id=wtt.term_id
WHERE wtt.taxonomy=’post_tag‘ AND wtt.count=0;
\—

Výpis e-mailů vašich komentátorů
/—code php
SELECT DISTINCT comment_author_email
FROM wp_comments;
\—

**Vymazání všech tagů u příspěvků najednou**
/—code php
DELETE a,b,c
FROM
database.prefix_terms AS a
LEFT JOIN database.prefix_term_taxonomy AS c ON a.term_id = c.term_id
LEFT JOIN database.prefix_term_relationships AS b
ON b.term_taxonomy_id = c.term_taxonomy_id
WHERE (c.taxonomy = ‚post_tag‘ AND c.count = 0);
\—

**Výpis všech nepotřebných *post meta* záznamů**

/—code php
SELECT * FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL;
\—

**Hromadné vypnutí komentářů u starších příspěvků**

/—code php
UPDATE wp_posts SET comment_status = ‚closed‘
WHERE post_date < ‚2009-01-01‘ AND post_status = ‚publish‘;
\—

**Deaktivace všech pluginů**

/—code php
UPDATE wp_options SET option_value = “ WHERE option_name = ‚active_plugins‘;
\—

**Zdroj:**

„http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries“:http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries

„http://www.onextrapixel.com/2010/01/30/13-useful-wordpress-sql-queries-you-wish-you-knew-earlier/“:http://www.onextrapixel.com/2010/01/30/13-useful-wordpress-sql-queries-you-wish-you-knew-earlier/

Relativní cesta k obrázkům

Když jsem přesunovala jeden web na jinou doménu, setkala jsem se v podstatě s jedinou větší nepříjemností, a tou byly URL adresy vložených obrázků. Ve WordPressu se do příspěvků vkládají absolutně, což pak je nutné změnit buď příspěvek po příspěvku, nebo jakž takž v zálohované databázi. Ani jedno z toho není nejlepší cesta. Zatím neznám […]

Jak přesunout WordPress na jiný hosting

V poslední době narážím často na nešťastné uživatele, kteří by rádi přesunuli svůj fungující WordPress na jiný hosting a neví jak na to. Vzhledem k tomu, že nyní přesouvám hned několik webů, ulehčím vám trošku práce.
Pří přesouvání WordPressu mohou nastat dvě varianty:

Přesouváte WordPress z hostingu na jiný hosting a zachováváte si svojí doménu,
tzn. z www.domena.cz […]