Added extensions compatibility checks during site upgrade and per company activation.
[fa-stable.git] / includes / packages.inc
index feab3d78dd502a754ec7ed6b04047169e3b2fa3c..70d3be491a19bcc9b7b89445436bdd1fd348721e 100644 (file)
@@ -725,3 +725,21 @@ function get_package_info($pkg, $type=null, $filter=array(), $outkey=null, $down
        return get_pkg_or_list($type, $pkg, $filter, null, false);
 }
 
+/*
+       Check basic extension source compatibility.
+*/
+function check_src_ext_version($ext_v)
+{
+       global $src_version;
+
+       $compat_levels = 2;     // current policy is keeping compatibility on major version level.
+       $app = explode('.', strspn($src_version, "0123456789."));
+       $pkg = explode('.', strspn($ext_v, "0123456789."));
+
+       for ($i=0; $i < min($compat_levels, count($app)); $i++)
+               if ($pkg[$i] < $app[$i])
+                       return false;
+
+       return true;
+}
+