J4.x

J4.x:改善されたオーバーライドの管理

From Joomla! Documentation

This page is a translated version of the page J4.x:Improved Override Management and the translation is 51% complete.
Other languages:
Deutsch • ‎English • ‎Nederlands • ‎español • ‎français • ‎فارسی • ‎日本語
GSoC 2018
改善されたオーバーライドの管理
ドキュメント
Gsoc2016.png
Joomla! 
4.x

はじめに

このプロジェクトはJoomlaにアップデートチェック機能を追加して、テンプレートがコアファイルを変更または更新した場合、セキュリティ上の問題や機能の問題を回避するために、テンプレートオーバーライドのコアファイルがアップデートで変更されたことを通知します。 誰でも気づく前にオーバーライドを調整することができます。

プロジェクト リポジトリのリンク: https://github.com/joomla-projects/gsoc18_override_management

オーバーライド管理の改善で頭を悩ませる

ノート

Joomlaの開発に慣れていなかったり、テンプレート管理とオーバーライドについてよくわからない場合は、次を読んでください。

  1. テンプレート管理の使い方
  2. Joomlaのレイアウト オーバーライド

Joomlaでのテンプレート管理とオーバーライドの種類の使い方をよくご存知の場合は、次に、このプロジェクトの機能について説明します。

  • サポートされているオーバーライド
  • 差分ビュー
  • オーバーライド - クイックアイコン通知プラグイン
  • インストーラ - オーバーライドプラグイン
  • 更新済み - オーバーライドの履歴

この機能でサポートされているオーバーライドの種類

代替レイアウトでは、ファイル名を別の名前に変更することや、js、cssを上書きすることはできません。 この機能は、「オーバーライドの作成」タブに一覧表示されているこれらのオーバーライド ファイルをサポートしています。 例:

Selection 035-en.png

コアファイルとオーバーライドファイルの差分表示

この機能は、コアファイルとオーバーライドファイルの違いを示します。オーバーライドファイルを開いて編集すると、そのファイルのコアファイルが終了した場合、ページの右上に2つのボタンまたはスイッチャーが表示されます。

このようなボタンです。

Buttons

ここでは、diffビューとコアファイルビューの非表示と表示の表示を制御できます。 次の画像では、テンプレート管理にコアファイルと差分ビューの位置が表示されます。

Selection 028-en.png

コアファイルは編集できません。

diffビューがどのように機能しているか

オーバーライドファイルをクリックして編集すると、テンプレート内のオーバーライドファイルの2つのパラメータ path を受け取るための getCoreFile 関数メソッドを呼び出します。例: /html/layouts/joomla/form/field/user.phpSite または Administratorのどちらかのファイルのクライアントパス。次に、これらの情報に基づいて、コアファイルのパスを返します。 コアファイルとオーバーライドファイルの間にdiffを表示するために jsdiff ライブラリを使いました。

オーバーライド - クイックアイコン通知プラグイン

A quick icon notification plugin which shows the notification in cpanel and it shows the total updated overrides from all templates. When overrides are updated then the quick icon shows something like in the example below:

Quick Icon

When you click on it, it will redirect you to Templates which contain the list of your templates with their description. You'll see a new column header Overrides showing the number of override updated which belongs to the template. If nothing has been updated in the template override it will show a Up to date badge.

Templates

How quick icon is working

It makes an AJAX call to the TemplateController.php which returns the information and displays a notification when such overrides are updated.

Warning

Quick icon notification plugin only works or able to fetch data if installer/override plugin is enabled. If installer/override is disabled then you will see this error message in quick icon.

Enable

If you click on the quick icon you will be redirected to the installer/override plugin settings where you can edit the settings of the plugin.

Installer - Override Plugin

This plugin is the main part of this feature. It allows to find the correct updated overrides during the extension install or update and Joomla update.

Installer Override

How installer override plugin is working

This plugin works on 6 events:

  • onExtensionBeforeUpdate
  • onExtensionAfterUpdate
  • onInstallerBeforeInstaller
  • onInstallerAfterInstaller
  • onJoomlaBeforeUpdate
  • onJoomlaAfterUpdate

Which collect all overrides core file md5_file() hash before update and after update then compairs both values. Then, find the correct changed or updated file. And, store information in #__templates_overrides table.


Updated - Override History

You can access this from the Updated Files tab in a template. This is a list view that shows the list of updated overrides which do belongs to that template.

Selection 029-en.png

There are many options available to manage list. Where you can check the status of override file history whether is checked or not, created date, date of change and update action like: whether it belongs to (Joomla Update, Extension Update or Extension Install).

Note

These information are only history so if you checked the updated override changes then, you can delete the history, as not needed anymore.

Watch the video tutorial to learn how to use this feature.