Topic: Installing third party extensions broken and FIX

In 2011, local install of packages was introduced where the hooks.php would encompass all install tasks - but that is available in the target company only after activation and not in the default company for the available extensions and their install buttons where the version is "Unknown" and the name is the folder name itself.

This post shows how the third party extensions get listed in the installed_extensions.php file as version  => '-' , whereas, it is listed as blank elsewhere so that the "Install Extension" icon in the extensions listing gets enabled. This happens at the end of includes/packages.inc:

/*
    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('.', substr($src_version, 0, strspn($src_version, "0123456789.")));
    $pkg = explode('.', substr($ext_v, 0, strspn($ext_v, "0123456789.")));

    for ($i=0; $i < min($compat_levels, count($app)); $i++)
        if ($pkg[$i] < $app[$i])
            return false;

    return true;
}

which should now be corrected to be effective only when it is not a third party extension like:

/*
    Check basic extension source compatibility.
*/
function check_src_ext_version($ext_v)
{
    global $src_version;
    if ($ext_v != '-') {
        $compat_levels = 2;    // current policy is keeping compatibility on major version level.
        $app = explode('.', substr($src_version, 0, strspn($src_version, "0123456789.")));
        $pkg = explode('.', substr($ext_v, 0, strspn($ext_v, "0123456789.")));

        for ($i=0; $i < min($compat_levels, count($app)); $i++)
            if ($pkg[$i] < $app[$i])
                return false;
    }
    return true;
}

The logic to display the "Install extension" button/icon should be altered to read from a _init/config file if present in the third party module folder itself thereby populating the version and name fields as well instead of being "-" and folder name respectively as obtains now.

Currently the presence of a Version in the _init/config file in the official packages is provided to the available parameter on install when extracted using the function get_extensions_list() defined in includes/packages.inc.

@joe: kindly incorporate the fix listed here for a start so that third party installs do not get broken and / or resorting to use kludgy workarounds.

Re: Installing third party extensions broken and FIX

@joe: Thanks. Committed.