4.1から4.2へのアップグレードUpgrading To 4.2 From 4.1
PHP 5.4 PHP 5.4
Laravel4.2を動作させるにはPHP 5.4.0以上が必要です。Laravel 4.2 requires PHP 5.4.0 or greater.
暗号化のデフォルトEncryption Defaults
app/config/app.php
設定ファイルに、新しいcipher
オプションが追加されました。このオプションの値は、MCRYPT_RIJNDAEL_256
にすべきでしょう。Add a new cipher
option in your app/config/app.php
configuration file. The value of this option should
be MCRYPT_RIJNDAEL_256
.
'cipher' => MCRYPT_RIJNDAEL_256
この設定は、Laravelの暗号機能により使用される、デフォルトcipherをコントロールするために使用されます。This setting may be used to control the default cipher used by the Laravel encryption facilities.
注意: Laravel4.2では、最も安全な暗号化であると考えられる、
MCRYPT_RIJNDAEL_128
(AES)がデフォルトの暗号化です。cipherをMCRYPT_RIJNDAEL_256
へ戻すことが必要になるのは、Laravel4.1以前のバージョンで暗号化されたクッキー/値を解読する場合です。Note: In Laravel 4.2, the default cipher isMCRYPT_RIJNDAEL_128
(AES), which is considered to be the most secure cipher. Changing the cipher back toMCRYPT_RIJNDAEL_256
is required to decrypt cookies/values that were encrypted in Laravel <= 4.1
ソフトデリートは、トレイトを使用するようになりましたSoft Deleting Models Now Use Traits
モデルのソフトデリートを使用している場合、softDeletes
プロパティーは必要なくなりました。SoftDeletingTrait
を次のように使用してください。If you are using soft deleting
models, the softDeletes
property has
been removed. You must now use the
SoftDeletingTrait
like so:
use Illuminate\Database\Eloquent\SoftDeletingTrait;
class User extends Eloquent {
use SoftDeletingTrait;
}
それから、dates
プロパティーにdeleted_at
カラムを追記してください。You must also manually add the
deleted_at
column to your
dates
property:
class User extends Eloquent {
use SoftDeletingTrait;
protected $dates = ['deleted_at'];
}
ソフトデリート操作のAPIは、今までと変わりありません。The API for all soft delete operations remains the same.
注意:
SoftDeletingTrait
は、ベースモデルで使用してはいけません。実際のモデルクラスで使用します。Note: TheSoftDeletingTrait
can not be applied on a base model. It must be used on an actual model class.
View/PaginationのEnvironmentクラスの名前変更View / Pagination Environment Renamed
もし、Illuminate\View\Environment
クラスか、Illuminate\Pagination\Environment
クラスを直接参照している場合、Illuminate\View\Factory
とIlluminate\Pagination\Factory
を代わりに参照するように、コードを変更してください。この2つのクラスは、機能をより良く表すように名前が変更されました。If you are directly referencing
the Illuminate\View\Environment
class
or Illuminate\Pagination\Environment
class, update your code to reference
Illuminate\View\Factory
and
Illuminate\Pagination\Factory
instead.
These two classes have been renamed to better
reflect their function.
ペジネーションプレゼンテーターの引数追加Additional Parameter On Pagination Presenter
Illuminate\Pagination\Presenter
クラスを拡張している場合、getPageLinkWrapper
抽象メソッドに、rel
引数を追加するように変更してください。If you are extending the
Illuminate\Pagination\Presenter
class,
the abstract method getPageLinkWrapper
signature has changed to add the rel
argument:
abstract public function getPageLinkWrapper($url, $page, $rel = null);
Iron.Ioキューの暗号化Iron.Io Queue Encryption
Iron.ioキュードライバーを使用している場合、新しいencrypt
オプションをキュー設定ファイルに追加する必要があります。If you are using the Iron.io
queue driver, you will need to add a new
encrypt
option to your queue
configuration file:
'encrypt' => true
Upgrading To 4.1.29 From <= 4.1.xUpgrading To 4.1.29 From <= 4.1.x
Laravel4.1.29では、全データベースドライバーのカラムクオーティングが向上しました。Eloquentモデルにfillable
を使用していない場合の、複数代入に関する脆弱性からアプリケーションを保護します。複数代入されるのを防ぐためにモデルにfillable
プロパティを使用している場合には、アプリケーションに脆弱性はありません。しかし、guarded
を使用し、ユーザーがコントロールできる配列を"update"や"save”タイプの機能に渡しているのでしたら、複数代入のリスクにアプリケーションがさらされているため、4.1.29
へすぐアップグレードすべきでしょう。Laravel 4.1.29 improves the
column quoting for all database drivers. This
protects your application from some mass assignment
vulnerabilities when not using the
fillable
property on models. If you are
using the fillable
property on your
models to protect against mass assignment, your
application is not vulnerable. However, if you are
using guarded
and are passing a user
controlled array into an "update" or
"save" type function, you should upgrade
to 4.1.29
immediately as your
application may be at risk of mass
assignment.
Laravel4.1.29へアップグレードするには、composer
update
を実行するだけです。このリリースには、ソース修正が必要な変更は含まれていません。To upgrade to Laravel 4.1.29,
simply composer update
. No breaking
changes are introduced in this release.
4.1.25以下から、4.1.26へのアップグレードUpgrading To 4.1.26 From <= 4.1.25
Laravel 4.1.26では、"Remember me"クッキーへのセキュリティーが強化されました。このアップデート以前は、Remeberクッキーが悪意のあるユーザーによりハイジャックされ、本当のユーザーがアカウントのパスワードをリセットしたり、ログアウトしたりしても、クッキーが長期に渡り有効なままにされてしまいました。Laravel 4.1.26 introduces security improvements for "remember me" cookies. Before this update, if a remember cookie was hijacked by another malicious user, the cookie would remain valid for a long period of time, even after the true owner of the account reset their password, logged out, etc.
今回の変更により、users
テーブル(もしくはユーザー管理を行うためのテーブル)へ、新しいremember_token
カラムを追加する必要があります。この変更により、ユーザーがアプリケーションにログインするたびに、真新しいトークンが割り当てられます。このトークンはユーザーがアプリケーションからログアウトするたびに、再生成されます。この実装により、もしも"Remember
me"クッキがーハイジャックされても、アプリケーションからログアウトすれば、そのクッキーは無効になります。This change requires the addition
of a new remember_token
column to your
users
(or equivalent) database table.
After this change, a fresh token will be assigned to
the user each time they login to your application.
The token will also be refreshed when the user logs
out of the application. The implications of this
change are: if a "remember me" cookie is
hijacked, simply logging out of the application will
invalidate the cookie.
アップデート法Upgrade Path
最初に、新しいremember_token
(null値可能なVARCHAR(100)かTEXTなど)カラムをusers
テーブルに追加してください。First, add a new, nullable
remember_token
of VARCHAR(100), TEXT,
or equivalent to your users
table.
次に、Eloquent認証ドライバーを使用しているのであれば、User
クラスへ以下の3クラスを追加してください。Next, if you are using the
Eloquent authentication driver, update your
User
class with the following three
methods:
public function getRememberToken()
{
return $this->remember_token;
}
public function setRememberToken($value)
{
$this->remember_token = $value;
}
public function getRememberTokenName()
{
return 'remember_token';
}
**注意:**この変更により、現在使用中の"Remember me"セッションは無効となるため、全ユーザーはアプリケーションへの再認証を強制されます。Note: All existing "remember me" sessions will be invalidated by this change, so all users will be forced to re-authenticate with your application.
パッケージメンテナーの方へPackage Maintainers
Illuminate\Auth\UserProviderInterface
へ、新しいメソッドが2つ追加されました。実装のサンプルは、デフォルトドライバーをご覧ください。Two new methods were added to the
Illuminate\Auth\UserProviderInterface
interface. Sample implementations may be found in
the default drivers:
public function retrieveByToken($identifier, $token);
public function updateRememberToken(UserInterface $user, $token);
Illuminate\Auth\UserInterface
にも、「アップデート法」で説明している、新しい3つのメソッドが追加されました。The
Illuminate\Auth\UserInterface
also
received the three new methods described in the
"Upgrade Path".
4.0から4.1へアップグレードUpgrading To 4.1 From 4.0
コンポーサー依存パッケージのアップグレードUpgrading Your Composer Dependency
アプリケーションをLaravel4.1へアップグレードするには、composer.json
ファイルの中のlaravel/framework
のバージョンを4.1に変更します。To upgrade your application to
Laravel 4.1, change your
laravel/framework
version to
4.1.*
in your
composer.json
file.
ファイルの置き換えReplacing Files
public/index.php
ファイルをこのリポジトリーの新バージョンへ置き換えて下さい。Replace your
public/index.php
file with this
fresh copy from the
repository[https://github.com/laravel/laravel/blob/master/public/index.php].
artisan
ファイルをこのリポジトリーの新バージョンへ置き換えて下さい。Replace your artisan
file with this fresh copy from the
repository[https://github.com/laravel/laravel/blob/master/artisan].
設定ファイルとオプションの追加Adding Configuration Files & Options
app/config/app.php
設定ファイル中のaliases
とproviders
配列を更新します。変更する内容はこのファイルで確認して下さい。自分で追加したサービスプロバーダーとエイリアスを書き戻すのを忘れないで下さい。Update your aliases
and providers
arrays in your
app/config/app.php
configuration file.
The updated values for these arrays can be found
in this
file[https://github.com/laravel/laravel/blob/master/app/config/app.php].
Be sure to add your custom and package service
providers / aliases back to the arrays.
新規にapp/config/remote.php
ファイルをこのリポジトリーから取得し、追加して下さい。Add the new
app/config/remote.php
file from the
repository[https://github.com/laravel/laravel/blob/master/app/config/remote.php].
app/config/session.php
ファイルへ新しいexpire_on_close
設定オプションを追加して下さい。デフォルト値はfalse
です。Add the new
expire_on_close
configuration option to
your app/config/session.php
file. The
default value should be
false
.
app/config/queue.php
ファイルへ新しいfailed
設定セクションを追加して下さい。セクションのデフォルト値は以下の通りです。Add the new failed
configuration section to your
app/config/queue.php
file. Here are the
default values for the section:
'failed' => array(
'database' => 'mysql', 'table' => 'failed_jobs',
),
(オプション):app/config/view.php
ファイル中のpagination
設定オプションをpagination::slider-3
に変更することもできます。(Optional)
Update the pagination
configuration
option in your app/config/view.php
file
to pagination::slider-3
.
コントローラーの更新Controller Updates
もし、app/controllers/BaseController.php
が頭のところでuse
文を使用していたら、use
Illuminate\Routing\Controllers\Controller;
をuse
Illuminate\Routing\Controller;
へ変更して下さい。If
app/controllers/BaseController.php
has
a use
statement at the top, change
use
Illuminate\Routing\Controllers\Controller;
to use
Illuminate\Routing\Controller;
.
パスワードリマインダーの更新Password Reminders Updates
パスワードリマインダーは自由度を増すために全体的に見なおされました。php artisan
auth:reminders-controller
Artisanコマンドを実行し、作成される新しいスタブコントローラーを調べてみて下さい。もしくは、更新されたドキュメントを読み、それに従ってアプリケーションを更新して下さい。Password reminders have been
overhauled for greater flexibility. You may examine
the new stub controller by running the php
artisan auth:reminders-controller
Artisan
command. You may also browse the updated
documentation[/docs/4.2/security#password-reminders-and-reset]
and update your application accordingly.
app/lang/en/reminders.php
言語ファイルをこちらの更新済みファイルに合わせて変更して下さい。Update your
app/lang/en/reminders.php
language file
to match this updated
file[https://github.com/laravel/laravel/blob/master/app/lang/en/reminders.php].
環境決定の更新Environment Detection Updates
セキュリティーの観点から、アプリケーションの環境を決定するためにURLのドメインはもう使用されなくなりました。これらの値は簡単に偽装でき、リクエストの環境を変更する攻撃が可能です。コンピューターのホスト名を利用するように、環境決定コードを変更して下さい。(hostname
コマンドがMac、Linux、Windowsで使用できます。)For security reasons, URL domains
may no longer be used to detect your application
environment. These values are easily spoofable and
allow attackers to modify the environment for a
request. You should convert your environment
detection to use machine host names
(hostname
command on Mac, Linux, and
Windows).
ログファイルの単純化Simpler Log Files
今回よりLaravelは、app/storage/logs/laravel.log
ファイルのみを作成、使用するようになりました。しかし、この動作はapp/start/global.php
ファイルで設定できるままになっています。Laravel now generates a single
log file: app/storage/logs/laravel.log
.
However, you may still configure this behavior in
your app/start/global.php
file.
Trailing Slashリダイレクトの削除Removing Redirect Trailing Slash
bootstrap/start.php
ファイルの中から、$app->redirectIfTrailingSlash()'の呼び出しを削除して下さい。この機能はフレームワークに含まれている
.htaccess`ファイルで処理されるようになったため、メソッドは必要なくなりました。In your
bootstrap/start.php
file, remove the
call to
$app->redirectIfTrailingSlash()
.
This method is no longer needed as this
functionality is now handled by the
.htaccess
file included with the
framework.
次に、public/.htaccess
ファイルを最後のスラッシュを処理する新バージョンへ置き換えて下さい。Next, replace your Apache
.htaccess
file with this new
one[https://github.com/laravel/laravel/blob/master/public/.htaccess]
that handles trailing slashes.
現在のルートへのアクセスCurrent Route Access
現在のルートへアクセスするには、Route::getCurrentRoute()
の代わりに、Route::current()
が使えるようになりました。The current route is now accessed
via Route::current()
instead of
Route::getCurrentRoute()
.
Composerの更新Composer Update
以上の変更を行ったら、アプリケーションのコアファイルを更新するために、composer
update
を実行して下さい!クラスのロードエラーになった場合は、update
コマンドを--no-scripts
オプションを付け、実行してみてください。ですから、composer
update --no-scripts
と実行します。Once you have completed the
changes above, you can run the composer
update
function to update your core
application files! If you receive class load errors,
try running the update
command with the
--no-scripts
option enabled like so:
composer update
--no-scripts
.
ワイルドカードイベントリスナーWildcard Event Listeners
ワイルドカードイベントリスナーは、ハンドラー関数の引数にイベントを渡さなくなりました。発行されたイベントを見つける必要がある場合は、Event::firing()
を使用してください。The wildcard event listeners no
longer append the event to your handler functions
parameters. If you require finding the event that
was fired you should use
Event::firing()
.