src/Tasks/UpdatePackageInfoTask.php
public function run($request)
    {
        // Loading packages and all their updates can be quite memory intensive.
        $memoryLimit = $this->config()->get('memory_limit');
        if ($memoryLimit) {
            if (Environment::getMemoryLimitMax() < Convert::memstring2bytes($memoryLimit)) {
                Environment::setMemoryLimitMax($memoryLimit);
            }
            Environment::increaseMemoryLimitTo($memoryLimit);
        }

        $composerLock = $this->getComposerLoader()->getLock();
        $rawPackages = array_merge($composerLock->packages, (array) $composerLock->{'packages-dev'});
        $packages = $this->getPackageInfo($rawPackages);

        // Get "name" from $packages and put into an array
        $moduleNames = array_column($packages, 'Name');

        $supportedPackages = $this->getSupportedPackages();
        $moduleHealthInfo = $this->getHealthIndicator($moduleNames);

        // Extensions to the process that add data may rely on external services.
        // There may be a communication issue between the site and the external service,
        // so if there are 'none' we should assume this is untrue and _not_ proceed
        // to remove everything. Stale information is better than no information.
        if ($packages) {
            // There is no onBeforeDelete for Package
            $table = DataObjectSchema::create()->tableName(Package::class);
            SQLDelete::create("\"$table\"")->execute();
            foreach ($packages as $package) {
                $packageName = $package['Name'];
                if (is_array($supportedPackages)) {
                    $package['Supported'] = in_array($packageName, $supportedPackages);
                }
                if (is_array($moduleHealthInfo) && isset($moduleHealthInfo[$packageName])) {
                    $package['Rating'] = $moduleHealthInfo[$packageName];
                }
                Package::create()->update($package)->write();
            }
        }
    }
public function run($request)
    {
        // Loading packages and all their updates can be quite memory intensive.
        $memoryLimit = $this->config()->get('memory_limit');
        if ($memoryLimit) {
            if (Environment::getMemoryLimitMax() < Convert::memstring2bytes($memoryLimit)) {
                Environment::setMemoryLimitMax($memoryLimit);
            }
            Environment::increaseMemoryLimitTo($memoryLimit);
        }

        $composerLock = $this->getComposerLoader()->getLock();
        $rawPackages = array_merge($composerLock->packages, (array) $composerLock->{'packages-dev'});
        $packages = $this->getPackageInfo($rawPackages);

        // Get "name" from $packages and put into an array
        $moduleNames = array_column($packages, 'Name');

        $supportedPackages = $this->getSupportedPackages();
        $moduleHealthInfo = $this->getHealthIndicator($moduleNames);

        // Extensions to the process that add data may rely on external services.
        // There may be a communication issue between the site and the external service,
        // so if there are 'none' we should assume this is untrue and _not_ proceed
        // to remove everything. Stale information is better than no information.
        if ($packages) {
            // There is no onBeforeDelete for Package
            $table = DataObjectSchema::create()->tableName(Package::class);
            SQLDelete::create("\"$table\"")->execute();
            foreach ($packages as $package) {
                $packageName = $package['Name'];
                if (is_array($supportedPackages)) {
                    $package['Supported'] = in_array($packageName, $supportedPackages);
                }
                if (is_array($moduleHealthInfo) && isset($moduleHealthInfo[$packageName])) {
                    $package['Rating'] = $moduleHealthInfo[$packageName];
                }
                Package::create()->update($package)->write();
            }
        }
    }
public function run ( $ request ) { // Loading packages and all their updates can be quite memory intensive. $ memoryLimit = $ this -> config ( ) -> get ( 'memory_limit' ) ; if ( $ memoryLimit ) { if ( Environment :: getMemoryLimitMax ( ) < Convert :: memstring2bytes ( $ memoryLimit ) ) { Environment :: setMemoryLimitMax ( $ memoryLimit ) ; } Environment :: increaseMemoryLimitTo ( $ memoryLimit ) ; } $ composerLock = $ this -> getComposerLoader ( ) -> getLock ( ) ; $ rawPackages = array_merge ( $ composerLock -> packages , ( array ) $ composerLock -> { 'packages-dev' } ) ; $ packages = $ this -> getPackageInfo ( $ rawPackages ) ; // Get "name" from $packages and put into an array $ moduleNames = array_column ( $ packages , 'Name' ) ; $ supportedPackages = $ this -> getSupportedPackages ( ) ; $ moduleHealthInfo = $ this -> getHealthIndicator ( $ moduleNames ) ; // Extensions to the process that add data may rely on external services. // There may be a communication issue between the site and the external service, // so if there are 'none' we should assume this is untrue and _not_ proceed // to remove everything. Stale information is better than no information. if ( $ packages ) { // There is no onBeforeDelete for Package $ table = DataObjectSchema :: create ( ) -> tableName ( Package :: class ) ; SQLDelete :: create ( "\"$table\"" ) -> execute ( ) ; foreach ( $ packages as $ package ) { $ packageName = $ package [ 'Name' ] ; if ( is_array ( $ supportedPackages ) ) { $ package [ 'Supported' ] = in_array ( $ packageName , $ supportedPackages ) ; } if ( is_array ( $ moduleHealthInfo ) && isset ( $ moduleHealthInfo [ $ packageName ] ) ) { $ package [ 'Rating' ] = $ moduleHealthInfo [ $ packageName ] ; } Package :: create ( ) -> update ( $ package ) -> write ( ) ; } } }
Update database cached information about this site.

@param HTTPRequest $request unused, can be null (must match signature of parent function).
Update database cached information about this site .