OSDN Git Service

MERGE: リビジョン1866。NucleusPlugin::apply_plugin_options()のバグ修正
authorsakamocchi <o-takashi@sakamocchi.jp>
Sun, 20 May 2012 13:27:37 +0000 (22:27 +0900)
committersakamocchi <o-takashi@sakamocchi.jp>
Sun, 20 May 2012 13:28:03 +0000 (22:28 +0900)
1. DBハンドラーを書き換えた際の修正漏れ
2. もともとのコードのおかしな箇所の修正。対象となるすべてのプラグインのキャッシュがアップデートされていなかった

Revision 1866:
FIX: bugs to fail to update options in
NucleusPlugin::apply_plugin_options()
1. Mis-written when applying new DB handler
2. original code bugs
http://nucleuscms.svn.sourceforge.net/viewvc/nucleuscms?view=revision&revision=1866

nucleus/libs/PLUGIN.php

index 6677208..5a175c2 100644 (file)
@@ -912,7 +912,7 @@ abstract class NucleusPlugin
                                        }\r
                                        \r
                                        // retreive any metadata\r
-                                       $meta = NucleusPlugin::getOptionMeta($info->oextra);\r
+                                       $meta = NucleusPlugin::getOptionMeta($result['oextra']);\r
                                        \r
                                        // if the option is readonly or hidden it may not be saved\r
                                        if ( array_key_exists('access', $meta)\r
@@ -955,8 +955,8 @@ abstract class NucleusPlugin
                                                'context'               => $result['ocontext'],\r
                                                'plugid'                => $result['opid'],\r
                                                'optionname'    => $result['oname'],\r
-                                               'contextid'     => $contextid,\r
-                                               'value'         => &$value);\r
+                                               'contextid'             => $contextid,\r
+                                               'value'                 => &$value);\r
                                        $manager->notify('PrePluginOptionsUpdate', $data);\r
                                        \r
                                        // delete and insert its fields of table in database\r
@@ -966,17 +966,18 @@ abstract class NucleusPlugin
                                        $query = "INSERT INTO %s (oid, ocontextid, ovalue) VALUES (%d, %d, %s);";\r
                                        $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid, DB::quoteValue($value));\r
                                        DB::execute($query);\r
+                                       \r
+                                       // clear option value cache if the plugin object is already loaded\r
+                                       $plugin=& $manager->pidLoaded($result['opid']);\r
+                                       if ( $plugin )\r
+                                       {\r
+                                               $plugin->clearOptionValueCache();\r
+                                       }\r
+                                       \r
+                                       continue;\r
                                }\r
                        }\r
-                       // clear option value cache if the plugin object is already loaded\r
-                       if ( is_object($info) )\r
-                       {\r
-                               $plugin=& $manager->pidLoaded($result['opid']);\r
-                               if ( $plugin )\r
-                               {\r
-                                       $plugin->clearOptionValueCache();\r
-                               }\r
-                       }\r
+                       continue;\r
                }\r
                return;\r
        }\r