function removeInstalled(&$params)
    {
        if (!isset($params[0])) {
            return;
        }

        $options = $params[0]->_downloader->getOptions();
        if (!isset($options['downloadonly'])) {
            foreach ($params as $i => $param) {
                $package = $param->getPackage();
                $channel = $param->getChannel();
                // remove self if already installed with this version
                // this does not need any pecl magic - we only remove exact matches
                if ($param->_installRegistry->packageExists($package, $channel)) {
                    $packageVersion = $param->_installRegistry->packageInfo($package, 'version', $channel);
                    if (version_compare($packageVersion, $param->getVersion(), '==')) {
                        if (!isset($options['force'])) {
                            $info = $param->getParsedPackage();
                            unset($info['version']);
                            unset($info['state']);
                            if (!isset($options['soft'])) {
                                $param->_downloader->log(1, 'Skipping package "' .
                                    $param->getShortName() .
                                    '", already installed as version ' . $packageVersion);
                            }
                            $params[$i] = false;
                        }
                    } elseif (!isset($options['force']) && !isset($options['upgrade']) &&
                          !isset($options['soft'])) {
                        $info = $param->getParsedPackage();
                        $param->_downloader->log(1, 'Skipping package "' .
                            $param->getShortName() .
                            '", already installed as version ' . $packageVersion);
                        $params[$i] = false;
                    }
                }
            }
        }

        PEAR_Downloader_Package::removeDuplicates($params);
    }
function removeInstalled(&$params)
    {
        if (!isset($params[0])) {
            return;
        }

        $options = $params[0]->_downloader->getOptions();
        if (!isset($options['downloadonly'])) {
            foreach ($params as $i => $param) {
                $package = $param->getPackage();
                $channel = $param->getChannel();
                // remove self if already installed with this version
                // this does not need any pecl magic - we only remove exact matches
                if ($param->_installRegistry->packageExists($package, $channel)) {
                    $packageVersion = $param->_installRegistry->packageInfo($package, 'version', $channel);
                    if (version_compare($packageVersion, $param->getVersion(), '==')) {
                        if (!isset($options['force'])) {
                            $info = $param->getParsedPackage();
                            unset($info['version']);
                            unset($info['state']);
                            if (!isset($options['soft'])) {
                                $param->_downloader->log(1, 'Skipping package "' .
                                    $param->getShortName() .
                                    '", already installed as version ' . $packageVersion);
                            }
                            $params[$i] = false;
                        }
                    } elseif (!isset($options['force']) && !isset($options['upgrade']) &&
                          !isset($options['soft'])) {
                        $info = $param->getParsedPackage();
                        $param->_downloader->log(1, 'Skipping package "' .
                            $param->getShortName() .
                            '", already installed as version ' . $packageVersion);
                        $params[$i] = false;
                    }
                }
            }
        }

        PEAR_Downloader_Package::removeDuplicates($params);
    }
function removeInstalled ( & $ params ) { if ( ! isset ( $ params [ 0 ] ) ) { return ; } $ options = $ params [ 0 ] -> _downloader -> getOptions ( ) ; if ( ! isset ( $ options [ 'downloadonly' ] ) ) { foreach ( $ params as $ i => $ param ) { $ package = $ param -> getPackage ( ) ; $ channel = $ param -> getChannel ( ) ; // remove self if already installed with this version // this does not need any pecl magic - we only remove exact matches if ( $ param -> _installRegistry -> packageExists ( $ package , $ channel ) ) { $ packageVersion = $ param -> _installRegistry -> packageInfo ( $ package , 'version' , $ channel ) ; if ( version_compare ( $ packageVersion , $ param -> getVersion ( ) , '==' ) ) { if ( ! isset ( $ options [ 'force' ] ) ) { $ info = $ param -> getParsedPackage ( ) ; unset ( $ info [ 'version' ] ) ; unset ( $ info [ 'state' ] ) ; if ( ! isset ( $ options [ 'soft' ] ) ) { $ param -> _downloader -> log ( 1 , 'Skipping package "' . $ param -> getShortName ( ) . '", already installed as version ' . $ packageVersion ) ; } $ params [ $ i ] = false ; } } elseif ( ! isset ( $ options [ 'force' ] ) && ! isset ( $ options [ 'upgrade' ] ) && ! isset ( $ options [ 'soft' ] ) ) { $ info = $ param -> getParsedPackage ( ) ; $ param -> _downloader -> log ( 1 , 'Skipping package "' . $ param -> getShortName ( ) . '", already installed as version ' . $ packageVersion ) ; $ params [ $ i ] = false ; } } } } PEAR_Downloader_Package :: removeDuplicates ( $ params ) ; }
Remove packages to be downloaded that are already installed
@param array of PEAR_Downloader_Package objects
@static
Remove packages to be downloaded that are already installed