「WP related」カテゴリーアーカイブ

WordPress Migration: almost best

1. In source site, save the database using phpmyadmin.

1.1. In phpmyadmin, ->  データベース ->  relevant database (wpdb) -> エクスポート -> 詳細 -> select relevant tables ->  実行 :     source.sql

In selecting the tables, you need prefix of tables, which can be found in the wp-config.php of the  wordpress now exporting.

You need to remember this prefix when importing the database to the target site.

1.2. Xport the files: ftp dump whole “wp-content” to the PC. FFFTP is convenient.

2. In target site:

2.1. If the target is multidomain site, check the database prefix used for those.

2.1.1.  If none of them uses the prefix of the one used in the source site, simply import the source.sql using phpmyadmin of the target site.

2.1.2. If there is a site which uses the same prefix of the source.sql, you have to remove the tables related to that, which means that site must be killed, and then import the source.sql, which means source site wil be migrated to this site.

2.1.3. If none of the target sites is using the same prefix as that of the source site, you can safely import the source.sql.

2.2. Prepare a directory for the target site.

2.2.1. If the directory or wordpress site which is assigned the above prefix does not exist, create a directory and dump, not install, new wordpress files and directories to that directory and then remove “wp-content” from that directory.

2.2.2. If the prefix is assigned to the already existed and removed database wordpress directory, remove the “wp-conten” directory from that directory.

2.3. Edit “wpconfig.php” in that directory so that the above mentioned prefixed database should be used.

2.4. Place searchreplacedb2.php (renamed knsecret.php) in that directory and visit that file (e.g. http://newsite(/newdirectory)/knsecret.php)

2.5. Follow the instruction:

replace source_url (e.g. 192.168.0.16/wptest)

with target_url (e.g. norikoguide.pepper.jp/norikoshop).

Note: leading “http://” should not be included,  nor trailing “/ “.

3. You visit the new site.  It would be all right as the old site. Finally don’t forget to remove “searchreplacedb2.php” (knsecret.php). To avoid the danger of cracking.

 

 

 

 

 

 

 

 

wordpress downgrade

1. Prepare some version from archive wordpress.org

2. In the root deirectory of the site, delete “wp-admin” and “wp-includes” directories.

(FFFTP is convenient)

3. ftp all the directories and files except “wp-content” folder.

(You should not delete .htaccess naturally.)

(You shoud not delete wp-config.php naturally.)

(wp-config.php would not be replaced, because native wp module should not have it.)

Reconstruct wptest to mimic japantourguide (2)

——-continued——-

“Topics” are done, although the looks without aux3.css is better.

Now moves to “Tokyo”

“Contact us” has no problem. May better have breadcrumb and history back.

“About us” is done. aux3.css makes a little better looks.

“About Tokyo” and “Experience Traditional Arts”: look all right.

15.  “Tokyo tour courses”

15.1 page-tokyo_course.php was imported.

15.2 Condition is same as Kamakura Tour courses:

15.3 “Contact” link need some workaround.

15.4 The bottom “Contact jumps to japantourguide.

15.5 Need correction on links to the each site.  Looks like there remains japantourguide links even for picture.

16. I guess he didn’t understand what taxonomy is and the template hierarchy.

Creating taxonomy-in_tokyo.php solved the mess of “Popular Sites in Tokyo”.

17. 10.7, 15.2, 15.3 are solved. They are hidden with the tour-fee-charts, which are custom fields. (You must check the screen option to show the custom fields.)

Reconstruct wptest to mimic japantourguide

1. Customize-> “Author information on/off” directly controls the “by …..” display in home and sample page, that is,  page.php and single.php in parent adventure.

Wrong! both home and sample page are controlled by index.php according to the template hierarchy.

2. Customize->”display the date on/off” controls the date display in single.php, wheras page.php doesn’t show date in either set up.

3. single.php seems to be used in many cases. Very important one is the linking usage in popular sites in tokyo. Considering this and above 1. & 2., single.php which excludes date and author information should be created in adventure-child. In “Customize” setting, both date and author should be set displayed. In front-page.php, the date and author information should be excluded. Also all the ..-page.php must exclude the date and author information.

New single.php is reflected to view post page in dashboard. But it does not display the Custom Fields.

New page.php is reflected every static pages including home. but Sample page has date and information intact.  Sample page seems controlled by index.php.

4. “Sample Page” -> “Topics” by just editing the page.

5. Consult codex.wordpress.org/Template_Hierarchy.

6. “home” page:

6.1 front-page.php was imported from norikoshop (means: copy&paste from norikoshop/wp-content/themes/adventure-child/). Picture comes up.

6.2 Link to the picture was corrected to current site.

6.3 Anyhow, the link to weather in Tokyo was corrupted. Imported from norikoshop at the admin-panel.

6.4 Modify front-page.php so to exclude author information.

6.5 “home” -> “Home”: simply by edit the page.

7. “About us”:

7.1 Import page-about.php.  Member description overlapped.

7.2 Modified style.css following norikoshop. OK as far as “About us” concerns, but needs further assessment because this affected “Topics”, namely index.php. Perhaps “class clearfix” is the key to avoid overlapping.

8. “Kamakura Guided Tour”

8.1 page-kamakura.php is imported.

8.2 author information was excluded in page-kamakura.php.

8.3 Trailing blank was stripped. Breadcrumb was included.

9. Set up Menu:

9.1 Create menu “main_navi”

10. “Kamakura Tour Courses”

10.1 Import page-kamakura_courses.php.

10.2 Modify style.css: include aux3.css.  the post  background is white . Need more work.

10.3 Import images folder to include flags and buttons.

10.4 Anyhow, “Contact me” needed correction.

10.5 Correction was needed in page-kamakura_courses.php as to ref to contact.

10.6 Every link in the chart must be corrected, otherwise it jumps to japantourguide.

10.6.1 Double click the link item; edit/insert will pop up; search for the linked page; select & update;

10.7 single-pop_kamakura.php should be imported: this makes linked page fully displayed including custom field.

“Kamakura Tour Courses” is incomplete.  “Contact” at the very end of page linked to japantourguide page. Also I don’t have any means to change Fee table.

11. “Popular Sites in Kamakura”

11.1 Import: page-popular-sites-in-kamakura.php.  I don’t like file name, but seems working all right.

11.2  In dashboard; Settinggs->Reading-> 30 posts

12. “The Zazen experience”: needed correction of link.

As a matter of fact, japantourguide shows #404 page for both of temples. He may have mixed up, probably because he changed permalink afterwords. This kind of internal link must be set or checked after the permalink change.

13. In reference to 11., 12., I noticed some of the pages of pop_sites_in_kamakura has some extra image custom fields which links to http://Japantourguide. Since these are not displayed anyway, I deleted these custom fields images to avoid possible problems while migration of the site. I am pretty sure that the links to the pictures inside the posts are properly transformed to the new site address. I strongly suggest to put every picture in the post from this viewpoint. Also the size of picture need not be carefully adjusted. It can be adjusted in the course of editing. Picture better be rather large, since the size reduction in editing does not deteriorate the picture quality, whereas the enlargement will deteriorate the quality.

14. Up to Here, Home and Kamakura are basically finished; remains are

14.1 link from the tour courses.

14.2 Mysterious  jump from the “Contact” at the bottom of tor courses.

 

Restart wptest Successfully

WordPress Database Reset; successful. I checked the box “Reactivate plugins …..after reset”.  The status of plug-in’s seems holding the ones before the reset.

For the sake of safety, removed wptest/wp-content/uploads  as root.

In settings->media settings: uncheck ” Organize my uploads into month- and year-based folders”.

Later, checked the background image changeability several times on adventure and adventure-child. While that process, Mt.Fuji images are uploaded. Background image was controlled succesfully in both of themes.  But interestingly or strangely, the “Strict Standards: only variables should be ……..” message only appeared in adventure-child theme.

Most cumbersome process: CPT UI; This is necessary for smooth import. I better try to leave the tables related intact in the Database Reset procedure.

import   tokyokamakuraguidedtour.wordpress. 2014-03-14.org.xml;

Successful: with messages

Strict Standards: Redefining already defined constructor for class WXR_Parser_Regex in /var/www/wptest/wp-content/plugins/wordpress-importer/parsers.php on line 408

Strict Standards: Declaration of WP_Import::bump_request_timeout() should be compatible with WP_Importer::bump_request_timeout($val) in /var/www/wptest/wp-content/plugins/wordpress-importer/wordpress-importer.php on line 38

Title and Tagline seems not imported.

Background image seems preserved as was set before the import : (not sure)

Front page shows 2 posts; one is Hello World, the other seems trial psot before the import. 4lines of Strict …. in adveture/functions.php line56.

2 are in black letter, the other 2 are in blue letter.

Those 4lines are gone when comment information set “off”.

Front page and post page setup woked and now;

fornt page shows the home page and sample page shows posts.

Media link: e.g. image in “about Kamakura” is properly linked to the images in wptest/wp-content/uploads/….

I guess import worked perfect.

Up to this point, theme was adventure child: folder contains only style.css which imports style.css of adventure.  No files else.

Parent “adventure” is rather simple; only 14 files and 4 folders:

“home” (static) page seems following page.php

“sample page” (ost page) seems following single.php

Permalin settings changed succesfully to Post name type.

 

 

 

 

 

 

 

 

 

 

文字コード、改行

(CMS一般に) UTF-8, BOM なし (UTF-8Nと呼ぶ場合あり、あまり適当な名称ではないらしい)

(UNIX系一般に) LFのみ: CRLFでも大丈夫な場合多いが、php fileでエラーおこすことあり。 ファイル末の余分な改行コードがエラー原因になることもある。

WP migration procedure

1. Export  everything from the source WP ( dashboard -> tool-> export)

2. In target WP, probably better to clear database using plugin “WordPress Database Reset”.

3. Prepare: custom post type, CPT UI setting, custom taxonomy, plugins. Don’t migrate the files and media.  Setting for “uploads” must be same as the source WP.

For example, if the “All in One SEO Pack” has been installed, the setting will be migrated through export-import procedure.

permalink settings might be set to default; it can be set after migration smoothly if the apache  and .htaccess are properly set.

4. Import!

5. Better to check the ref. to the source WP especially on the media. Firefox “要素を調査” is convenient tool for this.

6. Change permalinks. If failed, check .htaccess and apache setting; rewrite module and setting in enabled site.  .htaccess must be rewritable: check the permission for this file and directory.

7. Migrate (php) files. No need to migrate media, they should already be present.

set apache2 to include mod_rewrite and related

/etc/apache2:

a2enmod rewrite;

/etc/init.d/apache2 force-reload;

service apache2 restart;

——————————————————

.htaccess file is present at the wp root directory ( var/www/norikoshop/) with almost no content.

rewrite it:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /norikoshop/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /norikoshop/index.php [L]
</IfModule>
# END WordPres

change permalink in 192.168.0.16/norikoshop doesn’t work.

Now clean the web: (Clean URLs with Apache 2 on Debian: on web)

/etc/apache2/sites-available;

cp default default org;

gksudo gedit default;

Directory /var/www/
Options Indexes FollowSymLinks MultiViews
AllowOverride None

to

Directory /var/www/
Options Indexes FollowSymLinks MultiViews
AllowOverride All

sudo a2ensite default;

sudo service apache2 reload;

change permalink in  192.168.0.16/norikoshop/   successfully worked.