public function system_updates()
    {
        if (file_exists($this->tmp_path.'/check-updates')) {
            unlink($this->tmp_path.'/check-updates');
        }

        if ($this->host_os === 'WINDOWS') {
            $updSess = new \COM("Microsoft.Update.Session");
            $updSrc = $updSess->CreateUpdateSearcher();
            $result = $updSrc->Search('IsInstalled=0 and Type=\'Software\' and IsHidden=0');
            return !empty($result->Updates->Count) ? '1' : '0';
        }

        if ($this->distro() === 'UBUNTU') {
            $get_updates = shell_exec('apt-get -s dist-upgrade');
            if (preg_match('/^(\d+).+upgrade.+(\d+).+newly\sinstall/m', $get_updates, $matches)) {
                $result = (int) $matches[1] + (int) $matches[2];
            } else {
                $result = 0;
            }
            return !empty($result) ? '1' : '0';
        }

        if ($this->distro() === 'CENTOS') {
            exec('yum check-update', $output, $exitCode);
            return ($exitCode == 100) ? '1' : '0';
        }
        return '-1';
    }
public function system_updates()
    {
        if (file_exists($this->tmp_path.'/check-updates')) {
            unlink($this->tmp_path.'/check-updates');
        }

        if ($this->host_os === 'WINDOWS') {
            $updSess = new \COM("Microsoft.Update.Session");
            $updSrc = $updSess->CreateUpdateSearcher();
            $result = $updSrc->Search('IsInstalled=0 and Type=\'Software\' and IsHidden=0');
            return !empty($result->Updates->Count) ? '1' : '0';
        }

        if ($this->distro() === 'UBUNTU') {
            $get_updates = shell_exec('apt-get -s dist-upgrade');
            if (preg_match('/^(\d+).+upgrade.+(\d+).+newly\sinstall/m', $get_updates, $matches)) {
                $result = (int) $matches[1] + (int) $matches[2];
            } else {
                $result = 0;
            }
            return !empty($result) ? '1' : '0';
        }

        if ($this->distro() === 'CENTOS') {
            exec('yum check-update', $output, $exitCode);
            return ($exitCode == 100) ? '1' : '0';
        }
        return '-1';
    }
public function system_updates ( ) { if ( file_exists ( $ this -> tmp_path . '/check-updates' ) ) { unlink ( $ this -> tmp_path . '/check-updates' ) ; } if ( $ this -> host_os === 'WINDOWS' ) { $ updSess = new \ COM ( "Microsoft.Update.Session" ) ; $ updSrc = $ updSess -> CreateUpdateSearcher ( ) ; $ result = $ updSrc -> Search ( 'IsInstalled=0 and Type=\'Software\' and IsHidden=0' ) ; return ! empty ( $ result -> Updates -> Count ) ? '1' : '0' ; } if ( $ this -> distro ( ) === 'UBUNTU' ) { $ get_updates = shell_exec ( 'apt-get -s dist-upgrade' ) ; if ( preg_match ( '/^(\d+).+upgrade.+(\d+).+newly\sinstall/m' , $ get_updates , $ matches ) ) { $ result = ( int ) $ matches [ 1 ] + ( int ) $ matches [ 2 ] ; } else { $ result = 0 ; } return ! empty ( $ result ) ? '1' : '0' ; } if ( $ this -> distro ( ) === 'CENTOS' ) { exec ( 'yum check-update' , $ output , $ exitCode ) ; return ( $ exitCode == 100 ) ? '1' : '0' ; } return '-1' ; }
Check system for updates

@return int 1=has updates, 0=no updates, -1=unknown
Check system for updates