]> git.wh0rd.org - tt-rss.git/blobdiff - classes/pluginhost.php
implement plugin API version compatibility check
[tt-rss.git] / classes / pluginhost.php
index d51f70214a7a93d6cca0396f34c9b15338b2f995..dc75e31fb30b72f285a23e9302d4c46a7302bbcc 100644 (file)
@@ -13,6 +13,8 @@ class PluginHost {
        private $last_registered;
        private static $instance;
 
+       const API_VERSION = 1;
+
        const HOOK_ARTICLE_BUTTON = 1;
        const HOOK_ARTICLE_FILTER = 2;
        const HOOK_PREFS_TAB = 3;
@@ -137,6 +139,13 @@ class PluginHost {
                                if (class_exists($class) && is_subclass_of($class, "Plugin")) {
                                        $plugin = new $class($this);
 
+                                       $plugin_api = $plugin->api_version();
+
+                                       if ($plugin_api < PluginHost::API_VERSION) {
+                                               user_error("Plugin $class is not compatible with current API version (need: " . PluginHost::API_VERSION . ", got: $plugin_api)", E_USER_WARNING);
+                                               continue;
+                                       }
+
                                        $this->last_registered = $class;
 
                                        switch ($kind) {