Subversion Repositories oidplus

Rev

Rev 1130 | Rev 1140 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1130 Rev 1131
Line 1118... Line 1118...
1118
                        }
1118
                        }
1119
                } else {
1119
                } else {
1120
                        $ary = self::getAllPluginManifests($pluginDirName, false);
1120
                        $ary = self::getAllPluginManifests($pluginDirName, false);
1121
                }
1121
                }
1122
                $known_plugin_oids = array();
1122
                $known_plugin_oids = array();
1123
                if (OIDplus::baseConfig()->getValue('DEBUG')) {
-
 
1124
                        $fake_feature = uuid_to_oid(gen_uuid());
-
 
1125
                } else {
-
 
1126
                        $fake_feature = null;
-
 
1127
                }
-
 
1128
                $known_main_classes_no_namespace = array();
1123
                $known_main_classes_no_namespace = array();
1129
                foreach ($ary as $plugintype_folder => $bry) {
1124
                foreach ($ary as $plugintype_folder => $bry) {
1130
                        foreach ($bry as $vendor_folder => $cry) {
1125
                        foreach ($bry as $vendor_folder => $cry) {
1131
                                foreach ($cry as $pluginname_folder => $manifest) {
1126
                                foreach ($cry as $pluginname_folder => $manifest) {
1132
                                        $class_name = $manifest->getPhpMainClass();
1127
                                        $class_name = $manifest->getPhpMainClass();
Line 1227... Line 1222...
1227
                                        }
1222
                                        }
1228
 
1223
 
1229
                                        // For the next check, we need an instance of the object
1224
                                        // For the next check, we need an instance of the object
1230
                                        $obj = new $class_name();
1225
                                        $obj = new $class_name();
1231
 
1226
 
1232
                                        // Additional check: Does the plugin misuse implementsFeature()?
-
 
1233
                                        // This is not enabled b default, because the GUID generation is slow on some machines.
-
 
1234
                                        // Also, it is very unlikely that someone misuses implementsFeature().
-
 
1235
                                        if (OIDplus::baseConfig()->getValue('DEBUG')) {
-
 
1236
                                                if ($obj->implementsFeature($fake_feature)) {
-
 
1237
                                                        // see https://devblogs.microsoft.com/oldnewthing/20040211-00/?p=40663
-
 
1238
                                                        throw new OIDplusException(_L('Plugin "%1" is erroneous', $vendor_folder . '/' . $plugintype_folder . '/' . $pluginname_folder) . ': ' . _L('implementsFeature() always returns true'));
-
 
1239
                                                }
-
 
1240
                                        }
-
 
1241
 
-
 
1242
                                        // Now we can continue
1227
                                        // Now we can continue
1243
                                        $known_plugin_oids[$plugin_oid] = $vendor_folder . '/' . $plugintype_folder . '/' . $pluginname_folder;
1228
                                        $known_plugin_oids[$plugin_oid] = $vendor_folder . '/' . $plugintype_folder . '/' . $pluginname_folder;
1244
                                        $out[] = $class_name;
1229
                                        $out[] = $class_name;
1245
                                        if (!is_null($registerCallback)) {
1230
                                        if (!is_null($registerCallback)) {
1246
                                                call_user_func($registerCallback, $obj);
1231
                                                call_user_func($registerCallback, $obj);