end0tknr's kipple - 新web写経開発

http://d.hatena.ne.jp/end0tknr/ から移転しました

wordPress ver.4.0.17 をapache v2.2+php v.5.6.31環境へinstall

先日構築した apache v2.2+php v.5.6.31環境へwordPress ver.4.0.17 をinstall。

今回は、単にinstallするだけで、より深い調査は別途

end0tknr.hateblo.jp

wordpress の install

create database と download wordpress

$ /usr/local/mysql/bin/mysql -u root
mysql> CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8;
$ cd /home/endo/dev/Test
$ wget https://wordpress.org/wordpress-4.0.17.tar.gz
$ tar -zxvf wordpress-4.0.17.tar.gz

ブラウザで wordpress/ を設定すれば完了

wordpress installによる変化点

fileの変化点

自動でinstallされるのは、楽チンですが、何が起こっているのか、 不安?ですので、diffとってみました。以下、diff抜粋です。

ver.4.0.17 -> 4.0.18 に自動updateされたみたい

$ diff -r wordpress_org wordpress
diff -r wordpress_org/readme.html wordpress/readme.html
<    <br /> Version 4.0.17
>    <br /> Version 4.0.18

なんだか、ゴチャゴチャ変更されていましたが、ver.4.0.17 -> 4.0.18 の影響のようですね。 changelogを読めば、詳細を理解できると思いますが、今回は割愛。

diff -r wordpress_org/wp-admin/about.php wordpress/wp-admin/about.php
<    <h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 17 ); ?></h3>
>    <h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 18 ); ?></h3>
  :
diff -r wordpress_org/wp-admin/includes/file.php wordpress/wp-admin/includes/file.php
  :
<    $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? wp_unslash( $_POST['hostname'] ) : $credentials['hostname']);
<    $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? wp_unslash( $_POST['username'] ) : $credentials['username']);
<    $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? wp_unslash( $_POST['password'] ) : '');
---
>    $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($submitted_form['hostname']) ? $submitted_form['hostname'] : $credentials['hostname']);
>    $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($submitted_form['username']) ? $submitted_form['username'] : $credentials['username']);
>    $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($submitted_form['password']) ? $submitted_form['password'] : '');
:
diff -r wordpress_org/wp-includes/class-wp-customize-manager.php wordpress/wp-includes/class-wp-customize-manager.php
  :
diff -r wordpress_org/wp-includes/class-wp-xmlrpc-server.php wordpress/wp-includes/class-wp-xmlrpc-server.php
  :
diff -r wordpress_org/wp-includes/version.php wordpress/wp-includes/version.php
< $wp_version = '4.0.17';
> $wp_version = '4.0.18';

Only in wordpress/wp-content: upgrade

jsもゴチャゴチャ変更されていましたが、こちらもver.4.0.17 -> 4.0.18 の影響のようですね。

diff -r wordpress_org/wp-admin/js/customize-controls.js wordpress/wp-admin/js/customize-controls.js
  :
diff -r wordpress_org/wp-admin/js/customize-controls.min.js wordpress/wp-admin/js/customize-controls.min.js
  :
diff -r wordpress_org/wp-includes/js/plupload/handlers.js wordpress/wp-includes/js/plupload/handlers.js
 :
diff -r wordpress_org/wp-includes/js/plupload/handlers.min.js wordpress/wp-includes/js/plupload/handlers.min.js
 :

ブラウザで日本語を選択すると、言語packも wordpressが自動downloadするみたい

Only in wordpress/wp-content: languages

db接続情報等は、 wp-config.php に記載されていました。

Only in wordpress: wp-config.php

databaseの変化点

$ /usr/local/mysql/bin/mysql -u root wordpress;

mysql> show tables;
+-----------------------+
| Tables_in_wordpress   |
+-----------------------+
| wp_commentmeta        |
| wp_comments           |
| wp_links              |
| wp_options            |
| wp_postmeta           |
| wp_posts              |
| wp_term_relationships |
| wp_term_taxonomy      |
| wp_terms              |
| wp_usermeta           |
| wp_users              |
+-----------------------+

mysql> desc wp_commentmeta;
+------------+---------------------+------+-----+---------+----------------+
| Field      | Type                | Null | Key | Default | Extra          |
+------------+---------------------+------+-----+---------+----------------+
| meta_id    | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| comment_id | bigint(20) unsigned | NO   | MUL | 0       |                |
| meta_key   | varchar(255)        | YES  | MUL | NULL    |                |
| meta_value | longtext            | YES  |     | NULL    |                |
+------------+---------------------+------+-----+---------+----------------+

↓サンプルのコメントが登録されています

mysql> desc wp_comments;
+----------------------+---------------------+------+-----+---------------------+----------------+
| Field                | Type                | Null | Key | Default             | Extra          |
+----------------------+---------------------+------+-----+---------------------+----------------+
| comment_ID           | bigint(20) unsigned | NO   | PRI | NULL                | auto_increment |
| comment_post_ID      | bigint(20) unsigned | NO   | MUL | 0                   |                |
| comment_author       | tinytext            | NO   |     | NULL                |                |
| comment_author_email | varchar(100)        | NO   | MUL |                     |                |
| comment_author_url   | varchar(200)        | NO   |     |                     |                |
| comment_author_IP    | varchar(100)        | NO   |     |                     |                |
| comment_date         | datetime            | NO   |     | 0000-00-00 00:00:00 |                |
| comment_date_gmt     | datetime            | NO   | MUL | 0000-00-00 00:00:00 |                |
| comment_content      | text                | NO   |     | NULL                |                |
| comment_karma        | int(11)             | NO   |     | 0                   |                |
| comment_approved     | varchar(20)         | NO   | MUL | 1                   |                |
| comment_agent        | varchar(255)        | NO   |     |                     |                |
| comment_type         | varchar(20)         | NO   |     |                     |                |
| comment_parent       | bigint(20) unsigned | NO   | MUL | 0                   |                |
| user_id              | bigint(20) unsigned | NO   |     | 0                   |                |
+----------------------+---------------------+------+-----+---------------------+----------------+
15 rows in set (0.00 sec)

mysql> select * from wp_comments\G
*************************** 1. row ***************************
          comment_ID: 1
     comment_post_ID: 1
      comment_author: Mr WordPress
comment_author_email: 
  comment_author_url: https://wordpress.org/
   comment_author_IP: 
        comment_date: 2017-08-14 05:30:05
    comment_date_gmt: 2017-08-14 05:30:05
     comment_content: これはコメントです。
コメントを削除するには、ログインして投稿編集画面でコメントを表示してください。編集または削除するオプションが用意されています。
       comment_karma: 0
    comment_approved: 1
       comment_agent: 
        comment_type: 
      comment_parent: 0
             user_id: 0
1 row in set (0.00 sec)
mysql> desc wp_links;
+------------------+---------------------+------+-----+---------------------+----------------+
| Field            | Type                | Null | Key | Default             | Extra          |
+------------------+---------------------+------+-----+---------------------+----------------+
| link_id          | bigint(20) unsigned | NO   | PRI | NULL                | auto_increment |
| link_url         | varchar(255)        | NO   |     |                     |                |
| link_name        | varchar(255)        | NO   |     |                     |                |
| link_image       | varchar(255)        | NO   |     |                     |                |
| link_target      | varchar(25)         | NO   |     |                     |                |
| link_description | varchar(255)        | NO   |     |                     |                |
| link_visible     | varchar(20)         | NO   | MUL | Y                   |                |
| link_owner       | bigint(20) unsigned | NO   |     | 1                   |                |
| link_rating      | int(11)             | NO   |     | 0                   |                |
| link_updated     | datetime            | NO   |     | 0000-00-00 00:00:00 |                |
| link_rel         | varchar(255)        | NO   |     |                     |                |
| link_notes       | mediumtext          | NO   |     | NULL                |                |
| link_rss         | varchar(255)        | NO   |     |                     |                |
+------------------+---------------------+------+-----+---------------------+----------------+

tbl:wp_optionsは、selectもしましたが、様々なrecordがありましたので、 ここでは記載していません。なんだろう…

mysql> desc wp_options;
+--------------+---------------------+------+-----+---------+----------------+
| Field        | Type                | Null | Key | Default | Extra          |
+--------------+---------------------+------+-----+---------+----------------+
| option_id    | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| option_name  | varchar(64)         | NO   | UNI |         |                |
| option_value | longtext            | NO   |     | NULL    |                |
| autoload     | varchar(20)         | NO   |     | yes     |                |
+--------------+---------------------+------+-----+---------+----------------+
mysql> desc wp_postmeta;
+------------+---------------------+------+-----+---------+----------------+
| Field      | Type                | Null | Key | Default | Extra          |
+------------+---------------------+------+-----+---------+----------------+
| meta_id    | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| post_id    | bigint(20) unsigned | NO   | MUL | 0       |                |
| meta_key   | varchar(255)        | YES  | MUL | NULL    |                |
| meta_value | longtext            | YES  |     | NULL    |                |
+------------+---------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql> select * from wp_postmeta;
+---------+---------+-------------------+------------+
| meta_id | post_id | meta_key          | meta_value |
+---------+---------+-------------------+------------+
|       1 |       2 | _wp_page_template | default    |
+---------+---------+-------------------+------------+

サンプル投稿やサンプル固定ページが登録されているようです

mysql> desc wp_posts;
+-----------------------+---------------------+------+-----+---------------------+----------------+
| Field                 | Type                | Null | Key | Default             | Extra          |
+-----------------------+---------------------+------+-----+---------------------+----------------+
| ID                    | bigint(20) unsigned | NO   | PRI | NULL                | auto_increment |
| post_author           | bigint(20) unsigned | NO   | MUL | 0                   |                |
| post_date             | datetime            | NO   |     | 0000-00-00 00:00:00 |                |
| post_date_gmt         | datetime            | NO   |     | 0000-00-00 00:00:00 |                |
| post_content          | longtext            | NO   |     | NULL                |                |
| post_title            | text                | NO   |     | NULL                |                |
| post_excerpt          | text                | NO   |     | NULL                |                |
| post_status           | varchar(20)         | NO   |     | publish             |                |
| comment_status        | varchar(20)         | NO   |     | open                |                |
| ping_status           | varchar(20)         | NO   |     | open                |                |
| post_password         | varchar(20)         | NO   |     |                     |                |
| post_name             | varchar(200)        | NO   | MUL |                     |                |
| to_ping               | text                | NO   |     | NULL                |                |
| pinged                | text                | NO   |     | NULL                |                |
| post_modified         | datetime            | NO   |     | 0000-00-00 00:00:00 |                |
| post_modified_gmt     | datetime            | NO   |     | 0000-00-00 00:00:00 |                |
| post_content_filtered | longtext            | NO   |     | NULL                |                |
| post_parent           | bigint(20) unsigned | NO   | MUL | 0                   |                |
| guid                  | varchar(255)        | NO   |     |                     |                |
| menu_order            | int(11)             | NO   |     | 0                   |                |
| post_type             | varchar(20)         | NO   | MUL | post                |                |
| post_mime_type        | varchar(100)        | NO   |     |                     |                |
| comment_count         | bigint(20)          | NO   |     | 0                   |                |
+-----------------------+---------------------+------+-----+---------------------+----------------+
23 rows in set (0.00 sec)

mysql> select * from wp_posts\G
*************************** 1. row ***************************
                   ID: 1
          post_author: 1
            post_date: 2017-08-14 05:30:05
        post_date_gmt: 2017-08-14 05:30:05
         post_content: WordPress へようこそ。これは最初の投稿です。編集もしくは削除してブログを始めてください !
           post_title: Hello world!
         post_excerpt: 
          post_status: publish
       comment_status: open
          ping_status: open
        post_password: 
            post_name: hello-world
              to_ping: 
               pinged: 
        post_modified: 2017-08-14 05:30:05
    post_modified_gmt: 2017-08-14 05:30:05
post_content_filtered: 
          post_parent: 0
                 guid: http://cent7.a5.jp:8081/wordpress/?p=1
           menu_order: 0
            post_type: post
       post_mime_type: 
        comment_count: 1
*************************** 2. row ***************************
                   ID: 2
          post_author: 1
            post_date: 2017-08-14 05:30:05
        post_date_gmt: 2017-08-14 05:30:05
         post_content: これはサンプルページです。同じ位置に固定され、(多くのテーマでは) サイトナビゲーションメニューに含まれるため、ブログ投稿とは異なります。サイト訪問者に対して自分のことを説明する自己紹介ページを作成するのが一般的です。たとえば以下のようなものになります。 

<blockquote>はじめまして。昼間はバイク便のメッセンジャーとして働いていますが、俳優志望でもあります。これは僕のブログです。ロサンゼルスに住み、ジャックという名前のかわいい犬を飼っています。好きなものはピニャコラーダ (通り雨に濡れるのも) 。</blockquote>

または、このようなものでもよいでしょう。

<blockquote>XYZ 小道具株式会社は1971年の創立以来、高品質の小道具を皆様にご提供させていただいています。ゴッサム・シティに所在する当社では2,000名以上の社員が働いており、様々な形で地域のコミュニティへ貢献しています。</blockquote>

新しく WordPress ユーザーになった方は、<a href="http://cent7.a5.jp:8081/wordpress/wp-admin/">ダッシュボード</a>へ行ってこのページを削除し、独自のコンテンツを含む新しいページを作成してください。それでは、お楽しみください !
           post_title: サンプルページ
         post_excerpt: 
          post_status: publish
       comment_status: open
          ping_status: open
        post_password: 
            post_name: sample-page
              to_ping: 
               pinged: 
        post_modified: 2017-08-14 05:30:05
    post_modified_gmt: 2017-08-14 05:30:05
post_content_filtered: 
          post_parent: 0
                 guid: http://cent7.a5.jp:8081/wordpress/?page_id=2
           menu_order: 0
            post_type: page
       post_mime_type: 
        comment_count: 0
*************************** 3. row ***************************
                   ID: 3
          post_author: 1
            post_date: 2017-08-14 14:30:14
        post_date_gmt: 0000-00-00 00:00:00
         post_content: 
           post_title: 自動下書き
         post_excerpt: 
          post_status: auto-draft
       comment_status: open
          ping_status: open
        post_password: 
            post_name: 
              to_ping: 
               pinged: 
        post_modified: 2017-08-14 14:30:14
    post_modified_gmt: 0000-00-00 00:00:00
post_content_filtered: 
          post_parent: 0
                 guid: http://cent7.a5.jp:8081/wordpress/?p=3
           menu_order: 0
            post_type: post
       post_mime_type: 
        comment_count: 0
3 rows in set (0.00 sec)
mysql> desc wp_term_relationships;
+------------------+---------------------+------+-----+---------+-------+
| Field            | Type                | Null | Key | Default | Extra |
+------------------+---------------------+------+-----+---------+-------+
| object_id        | bigint(20) unsigned | NO   | PRI | 0       |       |
| term_taxonomy_id | bigint(20) unsigned | NO   | PRI | 0       |       |
| term_order       | int(11)             | NO   |     | 0       |       |
+------------------+---------------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> select * from wp_term_relationships;
+-----------+------------------+------------+
| object_id | term_taxonomy_id | term_order |
+-----------+------------------+------------+
|         1 |                1 |          0 |
+-----------+------------------+------------+

taxonomy = 分類?

mysql> desc wp_term_taxonomy;
+------------------+---------------------+------+-----+---------+----------------+
| Field            | Type                | Null | Key | Default | Extra          |
+------------------+---------------------+------+-----+---------+----------------+
| term_taxonomy_id | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| term_id          | bigint(20) unsigned | NO   | MUL | 0       |                |
| taxonomy         | varchar(32)         | NO   | MUL |         |                |
| description      | longtext            | NO   |     | NULL    |                |
| parent           | bigint(20) unsigned | NO   |     | 0       |                |
| count            | bigint(20)          | NO   |     | 0       |                |
+------------------+---------------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

mysql> select * from wp_term_taxonomy;
+------------------+---------+----------+-------------+--------+-------+
| term_taxonomy_id | term_id | taxonomy | description | parent | count |
+------------------+---------+----------+-------------+--------+-------+
|                1 |       1 | category |             |      0 |     1 |
+------------------+---------+----------+-------------+--------+-------+
mysql> desc wp_terms;
+------------+---------------------+------+-----+---------+----------------+
| Field      | Type                | Null | Key | Default | Extra          |
+------------+---------------------+------+-----+---------+----------------+
| term_id    | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| name       | varchar(200)        | NO   | MUL |         |                |
| slug       | varchar(200)        | NO   | UNI |         |                |
| term_group | bigint(10)          | NO   |     | 0       |                |
+------------+---------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql> select * from wp_terms;
+---------+-----------+-----------------------------+------------+
| term_id | name      | slug                        | term_group |
+---------+-----------+-----------------------------+------------+
|       1 | 未分類    | %e6%9c%aa%e5%88%86%e9%a1%9e |          0 |
+---------+-----------+-----------------------------+------------+
1 row in set (0.00 sec)

nickname=adminは、私が管理者として入力したidです

mysql> desc wp_usermeta;
+------------+---------------------+------+-----+---------+----------------+
| Field      | Type                | Null | Key | Default | Extra          |
+------------+---------------------+------+-----+---------+----------------+
| umeta_id   | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| user_id    | bigint(20) unsigned | NO   | MUL | 0       |                |
| meta_key   | varchar(255)        | YES  | MUL | NULL    |                |
| meta_value | longtext            | YES  |     | NULL    |                |
+------------+---------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql> select * from wp_usermeta;
+----------+---------+---------------------------------------+---------------------------------------------------------------------------------------------+
| umeta_id | user_id | meta_key                              | meta_value                                                                                  |
+----------+---------+---------------------------------------+---------------------------------------------------------------------------------------------+
|        1 |       1 | nickname                              | admin                                                                                       |
|        2 |       1 | first_name                            |                                                                                             |
|        3 |       1 | last_name                             |                                                                                             |
|        4 |       1 | description                           |                                                                                             |
|        5 |       1 | rich_editing                          | true                                                                                        |
|        6 |       1 | comment_shortcuts                     | false                                                                                       |
|        7 |       1 | admin_color                           | fresh                                                                                       |
|        8 |       1 | use_ssl                               | 0                                                                                           |
|        9 |       1 | show_admin_bar_front                  | true                                                                                        |
|       10 |       1 | wp_capabilities                       | a:1:{s:13:"administrator";b:1;}                                                             |
|       11 |       1 | wp_user_level                         | 10                                                                                          |
|       12 |       1 | dismissed_wp_pointers                 | wp350_media,wp360_revisions,wp360_locks,wp390_widgets                                       |
|       13 |       1 | show_welcome_panel                    | 1                                                                                           |
|       14 |       1 | session_tokens                        | a:1:{s:64:"b37504ae3e92ef97a98b2f0e34324081b42498e66f90872d23d34b21739445da";i:1502861411;} |
|       15 |       1 | wp_user-settings                      | editor=html&wplink=1                                                                        |
|       16 |       1 | wp_user-settings-time                 | 1502688609                                                                                  |
|       17 |       1 | wp_dashboard_quick_press_last_post_id | 3                                                                                           |
+----------+---------+---------------------------------------+---------------------------------------------------------------------------------------------+
17 rows in set (0.00 sec)
mysql> desc wp_users;
+---------------------+---------------------+------+-----+---------------------+----------------+
| Field               | Type                | Null | Key | Default             | Extra          |
+---------------------+---------------------+------+-----+---------------------+----------------+
| ID                  | bigint(20) unsigned | NO   | PRI | NULL                | auto_increment |
| user_login          | varchar(60)         | NO   | MUL |                     |                |
| user_pass           | varchar(64)         | NO   |     |                     |                |
| user_nicename       | varchar(50)         | NO   | MUL |                     |                |
| user_email          | varchar(100)        | NO   |     |                     |                |
| user_url            | varchar(100)        | NO   |     |                     |                |
| user_registered     | datetime            | NO   |     | 0000-00-00 00:00:00 |                |
| user_activation_key | varchar(60)         | NO   |     |                     |                |
| user_status         | int(11)             | NO   |     | 0                   |                |
| display_name        | varchar(250)        | NO   |     |                     |                |
+---------------------+---------------------+------+-----+---------------------+----------------+
10 rows in set (0.00 sec)

mysql> select * from wp_users\G
*************************** 1. row ***************************
                 ID: 1
         user_login: admin
          user_pass: $P$BqSk6XN58YkpWWUILgkrS2Ulshibp51
      user_nicename: admin
         user_email: ないしょ
           user_url: 
    user_registered: 2017-08-14 05:30:05
user_activation_key: 
        user_status: 0
       display_name: admin
1 row in set (0.01 sec)