OSDN Git Service

Revert "4.0のtrunkを展開するためにmasterディレクトリを作成しファイル群を移動した。"
[nucleus-jp/nucleus-jp-ancient.git] / nucleus / upgrades / index.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2011 The Nucleus Group
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * (see nucleus/documentation/index.html#license for more info)
11  */
12 /**
13  * @license http://nucleuscms.org/license.txt GNU General Public License
14  * @copyright Copyright (C) 2002-2011 The Nucleus Group
15  * @version $Id$
16  * $NucleusJP: index.php,v 1.11 2007/04/26 08:45:26 kimitake Exp $
17  *
18  */
19
20 include('upgrade.functions.php');
21
22 // check if logged in etc
23 if (!$member->isLoggedIn()) {
24         upgrade_showLogin('index.php');
25 }
26
27 if (!$member->isAdmin()) {
28         upgrade_error('Super-admin(最高管理者)のみがアップグレードを実行できます。');
29 }
30
31 upgrade_head();
32
33 ?>
34
35 <h1>アップグレードスクリプト集</h1>
36
37 <div class="note">
38 <b>Note:</b> もし古いバージョンの Nuclues からアップグレードしようとしているのでなければ(つまりまっさらな状態からインストールしたのであれば)、これらのスクリプト集は必要ありません。
39 </div>
40
41 <p>Nucleus CMSはバージョンアップ毎に、データベースのテーブル構造を少しずつ変えています。このスクリプト集は、古いバージョンの Nucleus からアップグレードする際に必要な、データベーステーブルのアップグレードを行います。</p>
42
43 <?php   // calculate current version
44         if (!upgrade_checkinstall(96)) $current = 95;
45         else    if (!upgrade_checkinstall(100)) $current = 96;
46         else    if (!upgrade_checkinstall(110)) $current = 100;
47         else    if (!upgrade_checkinstall(150)) $current = 110;
48         else    if (!upgrade_checkinstall(200)) $current = 150;
49         else    if (!upgrade_checkinstall(250)) $current = 200;
50         else    if (!upgrade_checkinstall(300)) $current = 250;
51         else    if (!upgrade_checkinstall(310)) $current = 300;
52         else    if (!upgrade_checkinstall(320)) $current = 310;
53         else    if (!upgrade_checkinstall(330)) $current = 320;
54         else    if (!upgrade_checkinstall(331)) $current = 330;
55         else    if (!upgrade_checkinstall(340)) $current = 331;
56         else    if (!upgrade_checkinstall(350)) $current = 340;
57         else    if (!upgrade_checkinstall(360)) $current = 350;
58         else    $current = 360;
59         
60         if ($current == 360) {
61 ?>
62 <p class="ok">自動でできるアップグレードはありません。データベースは既に最新の Nucleus 用にアップデートされています。</p>         
63 <?php
64         } else {
65                 if (phpversion() < '5.0.0') {
66 ?>              
67 <p class="deprecated">警告! 動作しているPHPのバージョンが古く、正常な動作を保証できません。アップグレード作業を中止して、PHP5以上が使えないかどうか、サーバ管理者に確認して下さい。</p>
68 <?php           
69                 }
70 ?>
71 <p class="warning"><a href="upgrade.php?from=<?php echo $current?>">ここをクリックしてデータベースを Nucleus v3.62 用にアップグレードします</a></p>
72 <?php
73          }
74 ?>
75
76 <div class="note">
77 <b>注意:</b> 作業中、各ステップごとにデータベースのバックアップを忘れないようにして下さい。
78
79 </div>
80
81 <h1>手動変更</h1>
82
83 <p>いくつかの変更は手動で行う必要があります。下記にその手順を示します。</p>
84
85 <?php
86 $from = intGetVar('from');
87 if (!$from) 
88         $from = $current;
89
90 $sth = 0;
91 if (!$DIR_MEDIA) {
92         upgrade_manual_96();
93         $sth = 1;
94 }
95 if (!$DIR_SKINS) {
96         upgrade_manual_20();
97         $sth = 1;
98 }
99
100 // some manual code changes are needed in order to get Nucleus to work on php version
101 // lower than 4.0.6
102 if (phpversion() < '4.0.6') {
103         upgrade_manual_php405();
104         $sth = 1;
105 }
106
107 // from v3.3, atom feed supports 1.0 and blogsetting is added
108 $sth = upgrade_manual_atom1_0();
109
110 // upgrades from pre-340 version need to be told of recommended .htaccess files for the media and skins folders.
111 // these .htaccess files are included in new installs of 340 or higher
112 if (in_array($from,array(95,96)) || $from < 340) {
113         upgrade_manual_340();
114         $sth = 1;
115
116
117 // upgrades from pre-350 version need to be told of deprecation of PHP4 support and two new plugins 
118 // included with 3.51 and higher
119 if (in_array($from,array(95,96)) || $from < 350) {
120         upgrade_manual_350();
121         $sth = 1;
122
123
124 if ($sth == 0)
125         echo "<p class='ok'>手動変更は必要ありません。今日はラッキーな日ですね!</p>";
126
127
128
129 upgrade_foot();
130
131 function upgrade_todo($ver) {
132         return upgrade_checkinstall($ver) ? "(<span class='ok'>インストール済み</span>)" : "(<span class='warning'>インストールが必要</span>)";
133 }
134
135 function upgrade_manual_96() {
136         global $DIR_NUCLEUS;
137
138         $guess = str_replace("/nucleus/","/media/",$DIR_NUCLEUS);
139 ?>
140         <h2>Nucleus 0.96 用に必要な変更</h2>
141         <p>
142                 メディア機能を使用するために<i>config.php</i>を手動で変更する必要があります。下記の通り追加します:
143         </p>
144         <pre>
145         // path to media dir
146         $DIR_MEDIA = '<b><?php echo htmlspecialchars($guess)?></b>';
147         </pre>
148
149         <p>
150         また、ディレクトリもあなた自身の手で作る必要があります。もしファイルのアップロードを可能にしたいのであれば、media/ ディレクトリのパーミッションを777にします。(Nucleus 0.96+ のためのパーミッションの設定に関するクイックガイドが documentation/tips.html にあります)
151         </p>
152
153 <?php }
154
155 function upgrade_manual_200() {
156         global $DIR_NUCLEUS;
157
158         $guess = str_replace("/nucleus/","/skins/",$DIR_NUCLEUS);
159 ?>
160         <h2>Nucleus 2.0 用に必要な変更</h2>
161         <p>
162                 スキンの取り込み機能を使用するために<i>config.php</i>を手動で変更する必要があります。下記の通り追加します:
163         </p>
164         <pre>
165         // extra skin files for imported skins
166         $DIR_SKINS = '<b><?php echo htmlspecialchars($guess)?></b>';
167         </pre>
168
169         <p>また、ディレクトリもあなた自身の手で作る必要があります。これでダウンロードしたスキンを上記ディレクトリに展開したり、Nucleus 管理画面から取り込んだりできるようになります。</p>
170
171         <h3>RSS 2.0 と RSD スキン</h3>
172
173         <p>Nucleus 2.0 を新規にインストールしたとき、RSD(Really Simple Discovery) 用のスキンの他に、RSS 2.0(Really Simple Syndication)用のスキンもまたインストールされます。<code>xml-rss2.php</code> と <code>rsd.php</code> の両ファイルはアップグレードされますが、スキンに関しては手動でインストールする必要があります。<code>upgrade-files</code>の中身をアップロードしたあと、管理者画面を開き、管理ホームにあるスキンの「読込/書出」を開きます。そこから両スキンをインストールすることができます(もしインストールするつもりがなければ、しなくても結構です)。</p>
174
175 <?php }
176
177 function upgrade_manual_340() {
178         global $DIR_NUCLEUS;
179
180 ?>
181         <h2>Nucleus 3.4 用に必要な変更</h2>
182         <p>
183                 <em>skins</em>ディレクトリと<em>media</em>ディレクトリに「.haccess」を設置して、アクセス制限をかけることが推奨されます。この変更は、Nucleusの機能やセキュリティに直接関係があるわけではありませんが、不正アクセスを防ぐ為の重要な助けになるでしょう。
184         </p>
185         
186         <p>
187                 手順は以下の2つのファイルに書いてありますので参考にしてください:
188                 <ul>
189                          <li><a href="../../extra/htaccess/media/readme.ja.txt">extra/htaccess/media/readme.ja.txt</a></li>
190                          <li><a href="../../extra/htaccess/skins/readme.ja.txt">extra/htaccess/skins/readme.ja.txt</a></li>
191                 </ul>
192         </p>
193         
194 <?php }
195
196 function upgrade_manual_350() {
197         global $DIR_NUCLEUS;
198
199 ?>
200         <h2>Nucleus 3.51に関する重要なお知らせ</h2>
201         
202 <?php   // Give user warning if they are running old version of PHP
203                                 if (phpversion() < '5') {
204                                                                 echo '<p>警告:サーバで稼動しているPHPのバージョンが、NucleusCMSの動作保障外の古いバージョンのようです。PHP5以上にアップグレードしてください!</p>';
205                                 }
206 }
207
208 function upgrade_manual_php405() {
209 ?>
210 <h2>PHP のバージョンが 4.0.3, 4.0.4 または 4.0.5 の場合に必要となる変更</h2>
211 <p>
212         PHP のバージョンが 4.0.6 より以前の場合、変更が必要なファイルが2つあります。PHP のバージョンを 4.0.6 や 4.2.2+以降のものにアップグレードした方がいいでしょう(4.0.6 や 4.2.2 以前のものにはセキュリティー問題があります)。もし PHP のアップグレードが困難もしくは、する予定がない場合は、以下のファイルを変更して下さい。
213 </p>
214 <ul>
215         <li>nucleus/libs/PARSER.php のコードが下記のようになっていることを確認して下さい。(84行目から):
216                 <pre>
217
218         if (in_array($actionlc, $this-&gt;actions) || $this-&gt;norestrictions ) {
219                 <strong>$this-&gt;call_using_array($action, $this-&gt;handler, $params);</strong>
220         } else {
221                 // redirect to plugin action if possible
222                 if (in_array('plugin', $this-&gt;actions)
223                         && $manager-&gt;pluginInstalled('NP_'.$action))
224                         $this-&gt;doAction('plugin('.$action.
225                                 $this-&gt;pdelim.implode($this-&gt;pdelim,$params).')');
226                 else
227                         echo '&lt;b&gt;DISALLOWED (' , $action , ')&lt;/b&gt;';
228         }
229
230
231 }
232                  </pre>
233                 </li>
234                 <li>nucleus/libs/PARSER.php のコードが下記のようになっていることを確認して下さい。(75行目から):
235                 <pre>
236 // $params = array_map('trim',$params);
237 foreach ($params as $key =&gt; $value) { $params[$key] = trim($value); }
238                 </pre>
239                 </li>
240         </ul>
241
242 <?php }
243
244 function upgrade_manual_atom1_0() {
245
246                 $sth = 0;
247
248                 // atom 1.0
249                 $query = 'SELECT sddesc FROM ' . sql_table('skin_desc')
250                                 . ' WHERE sdname="feeds/atom"';
251                 $res = mysql_query($query);
252                 while ($o = mysql_fetch_object($res)) {
253                                 if ($o->sddesc=='Atom 0.3 weblog syndication')
254                                 {
255                                                 $sth = 1;
256 ?>
257 <h2>Atom 1.0</h2>
258 <p>Nucleus 3.3 から atom feed が 1.0 対応になりましたので、次の手順でスキン・テンプレートのアップグレードをして下さい。</p>
259
260 <p>管理者画面を開き、管理ホームにあるスキンの「読込/書出」を開きます。そこから atom を選択し、読み込みボタンを押して上書きインストールしてください。</p>
261
262 <p>もし atom のスキンやテンプレートを変更している場合は、既存の内容をファイルに書き出して(skinbackup.xml というファイルが作成されます)、/skins/atom/skinbackup.xml (これが新しいファイル)と比較し、この新しいファイルを更新します。その後、前述の通り管理者画面からスキンの「読込/書出」を開いて同様にして上書きインストールして下さい。</p>
263
264 <?php
265                                 }
266                 }
267
268                 // default skin
269                 $query = 'SELECT tdnumber FROM ' . sql_table('template_desc')
270                                          . ' WHERE tdname="default/index"';
271                 $res = mysql_query($query);
272                 $tdnumber = 0;
273                 while ($o = mysql_fetch_object($res)) {
274                                 $tdnumber = $o->tdnumber;
275                 }
276                 if ($tdnumber>0)
277                 {
278                                 $query = 'SELECT tpartname FROM ' . sql_table('template')
279                                                          . ' WHERE tdesc=' . $tdnumber . ' AND tpartname="BLOGLIST_LISTITEM"';
280                                 $res = mysql_query($query);
281                                 if (!mysql_fetch_object($res)) {
282
283                                                 $sth = 1;
284 ?>
285 <h2>Default スキン</h2>
286 <p>Nucleus 3.3 からいくつかのフォームの CSS が変更になっています。たとえば最初のページのログインフォームや、コメント投稿のためのフォームなど。このためフォームの表示が崩れるので、次の手順でDefault スキンのアップグレードをして下さい。</p>
287
288 <p>管理者画面を開き、管理ホームにあるスキンの「読込/書出」を開きます。そこから default を選択し、読み込みボタンを押して上書きインストールしてください。</p>
289
290 <p>もし default のスキンやテンプレートを変更している場合は、既存の内容をファイルに書き出して(skinbackup.xml というファイルが作成されます)、/skins/default/skinbackup.xml (これが新しいファイル)と比較し、この新しいファイルを更新します。その後、前述の通り管理者画面からスキンの「読込/書出」を開いて同様にして上書きインストールして下さい。</p>
291 <?php
292                                 }
293                 }
294
295                 return $sth;
296 }
297
298 ?>