Update the origin_site_name for a given block name
776940
def updateSiteName(self, block_name, origin_site_name):
        
        if not origin_site_name:
            dbsExceptionHandler('dbsException-invalid-input',
                                "DBSBlock/updateSiteName. origin_site_name is mandatory.")
        conn = self.dbi.connection()
        trans = conn.begin()
        try:
            self.updatesitename.execute(conn, block_name, origin_site_name)
        except:
            if trans:
                trans.rollback()
            raise
        else:
            if trans:
                trans.commit()
        finally:
            if conn:
                conn.close()
1363882
function loadConfigAndGenerateSite(useServer, port) {
  var config = loadConfig();
  if (port) config.port = port;
  generateSite(config, useServer);
}
449878
function(oldName, newName) {
    var change = false;
    for (var i = 0; i < this.arguments_.length; i++) {
      if (Blockly.Names.equals(oldName, this.arguments_[i])) {
        this.arguments_[i] = newName;
        change = true;
      }
    }
    if (change) {
      this.updateParams_();
      // Update the mutator's variables if the mutator is open.
      if (this.mutator.isVisible()) {
        var blocks = this.mutator.workspace_.getAllBlocks();
        for (var i = 0, block; block = blocks[i]; i++) {
          if (block.type == 'procedures_mutatorarg' &&
              Blockly.Names.equals(oldName, block.getFieldValue('NAME'))) {
            block.setFieldValue(newName, 'NAME');
          }
        }
      }
    }
  }
667237
static function changeBasename( &$mimeInfo, $basename )
    {
        $mimeInfo['basename'] = $basename;
        $mimeInfo['filename'] = $basename . '.' . $mimeInfo['suffix'];
        if ( $mimeInfo['dirpath'] )
            $mimeInfo['url'] = $mimeInfo['dirpath'] . '/' . $mimeInfo['filename'];
        else
            $mimeInfo['url'] = $mimeInfo['filename'];
    }
1291798
function updateDomainDns (dns, ip, cb) {
        var body = {
            content: ip
        };
        _hoverRequest('PUT', '/dns/' + dns, body, cb);
    }
1033448
def change_site(self, old_site_name, new_site_name, new_location_name=None,
                    new_er_data=None, new_pmag_data=None, replace_data=False):
        
        site = self.find_by_name(old_site_name, self.sites)
        if not site:
            print('-W- {} is not a currently existing site, so it cannot be updated.'.format(old_site_name))
            return False
        if new_location_name:
            if site.location:
                old_location = self.find_by_name(site.location.name, self.locations)
                if old_location:
                    old_location.sites.remove(site)
            new_location = self.find_by_name(new_location_name, self.locations)
            if not new_location:
                print("""-W- {} is not a currently existing location.
Adding location with name: {}""".format(new_location_name, new_location_name))
                new_location = self.add_location(new_location_name)
            new_location.sites.append(site)
        else:
            new_location = None
        ## check all declinations/azimuths/longitudes in range 0=>360.
        #for key, value in new_er_data.items():
        #    new_er_data[key] = pmag.adjust_to_360(value, key)
        site.change_site(new_site_name, new_location, new_er_data, new_pmag_data, replace_data)
        return site
1014168
def call_name_is(siter, name):
    """"""
    return (
        isinstance(siter, ast.Call)
        and hasattr(siter.func, 'attr')
        and siter.func.attr == name
    )
1206299
def update_alias(self, addressid, data):
        """"""
        return self.api_call(
            ENDPOINTS['aliases']['update'],
            dict(addressid=addressid),
            body=data)
1241344
def replace_name(expr: AST, old_name: str, new_name: str) -> AST:
    """"""
    return _NameReplacer(old_name, new_name).visit(deepcopy(expr))
425480
public void changeSite(String siteRoot) {

        if (!getCmsObject().getRequestContext().getSiteRoot().equals(siteRoot)) {
            getCmsObject().getRequestContext().setSiteRoot(siteRoot);
            getWorkplaceSettings().setSite(siteRoot);
            OpenCms.getSessionManager().updateSessionInfo(getCmsObject(), getHttpSession());
        }
    }
269026
def execute(self, conn, block_name, origin_site_name, transaction=False):
        
        if not conn:
            dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/Block/UpdateStatus. \
Expects db connection from upper layer.", self.logger.exception)
        binds = {"block_name": block_name, "origin_site_name": origin_site_name, "mtime": dbsUtils().getTime(),
                 "myuser": dbsUtils().getCreateBy()}
        self.dbi.processData(self.sql, binds, conn, transaction)
48355
def _update_from_standard_locations():
    ''' 
    '''
    locs = [
        join(expanduser('~'), _config_name),
        join('.', _config_name)
    ]
    if 'PLIERS_CONFIG' in os.environ:
        locs.insert(1, os.environ['PLIERS_CONFIG'])

    from_file(locs, False)
402607
function generateSite(config, useServer) {
  var fileMap = new FileMap(config)
    , siteBuilder = new SiteBuilder(config)
    , server = require(__dirname + '/server')(siteBuilder);

  fileMap.walk();
  fileMap.on('ready', function() {
    siteBuilder.fileMap = fileMap;
    siteBuilder.build();
  });

  siteBuilder.once('ready', function() {
    if (useServer) {
      server.run();
      server.watch();
    }
  });

  return siteBuilder;
}
1259596
function iniDOMTree( $filename, $siteAccess, &$blockArray, $remoteIDArray )
    {
        if ( !$filename || !$siteAccess || !$blockArray )
        {
            return false;
        }

        $iniNode = eZDOMDocument::createElementNode( 'ini-addon', array( 'site-access' => $siteAccess,
                                                                          'filename' => $filename ) );

        $blocksNode = eZDOMDocument::createElementNode( 'blocks' );
        $iniNode->appendChild( $blocksNode );
        foreach( array_keys( $blockArray ) as $blockName )
        {
            $block =& $blockArray[$blockName];
            unset( $blockNode );
            $blockNode = eZDOMDocument::createElementNode( 'block', array( 'name' => $blockName ) );
            $blocksNode->appendChild( $blockNode );

            foreach( array_keys( $block ) as $blockVariable )
            {
                $variableValue =& $block[$blockVariable];
                unset( $variableNode );
                $variableNode = eZDomDocument::createElementNode( 'block-variable', array( 'name' => $blockVariable ) );
                $blockNode->appendChild( $variableNode );

                if ( is_array( $variableValue ) )
                {
                    foreach( array_keys( $variableValue) as $valueName )
                    {
                        $value = $variableValue[$valueName];
                        unset( $valueNode );
                        $valueNode = eZDomDocument::createElementNode( 'value', array( 'name' => $valueName ) );
                        $variableNode->appendChild( $valueNode );
                        $remoteID = false;
                        if ( is_int( $value ) )
                        {
                            if ( strpos( $valueName, 'class' ) !== false )
                            {
                                $value = $remoteIDArray['class'][(string)$value];
                                $remoteID = 'class';
                            }
                            else if( strpos( $valueName, 'node' ) !== false )
                            {
                                $value = $remoteIDArray['node'][(string)$value];
                                $remoteID = 'node';
                            }
                            else if ( strpos( $valueName, 'object' ) !== false )
                            {
                                $value = $remoteIDArray['class'][(string)$value];
                                $remoteID = 'object';
                            }
                            else
                            {
                                eZDebug::writeNotice( 'Could not interpret ' . $valueName . ': ' . $value, __METHOD__ );
                            }
                        }
                        if ( $remoteID )
                        {
                            $valueNode->appendAttribute( eZDomDocument::createAttributeNode( 'remote-id', $remoteID ) );
                        }
                        $valueNode->appendChild( eZDomDocument::createTextNode( $value ) );
                    }
                }
                else
                {
                    $remoteID = false;
                    if ( is_int( $variableValue ) )
                    {
                        if ( strpos( $blockVariable, 'class' ) !== false )
                        {
                            $variableValue = $remoteIDArray['class'][(string)$value];
                            $remoteID = 'class';
                        }
                        else if( strpos( $blockVariable, 'node' ) !== false )
                        {
                            $variableValue = $remoteIDArray['node'][(string)$value];
                            $remoteID = 'node';
                        }
                        else if ( strpos( $blockVariable, 'object' ) !== false )
                        {
                            $variableValue = $remoteIDArray['class'][(string)$value];
                            $remoteID = 'object';
                        }
                        else
                        {
                            eZDebug::writeNotice( 'Could not interpret ' . $blockVariable . ': ' . $variableValue, __METHOD__ );
                        }
                    }
                    unset( $valueNode );
                    $valueNode = eZDomDocument::createElementNode( 'value' );
                    $variableNode->appendChild( $valueNode );
                    if ( $remoteID )
                    {
                        $valueNode->appendAttribute( eZDomDocument::createAttributeNode( 'remote-id', $remoteID ) );
                    }
                    $valueNode->appendChild( eZDomDocument::createTextNode( $variableValue ) );
                }
            }
        }
        return $iniNode;
    }
359171
def _map_block_index_to_location(ir_blocks):
    """"""
    block_index_to_location = {}
    # MarkLocation blocks occur after the blocks related to that location.
    # The core approach here is to buffer blocks until their MarkLocation is encountered
    # after which all buffered blocks can be associated with the encountered MarkLocation.location.
    current_block_ixs = []
    for num, ir_block in enumerate(ir_blocks):
        if isinstance(ir_block, blocks.GlobalOperationsStart):
            if len(current_block_ixs) > 0:
                unassociated_blocks = [ir_blocks[ix] for ix in current_block_ixs]
                raise AssertionError(
                    u'Unexpectedly encountered global operations before mapping blocks '
                    u'{} to their respective locations.'.format(unassociated_blocks))
            break
        current_block_ixs.append(num)
        if isinstance(ir_block, blocks.MarkLocation):
            for ix in current_block_ixs:
                block_index_to_location[ix] = ir_block.location
            current_block_ixs = []
    return block_index_to_location
400559
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters ) {
        switch ($operatorName)
        {
            case 'xhprof_start':
                eZXHProfLogger::start( $namedParameters['flags'], $namedParameters['options'] );
                $operatorValue = null;
                break;
            case 'xhprof_stop':
                eZXHProfLogger::stop( $namedParameters['dosave'] );
                $operatorValue = null;
                break;
            case 'record_value':
                eZPerfLogger::recordValue( $namedParameters['name'], $operatorValue );
                $operatorValue = null;
                break;
            case 'make_global':
                /// @todo investigate: shal we use copy if $operatorValue is an object?
                $GLOBALS[$namedParameters['name']] = $namedParameters['value'];
                $operatorValue = null;
        }
    }
1108267
def disable_site(site_name):
    """"""

    site = u'/etc/nginx/sites-enabled/%s' % site_name
    if files.exists(site):
        sudo(u'rm %s' % site)
        restart_service(u'nginx')