Admun's NUDN

admun

  • San Francisco, CA

Navigation

Navigation

Categories

The Need for supportsFeature

The question of why we should add supportsFeature in a plugin is first saw here.

The question is whether a plugin writer should add supportsFeature in the code, and as radek suggested, this function should be added. Here some rules of thumb for implementing supportsFeature:

1) A plugin should always declared suportsFeature, it could be something like this:

   function supportsFeature($feature) {
      switch($feature) {
        case 'SqlTablePrefix':
          return 1;
        default:
          return 0;
      }
   }

2) A plugin actually does support SQL table prefix if it does not performs any SQL query.... It is a strange idea. A scenario: A Nucleus is setup to use tableprefix, it calls the plugin's supportFeature() during installation, and since the plugin has none, the PLUGIN::supportsFeature() is called and it returns false. The plugin results failed to install.

3) Plugin writer should not override the function by simply putting

  function supportsfeature($feature) { return true; }
You just don't know what feature going to be implemented in the future.....

If a plugin does not add supportsFeature, this happened.....

13:26:44 on 06/22/04 by Admun - Category: Developer Notes - tags: none - print

Comments

No comments yet

Add Comments