public function showUpgradeNotes(Script\Event $event)
    {
        $packageName = 'yiisoft/yii2';
        if (!isset($this->_packageUpdates[$packageName])) {
            return;
        }

        $package = $this->_packageUpdates['yiisoft/yii2'];

        // do not show a notice on up/downgrades between dev versions
        // avoid messages like from version dev-master to dev-master
        if ($package['fromPretty'] == $package['toPretty']) {
            return;
        }

        $io = $event->getIO();

        // print the relevant upgrade notes for the upgrade
        // - only on upgrade, not on downgrade
        // - only if the "from" version is non-dev, otherwise we have no idea which notes to show
        if ($package['direction'] === 'up' && $this->isNumericVersion($package['fromPretty'])) {

            $notes = $this->findUpgradeNotes($packageName, $package['fromPretty']);
            if ($notes !== false && empty($notes)) {
                // no relevent upgrade notes, do not show anything.
                return;
            }

            $this->printUpgradeIntro($io, $package);

            if ($notes) {
                // safety check: do not display notes if they are too many
                if (count($notes) > 250) {
                    $io->write("\n  <fg=yellow;options=bold>The relevant notes for your upgrade are too long to be displayed here.</>");
                } else {
                    $io->write("\n  " . trim(implode("\n  ", $notes)));
                }
            }

            $io->write("\n  You can find the upgrade notes for all versions online at:");
        } else {
            $this->printUpgradeIntro($io, $package);
            $io->write("\n  You can find the upgrade notes online at:");
        }
        $this->printUpgradeLink($io, $package);
    }
public function showUpgradeNotes(Script\Event $event)
    {
        $packageName = 'yiisoft/yii2';
        if (!isset($this->_packageUpdates[$packageName])) {
            return;
        }

        $package = $this->_packageUpdates['yiisoft/yii2'];

        // do not show a notice on up/downgrades between dev versions
        // avoid messages like from version dev-master to dev-master
        if ($package['fromPretty'] == $package['toPretty']) {
            return;
        }

        $io = $event->getIO();

        // print the relevant upgrade notes for the upgrade
        // - only on upgrade, not on downgrade
        // - only if the "from" version is non-dev, otherwise we have no idea which notes to show
        if ($package['direction'] === 'up' && $this->isNumericVersion($package['fromPretty'])) {

            $notes = $this->findUpgradeNotes($packageName, $package['fromPretty']);
            if ($notes !== false && empty($notes)) {
                // no relevent upgrade notes, do not show anything.
                return;
            }

            $this->printUpgradeIntro($io, $package);

            if ($notes) {
                // safety check: do not display notes if they are too many
                if (count($notes) > 250) {
                    $io->write("\n  <fg=yellow;options=bold>The relevant notes for your upgrade are too long to be displayed here.</>");
                } else {
                    $io->write("\n  " . trim(implode("\n  ", $notes)));
                }
            }

            $io->write("\n  You can find the upgrade notes for all versions online at:");
        } else {
            $this->printUpgradeIntro($io, $package);
            $io->write("\n  You can find the upgrade notes online at:");
        }
        $this->printUpgradeLink($io, $package);
    }
public function showUpgradeNotes ( Script \ Event $ event ) { $ packageName = 'yiisoft/yii2' ; if ( ! isset ( $ this -> _packageUpdates [ $ packageName ] ) ) { return ; } $ package = $ this -> _packageUpdates [ 'yiisoft/yii2' ] ; // do not show a notice on up/downgrades between dev versions // avoid messages like from version dev-master to dev-master if ( $ package [ 'fromPretty' ] == $ package [ 'toPretty' ] ) { return ; } $ io = $ event -> getIO ( ) ; // print the relevant upgrade notes for the upgrade // - only on upgrade, not on downgrade // - only if the "from" version is non-dev, otherwise we have no idea which notes to show if ( $ package [ 'direction' ] === 'up' && $ this -> isNumericVersion ( $ package [ 'fromPretty' ] ) ) { $ notes = $ this -> findUpgradeNotes ( $ packageName , $ package [ 'fromPretty' ] ) ; if ( $ notes !== false && empty ( $ notes ) ) { // no relevent upgrade notes, do not show anything. return ; } $ this -> printUpgradeIntro ( $ io , $ package ) ; if ( $ notes ) { // safety check: do not display notes if they are too many if ( count ( $ notes ) > 250 ) { $ io -> write ( "\n  <fg=yellow;options=bold>The relevant notes for your upgrade are too long to be displayed here.</>" ) ; } else { $ io -> write ( "\n  " . trim ( implode ( "\n  " , $ notes ) ) ) ; } } $ io -> write ( "\n  You can find the upgrade notes for all versions online at:" ) ; } else { $ this -> printUpgradeIntro ( $ io , $ package ) ; $ io -> write ( "\n  You can find the upgrade notes online at:" ) ; } $ this -> printUpgradeLink ( $ io , $ package ) ; }
Listen to POST_UPDATE_CMD event to display information about upgrade notes if appropriate.
@param Script\Event $event
Listen to POST_UPDATE_CMD event to display information about upgrade notes if appropriate .