wordpress https://16rom.com/ru ru UPD: Перенос сайта Wordpress на другой домен https://16rom.com/ru/blog/perenos-sayta-wordpress-na-drugoy-domen <span property="schema:name" class="field field-name-title field-formatter-string field-type-string field-label-hidden">UPD: Перенос сайта Wordpress на другой домен</span> <div property="schema:text" class="clearfix text-formatted field field-node--body field-formatter-text-default field-name-body field-type-text-with-summary field-label-hidden has-single"><div class="field__items"><div property="schema:text" class="field__item"><p>Процесс миграции между серверами часто требует изменения URL WordPress установки. Это значит, что нужно обновлять базы данных. Нужно поменять все строки с вхождением старого домена на новый.</p> <p>Для этих целей используется SQL запрос:</p> <p><em>#posts<br /> UPDATE wp_posts SET guid = REPLACE (guid, 'old_domain.com/', 'new_domain.com/');<br /> UPDATE wp_posts SET post_excerpt = REPLACE (post_excerpt, 'old_domain.com/', 'new_domain.com/');<br /> UPDATE wp_posts SET post_content = REPLACE (post_content, 'old_domain.com/', 'new_domain.com/');<br /> UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'old_domain.com/', 'new_domain.com/');<br />  <br /> #comments<br /> UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'old_domain.com/', 'new_domain.com/');<br /> UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'old_domain.com/', 'new_domain.com/');<br /> UPDATE wp_commentmeta SET meta_value = REPLACE (meta_value, 'old_domain.com/', 'new_domain.com/');<br />  <br /> #links<br /> UPDATE wp_links SET link_url = REPLACE (link_url, 'old_domain.com/', 'new_domain.com/');<br /> UPDATE wp_links SET link_rss = REPLACE (link_rss, 'old_domain.com/', 'new_domain.com/');<br />  <br /> #options<br /> UPDATE wp_options SET option_value = REPLACE (option_value, 'old_domain.com/', 'new_domain.com/');<br />  <br /> #usermeta<br /> UPDATE wp_usermeta SET meta_value = REPLACE (meta_value, 'old_domain.com/', 'new_domain.com/');<br />  <br /> #posts<br /> UPDATE wp_posts SET guid = REPLACE (guid, 'old_domain.com', 'new_domain.com');<br /> UPDATE wp_posts SET post_excerpt = REPLACE (post_excerpt, 'old_domain.com', 'new_domain.com');<br /> UPDATE wp_posts SET post_content = REPLACE (post_content, 'old_domain.com', 'new_domain.com');<br /> UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'old_domain.com', 'new_domain.com');<br />  <br /> #comments<br /> UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'old_domain.com', 'new_domain.com');<br /> UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'old_domain.com', 'new_domain.com');<br /> UPDATE wp_commentmeta SET meta_value = REPLACE (meta_value, 'old_domain.com', 'new_domain.com');<br />  <br /> #Links<br /> UPDATE wp_links SET link_url = REPLACE (link_url, 'old_domain.com', 'new_domain.com');<br /> UPDATE wp_links SET link_rss = REPLACE (link_rss, 'old_domain.com', 'new_domain.com');<br />  <br /> #options<br /> UPDATE wp_options SET option_value = REPLACE (option_value, 'old_domain.com', 'new_domain.com');<br />  <br /> #usermeta<br /> UPDATE wp_usermeta SET meta_value = REPLACE (meta_value, 'old_domain.com', 'new_domain.com');</em></p> <p>Но даже после манипуляций с БД сайт может работать некорректно. Все дело в сериализации данных в БД.</p> <p><em>a:2:{i:758;s:4:"test";i:759;s:4:"test";}<br /> a:2:{i:758;s:4:"test";i:759;s:9:"test";}</em></p> <p>Первый вариант то что нужно получить, второй то что имеем. Неверный параметр s - длина строки.</p> <p>Для исправления ошибки необходимо обработать каждую ячейку БД с неверной строкой.</p> <p><em>preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $bad_string );</em></p> <p> </p> <p>Рабочий скрипт с сайта <a href="http://www.wtfpl.net/">http://www.wtfpl.net/</a></p> </div></div> </div> <span rel="schema:author" class="field field-name-uid field-formatter-author field-type-entity-reference field-label-hidden"><span lang="" about="/ru/userauth/1" typeof="schema:Person" property="schema:name" datatype="">Админ</span></span> <span property="schema:dateCreated" content="2013-10-13T21:53:08+00:00" class="field field-name-created field-formatter-timestamp field-type-created field-label-hidden">Mon, 10/14/2013 - 00:53</span> <div class="field field-node--field-download field-formatter-file-default field-name-field-download field-type-file field-label-above has-single"><h3 class="field__label">Download</h3><div class="field__items"><div class="field__item"><span class="file file--mime-application-zip file--package-x-generic"> <a href="https://16rom.com/sites/default/files/blog-attached/wp_fixer.zip" type="application/zip; length=1946">wp_fixer.zip</a></span> </div></div> </div> <div class="field field-node-field-tags field-entity-reference-type-taxonomy-term field-formatter-entity-reference-label field-name-field-tags field-type-entity-reference field-label-above"><h3 class="field__label">Теги</h3><div class="field__items"><div class="field__item field__item--wordpress"> <span class="field__item-wrapper"><a href="/ru/tags/wordpress" property="schema:about" hreflang="ru">wordpress</a></span> </div><div class="field__item field__item--php"> <span class="field__item-wrapper"><a href="/ru/tags/php" property="schema:about" hreflang="ru">php</a></span> </div></div> </div> <section id="node-article-comment-node-article--4" class="field field-node--comment-node-article field-formatter-comment-default field-name-comment-node-article field-type-comment field-label-hidden display-mode-threaded comment-bundle-comment-node-article comment-wrapper"> <a name="comments"></a><article role="article" data-comment-user-id="0" id="comment-1" class="js-ajax-comments-id-1 comment js-comment comment--type-comment-node-article comment--view-mode-default by-anonymous has-title clearfix"> <div class="comment__container"><h3 class="comment__title comment__author h4"> <span lang="" typeof="schema:Person" property="schema:name" datatype="">пашка</span> <mark class="comment__new marker marker--success hidden" data-comment-timestamp="1381701579"></mark> </h3> <div class="comment__meta"> <div class="comment__submitted"> <span class="comment__pubdate">Mon, 10/14/2013 - 00:59</span> </div> </div> <div class="comment__content"> <div class="clearfix text-formatted field field-comment--comment-body field-formatter-text-default field-name-comment-body field-type-text-long field-label-hidden has-single"><div class="field__items"><div class="field__item">Спасибо! Это помогло</div></div> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1&amp;1=default&amp;2=ru&amp;3=" token="7fMKYpwBWtnjsFdvmTZacYo9i65UTRwSC8qRt8n5ZKQ"></drupal-render-placeholder></div> </div> </article> <div class="comment-form-wrapper"> <h2 class="comment-form__title h3">Добавить комментарий</h2><drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=61&amp;2=comment_node_article&amp;3=comment_node_article" token="fAu0KHIfUH3rFT5GecmKLzwWV5uEtk3JBA_UXWX_MbE"></drupal-render-placeholder></div></section> Sun, 13 Oct 2013 21:53:08 +0000 admin_romcom 61 at https://16rom.com