Proteted upgrade EIP
192186
protected static function eip($tag = 'znframework')
    {
        if( $return = Restful::useragent(true)->get('https://api.github.com/repos/znframework/'.$tag.'/tags') )
        {
            if( ! isset($return->message) )
            {
                usort($return, function($data1, $data2){ return strcmp($data1->name, $data2->name); });

                rsort($return);

                $lastest = $return[0];

                $lastVersionData = $lastest->name ?? ZN_VERSION;

                $open   = popen('composer update 2>&1', 'r');
                $result = fread($open, 2048);
                pclose($open);

                if( empty($result) )
                {
                    $status = self::$lang['composerUpdate'];
                }
                else
                {
                    if( ZN_VERSION !== $lastVersionData )
                    {                   
                        File::replace(DIRECTORY_INDEX, ZN_VERSION, $lastVersionData);
                    
                        $status = self::$lang['upgradeSuccess'];
                    }
                    else
                    {
                        $status = self::$lang['alreadyVersion'];
                    }
                }
            }
            else
            {
                $status = $return->message;
            }

            return $status;
        }
    }
286855
def pip_upgrade_all(line):
    """"""
    from pip import get_installed_distributions
    user = set(d.project_name for d in get_installed_distributions(user_only=True))
    all = set(d.project_name for d in get_installed_distributions())
    for dist in all - user:
        do_pip(["install", "--upgrade", dist])
    for dist in  user:
        do_pip(["install", "--upgrade", "--user", dist])
826799
public static mps_upgrade upgrade(nitro_service client, mps_upgrade resource) throws Exception
	{
		return ((mps_upgrade[]) resource.perform_operation(client, "upgrade"))[0];
	}
764164
def do_upgrade():
    """"""
    op.alter_column(
        table_name='knwKBRVAL',
        column_name='id_knwKB',
        type_=db.MediumInteger(8, unsigned=True),
        existing_nullable=False,
        existing_server_default='0'
    )
1261696
def updateNetwork(self,
                      dhcp='dhcp',
                      ipaddress=None,
                      netmask=None,
                      gateway=None,
                      dns=None):
        """"""
        return self.__post('/api/updateNetwork',
                           data={
                               'dhcp': dhcp,
                               'ipaddress': ipaddress,
                               'netmask': netmask,
                               'gateway': gateway,
                               'dns': json.dumps(dns)
                           })
1144666
public boolean isWebSocketUpgrade() {
		if (!getResponseHeader().isEmpty()) {
			String connectionHeader = getResponseHeader().getHeader("connection");
			String upgradeHeader = getResponseHeader().getHeader("upgrade");
			
			if (connectionHeader != null && connectionHeader.equalsIgnoreCase("upgrade")) {
				if (upgradeHeader != null && upgradeHeader.equalsIgnoreCase("websocket")) {
					return true;
				}
			}
		}
		
		return false;
	}
259511
def upgrade(self, flag):
        
        for pkg in self.binary:
            try:
                subprocess.call("upgradepkg {0} {1}".format(flag, pkg),
                                shell=True)
                check = pkg[:-4].split("/")[-1]
                if os.path.isfile(self.meta.pkg_path + check):
                    print("Completed!\n")
                else:
                    raise SystemExit()
            except subprocess.CalledProcessError:
                self._not_found("Can't upgrade", self.binary, pkg)
                raise SystemExit(1)
473089
def update(self, ip):
        """"""
        timeout = 60
        LOG.debug("Updating '%s' to '%s' at service '%s'", self.hostname, ip, self._updateurl)
        params = {"domains": self.hostname.partition(".")[0], "token": self.__token}
        if ip is None:
            params["ip"] = ""
        else:
            params["ip"] = ip
        # LOG.debug("Update params: %r", params)
        req = requests.get(self._updateurl, params=params, headers=constants.REQUEST_HEADERS_DEFAULT,
                           timeout=timeout)
        LOG.debug("status %i, %s", req.status_code, req.text)
        # duckdns response codes seem undocumented...
        if req.status_code == 200:
            if req.text.startswith("OK"):
                return ip
            return req.text
        return "invalid http status code: %s" % req.status_code
571263
def upgrade():
    '''
    
    '''
    DETAILS = _load_state()
    pkgs = uptodate()
    DETAILS['packages'] = pkgs
    _save_state(DETAILS)
    return pkgs
410553
def upgrade():
    """"""
    op.create_table(
        'accounts_role',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=80), nullable=True),
        sa.Column('description', sa.String(length=255), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('name')
    )
    op.create_table(
        'accounts_user',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('email', sa.String(length=255), nullable=True),
        sa.Column('password', sa.String(length=255), nullable=True),
        sa.Column('active', sa.Boolean(name='active'), nullable=True),
        sa.Column('confirmed_at', sa.DateTime(), nullable=True),
        sa.Column('last_login_at', sa.DateTime(), nullable=True),
        sa.Column('current_login_at', sa.DateTime(), nullable=True),
        sa.Column('last_login_ip',
                  sqlalchemy_utils.types.ip_address.IPAddressType(),
                  nullable=True),
        sa.Column('current_login_ip',
                  sqlalchemy_utils.types.ip_address.IPAddressType(),
                  nullable=True),
        sa.Column('login_count', sa.Integer(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('email')
    )
    op.create_table(
        'accounts_user_session_activity',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column('sid_s', sa.String(length=255), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['user_id'], [u'accounts_user.id'],
            name='fk_accounts_session_activity_user_id',
        ),
        sa.PrimaryKeyConstraint('sid_s')
    )
    op.create_table(
        'accounts_userrole',
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('role_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['role_id'], ['accounts_role.id'],
            name='fk_accounts_userrole_role_id',
        ),
        sa.ForeignKeyConstraint(
            ['user_id'], ['accounts_user.id'],
            name='fk_accounts_userrole_user_id',
        ),
    )
    with op.batch_alter_table('transaction') as batch_op:
        batch_op.add_column(sa.Column(
            'user_id',
            sa.Integer(),
            sa.ForeignKey('accounts_user.id'),
            nullable=True,
        ))
        batch_op.create_index(
            op.f('ix_transaction_user_id'), ['user_id'], unique=False
        )
170766
def up(force=True, env=None, **kwargs):
    ""
    inventory = os.path.join(os.getcwd(), "hosts")
    conf = Configuration.from_dictionnary(provider_conf)
    provider = Enos_vagrant(conf)
    roles, networks = provider.init()
    check_networks(roles, networks)
    env["roles"] = roles
    env["networks"] = networks
343458
def upgrade():
    """"""
    op.create_table(
        'pidrelations_pidrelation',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column('parent_id', sa.Integer(), nullable=False),
        sa.Column('child_id', sa.Integer(), nullable=False),
        sa.Column('relation_type', sa.SmallInteger(), nullable=False),
        sa.Column('index', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['child_id'], ['pidstore_pid.id'],
            name=op.f('fk_pidrelations_pidrelation_child_id_pidstore_pid'),
            onupdate='CASCADE', ondelete='CASCADE'
        ),
        sa.ForeignKeyConstraint(
            ['parent_id'], ['pidstore_pid.id'],
            name=op.f('fk_pidrelations_pidrelation_parent_id_pidstore_pid'),
            onupdate='CASCADE', ondelete='CASCADE'),
        sa.PrimaryKeyConstraint(
            'parent_id', 'child_id', name=op.f('pk_pidrelations_pidrelation')
        )
    )
135407
def upgrade():
    """"""
    op.drop_constraint(u'fk_access_actionsusers_user_id_accounts_user',
                       'access_actionsusers', type_='foreignkey')
    op.drop_index(op.f('ix_access_actionsusers_user_id'),
                  table_name='access_actionsusers')

    op.alter_column('access_actionsusers', 'user_id', nullable=False,
                    existing_type=sa.Integer())

    op.create_index(op.f('ix_access_actionsusers_user_id'),
                    'access_actionsusers', ['user_id'], unique=False)
    op.create_foreign_key(op.f('fk_access_actionsusers_user_id_accounts_user'),
                          'access_actionsusers', 'accounts_user', ['user_id'],
                          ['id'], ondelete='CASCADE')
142523
public static base_responses update(nitro_service client, nsip resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			nsip updateresources[] = new nsip[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new nsip();
				updateresources[i].ipaddress = resources[i].ipaddress;
				updateresources[i].td = resources[i].td;
				updateresources[i].netmask = resources[i].netmask;
				updateresources[i].arp = resources[i].arp;
				updateresources[i].icmp = resources[i].icmp;
				updateresources[i].vserver = resources[i].vserver;
				updateresources[i].telnet = resources[i].telnet;
				updateresources[i].ftp = resources[i].ftp;
				updateresources[i].gui = resources[i].gui;
				updateresources[i].ssh = resources[i].ssh;
				updateresources[i].snmp = resources[i].snmp;
				updateresources[i].mgmtaccess = resources[i].mgmtaccess;
				updateresources[i].restrictaccess = resources[i].restrictaccess;
				updateresources[i].dynamicrouting = resources[i].dynamicrouting;
				updateresources[i].ospf = resources[i].ospf;
				updateresources[i].bgp = resources[i].bgp;
				updateresources[i].rip = resources[i].rip;
				updateresources[i].hostroute = resources[i].hostroute;
				updateresources[i].hostrtgw = resources[i].hostrtgw;
				updateresources[i].metric = resources[i].metric;
				updateresources[i].vserverrhilevel = resources[i].vserverrhilevel;
				updateresources[i].ospflsatype = resources[i].ospflsatype;
				updateresources[i].ospfarea = resources[i].ospfarea;
				updateresources[i].vrid = resources[i].vrid;
				updateresources[i].icmpresponse = resources[i].icmpresponse;
				updateresources[i].arpresponse = resources[i].arpresponse;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
557624
@RequirePOST
    public void doUpgrade(StaplerResponse rsp) throws IOException, ServletException {
        HudsonUpgradeJob job = new HudsonUpgradeJob(getCoreSource(), Jenkins.getAuthentication());
        if(!Lifecycle.get().canRewriteHudsonWar()) {
            sendError("Jenkins upgrade not supported in this running mode");
            return;
        }

        LOGGER.info("Scheduling the core upgrade");
        addJob(job);
        rsp.sendRedirect2(".");
    }
1027912
def update(self, eid, data, token):
        
        final_dict = {"data": {"id": eid, "type": "libraryEntries", "attributes": data}}
        final_headers = self.header
        final_headers['Authorization'] = "Bearer {}".format(token)

        r = requests.patch(self.apiurl + "/library-entries/{}".format(eid), json=final_dict, headers=final_headers)

        if r.status_code != 200:
            raise ConnectionError(r.text)

        return True
730437
def register_success(self, upgrade):
        """"""
        u = Upgrade(upgrade=upgrade.name, applied=datetime.now())
        db.session.add(u)
        db.session.commit()