[Svn-src-all:2684] [version-2_12-dev 21583] #1603 (プラグイン機能(エンジン部分))

Seasoft admin @ mail.ec-cube.net
2012年 3月 4日 (日) 04:46:21 JST


Subversion committed to /home/svn/open 21583
http://svn.ec-cube.net/open_trac/changeset/21583
┌────────────────────────────┐
│更新者 :  Seasoft                                      │
│更新日時:  2012-03-04 04:46:21 +0900 (日, 04  3月 2012)│
└────────────────────────────┘

Log:
--------------------------------------------------------
#1603 (プラグイン機能(エンジン部分))
  * 互換性のない旧プラグイン機能を削除
#1607 (未使用定義の削除)
#1605 (PHP4向けコードの除去、PHP5向けのコード最適化)

Changed:                      [U:修正,A:追加,D:削除]
--------------------------------------------------------
D   branches/version-2_12-dev/data/class/SC_Plugin.php
U   branches/version-2_12-dev/data/class/SC_Query.php
U   branches/version-2_12-dev/data/class/SC_View.php
U   branches/version-2_12-dev/data/class/pages/LC_Page.php
U   branches/version-2_12-dev/data/class/pages/LC_Page_Index.php
U   branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php
U   branches/version-2_12-dev/data/class/util/SC_Utils.php
D   branches/version-2_12-dev/data/class_extends/SC_Plugin_Ex.php
U   branches/version-2_12-dev/data/mtb_constants_init.php
U   branches/version-2_12-dev/html/install/sql/insert_data.sql
D   branches/version-2_12-dev/html/user_data/plugins/

削除: branches/version-2_12-dev/data/class/SC_Plugin.php
===================================================================
--- branches/version-2_12-dev/data/class/SC_Plugin.php	2012-03-03 19:20:00 UTC (rev 21582)
+++ branches/version-2_12-dev/data/class/SC_Plugin.php	2012-03-03 19:46:21 UTC (rev 21583)
@@ -1,68 +0,0 @@
-<?php
-
-class SC_Plugin
-{
-    /**
-     *
-     * plugin_path
-     * @var String
-     */
-    var $path;
-
-    function SC_Plugin() {
-        $this->__construct();
-    }
-
-    function __construct() {
-        if (!defined(PLUGIN_REALDIR)) {
-            define('PLUGIN_REALDIR', USER_REALDIR . 'plugins/');
-        }
-        $this->init();
-    }
-
-    function init() {
-    }
-
-    function enable($classname) {
-    }
-
-    function getVersion() {
-    }
-
-    function getName() {
-    }
-
-    function process() {
-    }
-
-    function mobileprocess() {
-    }
-
-    function install() {
-    }
-
-    function uninstall() {
-    }
-
-    function disablePlugin() {
-        $objQuery = new SC_Query_Ex();
-        $name = preg_replace('/.php/', '', __FILE__); // XXX 正規表現エスケープ漏れでは?
-        $objQuery->update('dtb_plugin', array('enable'=>'0'), 'plugin_name = ?', array($name));
-    }
-
-    function enablePlugin() {
-        $objQuery = new SC_Query_Ex();
-        $name = preg_replace('/.php/', '', __FILE__); // XXX 正規表現エスケープ漏れでは?
-        $objQuery->update('dtb_plugin', array('enable'=>'0'), 'plugin_name = ?', array($name));
-    }
-
-    /**
-     *
-     * @return String インストール用のSQL
-     */
-    function getInstallSQL() {
-    }
-
-    function getUninstallSQL() {
-    }
-}

変更: branches/version-2_12-dev/data/class/SC_Query.php
===================================================================
--- branches/version-2_12-dev/data/class/SC_Query.php	2012-03-03 19:20:00 UTC (rev 21582)
+++ branches/version-2_12-dev/data/class/SC_Query.php	2012-03-03 19:46:21 UTC (rev 21583)
@@ -1037,7 +1037,7 @@
 
         $arrStartInfo = array(
             'http_request_id'   => $arrInfo['http_request_id'],
-            'time_start'        => SC_Utils_Ex::sfMicrotimeFloat(),
+            'time_start'        => microtime(true),
             'count'             => ++$arrInfo['count'],
         );
 
@@ -1067,7 +1067,7 @@
         }
         $msg = "[execute end {$arrStartInfo['http_request_id']}#{$arrStartInfo['count']}]\n";
 
-        $timeEnd = SC_Utils_Ex::sfMicrotimeFloat();
+        $timeEnd = microtime(true);
         $timeExecTime = $timeEnd - $arrStartInfo['time_start'];
 
         // ログモード1の場合、

変更: branches/version-2_12-dev/data/class/SC_View.php
===================================================================
--- branches/version-2_12-dev/data/class/SC_View.php	2012-03-03 19:20:00 UTC (rev 21582)
+++ branches/version-2_12-dev/data/class/SC_View.php	2012-03-03 19:46:21 UTC (rev 21583)
@@ -60,7 +60,7 @@
         $this->_smarty->default_modifiers = array('script_escape');
 
         if (ADMIN_MODE == '1') {
-            $this->time_start = SC_Utils_Ex::sfMicrotimeFloat();
+            $this->time_start = microtime(true);
         }
     }
 
@@ -94,7 +94,7 @@
         $this->registFilter();
         $res =  $this->_smarty->fetch($template);
         if (ADMIN_MODE == '1') {
-            $time_end = SC_Utils_Ex::sfMicrotimeFloat();
+            $time_end = microtime(true);
             $time = $time_end - $this->time_start;
             $res .= '処理時間: ' . sprintf('%.3f', $time) . '秒';
         }
@@ -158,7 +158,7 @@
 
         $this->_smarty->display($template);
         if (ADMIN_MODE == '1') {
-            $time_end = SC_Utils_Ex::sfMicrotimeFloat();
+            $time_end = microtime(true);
             $time = $time_end - $this->time_start;
             echo '処理時間: ' . sprintf('%.3f', $time) . '秒';
         }

変更: branches/version-2_12-dev/data/class/pages/LC_Page.php
===================================================================
--- branches/version-2_12-dev/data/class/pages/LC_Page.php	2012-03-03 19:20:00 UTC (rev 21582)
+++ branches/version-2_12-dev/data/class/pages/LC_Page.php	2012-03-03 19:46:21 UTC (rev 21583)
@@ -85,7 +85,7 @@
      */
     function init() {
         // 開始時刻を設定する。
-        $this->timeStart = SC_Utils_Ex::sfMicrotimeFloat();
+        $this->timeStart = microtime(true);
 
         $this->tpl_authority = $_SESSION['authority'];
 
@@ -165,7 +165,7 @@
         // 一定時間以上かかったページの場合、ログ出力する。
         // エラー画面の表示では $this->timeStart が出力されない
         if (defined('PAGE_DISPLAY_TIME_LOG_MODE') && PAGE_DISPLAY_TIME_LOG_MODE == true && isset($this->timeStart)) {
-            $timeEnd = SC_Utils_Ex::sfMicrotimeFloat();
+            $timeEnd = microtime(true);
             $timeExecTime = $timeEnd - $this->timeStart;
             if (defined('PAGE_DISPLAY_TIME_LOG_MIN_EXEC_TIME') && $timeExecTime >= (float)PAGE_DISPLAY_TIME_LOG_MIN_EXEC_TIME) {
                 $logMsg = sprintf('PAGE_DISPLAY_TIME_LOG [%.2fsec]', $timeExecTime);

変更: branches/version-2_12-dev/data/class/pages/LC_Page_Index.php
===================================================================
--- branches/version-2_12-dev/data/class/pages/LC_Page_Index.php	2012-03-03 19:20:00 UTC (rev 21582)
+++ branches/version-2_12-dev/data/class/pages/LC_Page_Index.php	2012-03-03 19:46:21 UTC (rev 21583)
@@ -53,6 +53,12 @@
     function process() {
         parent::process();
         $this->action();
+        // class_exists('xxx');
+        // 0/0;
+        // new xxx;
+        // $objQuery = new SC_Query_Ex();
+        // $objQuery->select('***');
+        // trigger_error('試験的なエラー発生です。');
         $this->sendResponse();
     }
 

変更: branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php
===================================================================
--- branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php	2012-03-03 19:20:00 UTC (rev 21582)
+++ branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php	2012-03-03 19:46:21 UTC (rev 21583)
@@ -40,7 +40,7 @@
      */
     function init() {
         // 開始時刻を設定する。
-        $this->timeStart = SC_Utils_Ex::sfMicrotimeFloat();
+        $this->timeStart = microtime(true);
 
         $this->tpl_authority = $_SESSION['authority'];
 

変更: branches/version-2_12-dev/data/class/util/SC_Utils.php
===================================================================
--- branches/version-2_12-dev/data/class/util/SC_Utils.php	2012-03-03 19:20:00 UTC (rev 21582)
+++ branches/version-2_12-dev/data/class/util/SC_Utils.php	2012-03-03 19:46:21 UTC (rev 21583)
@@ -1743,112 +1743,13 @@
     }
 
     /**
-     * プラグインが配置されているディレクトリ(フルパス)を取得する
+     * 前方互換用
      *
-     * @param string $file プラグイン情報ファイル(info.php)のパス
-     * @return SimpleXMLElement プラグイン XML
+     * @deprecated 2.12.0 microtime(true) を使用する。
      */
-    function sfGetPluginFullPathByRequireFilePath($file) {
-        return str_replace('\\', '/', dirname($file)) . '/';
-    }
-
-    /**
-     * プラグインのパスを取得する
-     *
-     * @param string $pluginFullPath プラグインが配置されているディレクトリ(フルパス)
-     * @return SimpleXMLElement プラグイン XML
-     */
-    function sfGetPluginPathByPluginFullPath($pluginFullPath) {
-        return basename(rtrim($pluginFullPath, '/'));
-    }
-
-    /**
-     * プラグイン情報配列の基本形を作成する
-     *
-     * @param string $file プラグイン情報ファイル(info.php)のパス
-     * @return array プラグイン情報配列
-     */
-    function sfMakePluginInfoArray($file) {
-        $fullPath = SC_Utils_Ex::sfGetPluginFullPathByRequireFilePath($file);
-
-        return
-            array(
-                // パス
-                'path' => SC_Utils_Ex::sfGetPluginPathByPluginFullPath($fullPath),
-                // プラグイン名
-                'name' => '未定義',
-                // フルパス
-                'fullpath' => $fullPath,
-                // バージョン
-                'version' => null,
-                // 著作者
-                'auther' => '未定義',
-            )
-        ;
-    }
-
-    /**
-     * プラグイン情報配列を取得する
-     *
-     * TODO include_once を利用することで例外対応をサボタージュしているのを改善する。
-     *
-     * @param string $path プラグインのディレクトリ名
-     * @return array プラグイン情報配列
-     */
-    function sfGetPluginInfoArray($path) {
-        return (array)include_once PLUGIN_REALDIR . "$path/plugin_info.php";
-    }
-
-    /**
-     * プラグイン XML を読み込む
-     *
-     * TODO 空だったときを考慮
-     *
-     * @return SimpleXMLElement プラグイン XML
-     * @deprecated
-     */
-    function sfGetPluginsXml() {
-        return simplexml_load_file(PLUGIN_REALDIR . 'plugins.xml');
-    }
-
-    /**
-     * プラグイン XML を書き込む
-     *
-     * @param SimpleXMLElement $pluginsXml プラグイン XML
-     * @return integer ファイルに書き込まれたバイト数を返します。
-     * @deprecated
-     */
-    function sfPutPluginsXml($pluginsXml) {
-        if (version_compare(PHP_VERSION, '5.0.0', '>')) {
-            return;
-        }
-
-        $xml = $pluginsXml->asXML();
-        if (strlen($xml) == 0) trigger_error('', E_USER_ERROR);
-
-        $return = file_put_contents(PLUGIN_REALDIR . 'plugins.xml', $pluginsXml->asXML());
-        if ($return === false) trigger_error('', E_USER_ERROR);
-        return $return;
-    }
-
-    function sfLoadPluginInfo($filenamePluginInfo) {
-        return (array)include_once $filenamePluginInfo;
-    }
-
-    /**
-     * 現在の Unix タイムスタンプを float (秒単位) でマイクロ秒まで返す
-     *
-     * PHP4の上位互換用途。
-     * @param SimpleXMLElement $pluginsXml プラグイン XML
-     * @return integer ファイルに書き込まれたバイト数を返します。
-     */
     function sfMicrotimeFloat() {
-        $microtime = microtime(true);
-        if (is_string($microtime)) {
-            list($usec, $sec) = explode(' ', microtime());
-            return (float)$usec + (float)$sec;
-        }
-        return $microtime;
+        trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING);
+        return microtime(true);
     }
 
     /**

削除: branches/version-2_12-dev/data/class_extends/SC_Plugin_Ex.php
===================================================================
--- branches/version-2_12-dev/data/class_extends/SC_Plugin_Ex.php	2012-03-03 19:20:00 UTC (rev 21582)
+++ branches/version-2_12-dev/data/class_extends/SC_Plugin_Ex.php	2012-03-03 19:46:21 UTC (rev 21583)
@@ -1,40 +0,0 @@
-<?php
-/*
- * This file is part of EC-CUBE
- *
- * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
- *
- * http://www.lockon.co.jp/
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-// {{{ requires
-require_once CLASS_REALDIR . 'SC_Plugin.php';
-
-/**
- * プラグインクラス(拡張).
- *
- * SC_Plugin をカスタマイズする場合はこのクラスを使用する.
- *
- * @package
- * @author LOCKON CO.,LTD.
- * @version $Id$
- */
-class SC_Plugin_Ex extends SC_Plugin {
-    function SC_Plugin_Ex() {
-        parent::SC_Plugin();
-    }
-}

変更: branches/version-2_12-dev/data/mtb_constants_init.php
===================================================================
--- branches/version-2_12-dev/data/mtb_constants_init.php	2012-03-03 19:20:00 UTC (rev 21582)
+++ branches/version-2_12-dev/data/mtb_constants_init.php	2012-03-03 19:46:21 UTC (rev 21583)
@@ -382,24 +382,14 @@
 define('OPTION_FAVOFITE_PRODUCT', 1);
 /** 画像リネーム設定 (商品画像のみ) (true:リネームする、false:リネームしない) */
 define('IMAGE_RENAME', true);
-/** プラグインディレクトリ */
-define('PLUGIN_DIR', "plugins/");
 /** プラグイン保存先 */
-define('PLUGIN_REALDIR', USER_REALDIR . PLUGIN_DIR);
-/** プラグイン URL */
-define('PLUGIN_URL', USER_URL . PLUGIN_DIR);
-/** プラグイン保存先 */
 define('PLUGIN_UPLOAD_REALDIR', DATA_REALDIR . "downloads/plugin/");
 /** プラグイン外部ファイル保存先 */
 define('PLUGIN_HTML_REALDIR', HTML_REALDIR . "plugin/");
-/** プラグイン・ディレクトリパーミッション */
-define('PLUGIN_DIR_PERMISSION', 0777);
 /** プラグインファイル一時保存先 */
 define('PLUGIN_TEMP_REALDIR', HTML_REALDIR . "upload/temp_plugin/");
 /** アップロード一時ディレクトリ */
 define('DOWNLOADS_TEMP_DIR', DATA_REALDIR . "downloads/tmp/");
-/** プラグイン 外部ファイルURL */
-define('PLUGIN_HTML_URL', USER_URL . PLUGIN_DIR);
 /** プラグインファイル登録可能拡張子(カンマ区切り) */
 define('PLUGIN_EXTENSION', "tar,tar.gz");
 /** プラグイン一時展開用ディレクトリ(アップデート用) */

変更: branches/version-2_12-dev/html/install/sql/insert_data.sql
===================================================================
--- branches/version-2_12-dev/html/install/sql/insert_data.sql	2012-03-03 19:20:00 UTC (rev 21582)
+++ branches/version-2_12-dev/html/install/sql/insert_data.sql	2012-03-03 19:46:21 UTC (rev 21583)
@@ -1224,15 +1224,10 @@
 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('OSTORE_LOG_REALFILE', 'DATA_REALDIR . "logs/ownersstore.log"', 502, 'オーナーズストアログパス');
 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('OPTION_FAVOFITE_PRODUCT', '1', 523, 'お気に入り商品登録(有効:1 無効:0)');
 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('IMAGE_RENAME', 'true', 525, '画像リネーム設定 (商品画像のみ) (true:リネームする、false:リネームしない)');
-INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('PLUGIN_DIR', '"plugins/"', 600, 'プラグインディレクトリ');
-INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('PLUGIN_REALDIR', 'USER_REALDIR . PLUGIN_DIR', 601, 'プラグイン保存先');
-INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('PLUGIN_URL', 'USER_URL . PLUGIN_DIR', 602, 'プラグイン URL');
 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('PLUGIN_UPLOAD_REALDIR', 'DATA_REALDIR . "downloads/plugin/"', 604, 'プラグイン保存先');
 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('PLUGIN_HTML_REALDIR', 'HTML_REALDIR . "plugin/"', 605, 'プラグイン外部ファイル保存先');
-INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('PLUGIN_DIR_PERMISSION', '0777', 607, 'プラグイン・ディレクトリパーミッション');
 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('PLUGIN_TEMP_REALDIR', 'HTML_REALDIR . "upload/temp_plugin/"', 608, 'プラグインファイル一時保存先');
 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('DOWNLOADS_TEMP_DIR', 'DATA_REALDIR . "downloads/tmp/"', 609, 'アップロード一時ディレクトリ');
-INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('PLUGIN_HTML_URL', 'USER_URL . PLUGIN_DIR', 610, 'プラグイン 外部ファイルURL');
 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('PLUGIN_EXTENSION', '"tar,tar.gz"', 611, 'プラグインファイル登録可能拡張子(カンマ区切り)');
 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('DOWNLOADS_TEMP_PLUGIN_UPDATE_DIR', 'DOWNLOADS_TEMP_DIR . "plugin_update/"', 612, 'プラグイン一時展開用ディレクトリ(アップデート用)');
 INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('DOWNLOADS_TEMP_PLUGIN_INSTALL_DIR', 'DOWNLOADS_TEMP_DIR . "plugin_install/"', 613, 'プラグイン一時展開用ディレクトリ(インストール用)');




Svn-src-all メーリングリストの案内