Update Content documents

@param Database $db
196197
protected function updateContents(Database $db)
    {
        $this->write(' + Updating content documents');

        $this->updateTinyMCEInContent($db);
        $this->updateMediaInContent($db);
    }
715514
public function upgradeDatabase()
    {
        \Concrete\Core\Database\Schema\Schema::refreshCoreXMLSchema([
            'PageFeeds',
        ]);

        // I can't seem to get the doctrine cache to clear any other way.
        $cms = \Core::make('app');
        $cms->clearCaches();

        $this->purgeOrphanedScrapbooksBlocks();
    }
563671
public function update(array $matchers, NodeContentsBase $contents)
    {
        if($this->matchers === $matchers && $this->contents === $contents) {
            return $this;
        }

        $clone = clone $this;
        $clone->matchers = $matchers;
        $clone->contents = $contents;

        return $clone;
    }
391438
public function up(Database $db)
    {
        $collection = $db->selectCollection($this->collection);
        $targetCollection = $db->selectCollection('Translation');

        $aggregate = [
            [
                '$match' => [
                    'isLocalized' => true,
                    'locale' => ['$ne' => 'en'],
                    'translated' => ['$ne' => null]
                ]
            ],
            [
                '$group' => [
                    '_id' => ['original' => '$original', 'locale' => '$locale'],
                    'translated' => ['$addToSet' => '$translated'],
                    'count' => ['$sum' => 1]
                ]
            ]
        ];

        foreach ($collection->aggregate($aggregate, ['cursor' => true]) as $translatable) {
            $original = $translatable['_id']['original'];
            $language = $translatable['_id']['locale'];
            $translation = $translatable['translated'][0];

            $rec = [
                'original' => $original,
                'language' => $language,
                'localized' => $translation
            ];

            try {
                $targetCollection->insert($rec);
            } catch (\Exception $e) {
                echo "Skipping already existing translation of original '${original}'".PHP_EOL;
            }
        }
    }
1346752
def update(self,o):
        """"""

        self.open()

        try:
            self._db.update(o._db)
        except AttributeError:
            self._db.update(o)
841465
public function executeModelChanges($db)
    {
        $count = 0;
        $models = Bootstrap::getSingleton()->getModels();
        $instanceModels = [];
        foreach ($models as $model) {
            if (class_exists($model)) {
                $instance = new $model(null);
                $instance->db = $db;
                if ($instance instanceof Model) {
                    $instanceModels[] = $instance;
                }
            }
        }
        $this->checkForDuplicatedTables($instanceModels);
        foreach ($instanceModels as $model) {
            $this->executeModel($db, $model);
        }
        $this->setDatabaseUpdate();
        return $count;
    }
484469
private function updateContentTable()
    {
        $metadata = $this->em->getClassMetadata('BackBee\ClassContent\AbstractClassContent');
        $table = $metadata->getTableName();
        $field = $metadata->discriminatorColumn['name'];

        return $this->executeUpdate($table, $field);
    }
1315916
protected function setDB (\Native5\Core\Database\DB $db) {
        if (empty($db))
            throw new \InvalidArgumentException("Emoty DB object received");

        $this->db = $db;
    }
516591
def update(connection, silent, hgnc_file_path, hcop_file_path, low_memory):
    """"""
    database.update(connection=connection,
                    silent=silent,
                    hgnc_file_path=hgnc_file_path,
                    hcop_file_path=hcop_file_path,
                    low_memory=low_memory)
101790
protected function executeStoreDocumentTermCount($values, $sql, $db)
    {
        $sql .= '(' . implode('),' . PHP_EOL . '(', $values) . ');';
        $stmt = $db->prepare($sql);
        if ($stmt === false || !$stmt->execute()) {
            $errorInfo = $db->errorInfo();
            $errorMsg = $errorInfo[2];
            throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
        }
    }
881798
def update(database, table, key):
    """"""
    field = random.randrange(10)
    value = ''.join(random.choice(string.printable) for i in range(100))
    with database.batch() as batch:
        batch.update(table=table, columns=('id', 'field%d' % field),
                     values=[(key, value)])
596568
protected function handleStatusAlerts($db)
    {
        if ($db['status']) {
            if ($this->eye->status()->isSick('database_status_'.$db['connection'])) {
                $this->eye->notifier()->alert(new Online($db));
            }

            $this->eye->status()->setHealthy('database_status_'.$db['connection']);
        } else {
            if ($this->eye->status()->isHealthy('database_status_'.$db['connection'])) {
                $this->eye->notifier()->alert(new Offline($db));
            }

            $this->eye->status()->setSick('database_status_'.$db['connection']);
        }

    }
890010
private function update()
    {
        $db = new Db();

        //Insert into article table
        $row = $db->query('UPDATE article
                            SET   category = :category,
                                  author = :author,
                                  pubdate = :pubdate,
                                  editdate = :editdate,
                                  tags = :tags,
                                  status = :status,
                                  title = :title,
                                  media = :media,
                                  resume = :resume
                            WHERE id = :id',

                        [':id'=>$this->id,
                         ':category' => $this->category,
                         ':author' => $this->author,
                         ':pubdate' => $this->pubdate,
                         ':editdate' => $this->editdate,
                         ':tags' => $this->tags,
                         ':status' => $this->status,
                         ':title' => $this->title,
                         ':media' => $this->media,
                         ':resume' => $this->resume
                        ]);
        //check update
        if (!$row) {
            return false;
        }

        //Insert into content table
        $row = $db->query('UPDATE articlecontent
                            SET   editdate = :editdate,
                                  content = :content
                            WHERE article = :article',
                            
                        [':article' => $this->id,
                         ':editdate' => $this->editdate,
                         ':content' => $this->content]);
        return $row;

        
        $cols = '';
        $vals = [];
        foreach ($this as $k => $v) {
            if ($k == 'table' || $k == 'where') {
                continue;
            }echo '<br><b>'.$k.': </b>'.$v;
            if ($k !== 'id') {
                $cols .= $k.' = :'.$k.',';
            }
            $vals[':'.$k] = $v;
        }
        
        $cols = substr($cols, 0, -1); //tirando a ultima vírgula

        $where = ' WHERE id = :id ';
        if ($this->where != null) {
            $where .= ' and '.$this->where;
        }

        $db = new Db();
        return $db->query('UPDATE '.$this->table.' SET '.$cols.$where, $vals);
    }
366049
public function setAssetsDb(array $db)
    {
        foreach ($db as $package_name=>$package) {
            if (empty($package['path']) && isset($package['relative_path'])) {
                $db[$package_name]['path'] = DirectoryHelper::slashDirname(
                    DirectoryHelper::slashDirname($this->getRootDirectory()) .
                    DirectoryHelper::slashDirname($this->getAssetsDirectory()) .
                    DirectoryHelper::slashDirname($this->getAssetsVendorDirectory()) .
                    $package['relative_path']
                );
            }
        }
        $this->assets_db = $db;
        return $this;
    }
758264
public function setDb( string $db ) : SQLite
   {

      if ( ! $this->_supportedAttributes->get( 'db' )->validateValue( $db ) )
      {
         throw new ArgumentException( 'db', $db, 'Invalid database!' );
      }

      $this->_attributes[ 'db' ] = $db;

      return $this;

   }
1274419
private function createXMLDoc(Database $database)
    {
        $doc = new DOMDocument('1.0', 'utf-8');
        $doc->formatOutput = true; // pretty printing
        $doc->appendChild($doc->createComment("Created by PropelDataDumpTask."));

        $dsNode = $doc->createElement("dataset");
        $dsNode->setAttribute("name", "all");
        $doc->appendChild($dsNode);

        $platform = $this->getGeneratorConfig()->getConfiguredPlatform($this->conn);

        $this->log("Building DOM tree containing data from tables:");

        foreach ($database->getTables() as $tbl) {
            $this->log("\t+ " . $tbl->getName());
            $stmt = $this->getTableDataStmt($tbl->getName(), $platform);
            while ($row = $stmt->fetch()) {
                $rowNode = $doc->createElement($tbl->getPhpName());
                foreach ($tbl->getColumns() as $col) {
                    $cval = $row[$col->getName()];
                    if ($cval !== null) {
                        $rowNode->setAttribute($col->getPhpName(), iconv($this->dbEncoding, 'utf-8', $cval));
                    }
                }
                $dsNode->appendChild($rowNode);
                unset($rowNode);
            }
            unset($stmt);
        }

        return $doc;
    }
141746
protected function updateMedias(Database $db)
    {
        $this->write(' + Updating media documents');
        $this->write('  + Removing alts');

        $this->checkExecute($db->execute('
            db.media.update({}, {$unset: {alts: ""}}, {multi: true});
        '));
    }