Removes option entries for columns that are marked as installed but are actually no longer installed due to
a bug in previous versions where the option entries were not correctly removed.

@param Updater $updater
@return array
961435
public function getMigrations(Updater $updater)
    {
        $visitMigrations = $this->getMigrationsThatRemoveOptionEntriesOfNotActuallyInstalledColumns(VisitDimension::INSTALLER_PREFIX, 'log_visit');
        $actionMigrations = $this->getMigrationsThatRemoveOptionEntriesOfNotActuallyInstalledColumns(ActionDimension::INSTALLER_PREFIX, 'log_link_visit_action');
        $conversionMigrations = $this->getMigrationsThatRemoveOptionEntriesOfNotActuallyInstalledColumns(ConversionDimension::INSTALLER_PREFIX, 'log_conversion');

        $migrations = array();

        foreach ($visitMigrations as $migration) {
            $migrations[] = $migration;
        }

        foreach ($actionMigrations as $migration) {
            $migrations[] = $migration;
        }

        foreach ($conversionMigrations as $migration) {
            $migrations[] = $migration;
        }

        return $migrations;
    }
1069729
private function addColumnToAdminUserTable($installer)
    {
        $installer->getConnection()->addColumn(
            $installer->getTable('admin_user'),
            'refresh_token',
            [
            'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            'length' => 256,
            'nullable' => true,
            'default' => null,
            'comment' => 'Email connector refresh token',
            ]
        );
    }
327315
public function clear()
    {
        $this->map = array();
        $this->namedCriterions = array();
        $this->ignoreCase = false;
        $this->singleRecord = false;
        $this->selectModifiers = array();
        $this->selectColumns = array();
        $this->orderByColumns = array();
        $this->groupByColumns = array();
        $this->having = null;
        $this->asColumns = array();
        $this->joins = array();
        $this->selectQueries = array();
        $this->dbName = $this->originalDbName;
        $this->offset = 0;
        $this->limit = 0;
        $this->blobFlag = null;
        $this->aliases = array();
        $this->useTransaction = false;
        $this->conditionalProxy = null;
        $this->defaultCombineOperator = Criteria::LOGICAL_AND;
        $this->primaryTableName = null;
        $this->queryComment = null;

    }
56988
public function saveCalculatedUpdates($updates)
    {
        foreach ($updates as $date => $updatesByDate) {
            /** @var Entity $data */
            foreach ($updatesByDate as $data) {
                /* some entries are without dates */
                $data->setDate($date);
                $this->replace($data);
            }
        }
    }
932728
public function clear($seeder = null)
    {
        if (is_string($seeder)) {
            $ref = new \ReflectionClass($this);

            include_once dirname($ref->getFileName()) . '/' . $seeder . '.php';

            $seeder = new $seeder();
        }

        $seeder->setDb($this->db);
        $seeder->setCommand($this->command);

        $this->command->out('Clear seeder <comment>' . get_class($seeder) . '</comment>');

        $seeder->doClear();

        return $this;
    }
615661
private function clearChangeSets()
    {
        $clearChangeSets = function () {
            $this->entityInsertions = $this->entityUpdates
                = $this->entityDeletions
                = $this->extraUpdates
                = $this->entityChangeSets
                = $this->collectionUpdates
                = $this->collectionDeletions
                = $this->visitedCollections
                = $this->scheduledForSynchronization
                = $this->orphanRemovals
                = [];
        };
        $clearChangeSets = $clearChangeSets->bindTo($this->entityManager->getUnitOfWork(), UnitOfWork::class);
        $clearChangeSets();
    }
924569
private function filter_options() {
		$options = static::$options;

		// Remove checkbox options, only after background update complete.
		if ( ! $this->waiting_for_background_update() ) {
			$options = array_filter(
				$options,
				function ( $e ) {
					return '1' !== $e;
				}
			);
		}

		$options = array_merge( $options, $_POST['github_updater'] );

		return $options;
	}
531511
private function getRemoteVersionInfo(Updater $updater)
    {
        $version = $this->getCurrentRemoteVersion($updater);
        if ($version === false) {
            throw new \RuntimeException('No remote versions found');
        }
        $versionInfo = $this->getAvailableVersions();
        if (!isset($versionInfo[$version])) {
            throw new \RuntimeException(sprintf('Failed to find manifest item for version %s', $version));
        }

        return $versionInfo[$version];
    }
1224479
public function removeOptionsByValue($value)
    {
        $removed_options = array();

        foreach ($this->options as $key => $control_option) {
            if ($control_option->value === $value) {
                $removed_options[] = $control_option;

                // remove from options list
                unset($this->options[$key]);

                // remove metadata
                $metadata_key = $this->getOptionMetadataKey($control_option);
                unset($this->option_metadata[$metadata_key]);
            }
        }

        return $removed_options;
    }
175566
public function remove(array $updates, $class, $append = true)
    {
        $commandClass = $this->getCommandClass('update.remove');
        $this->command = new $commandClass($updates, $class, $append);

        return $this->command;
    }
621862
protected function removeReservedFields()
    {
        if (!$this->isMode(static::MODE_CREATE)) {
            return;
        }

        $reservedColumns = [
            $this->form->model()->getKeyName(),
            $this->form->model()->getCreatedAtColumn(),
            $this->form->model()->getUpdatedAtColumn(),
        ];

        $this->fields = $this->fields()->reject(function (Field $field) use ($reservedColumns) {
            return in_array($field->column(), $reservedColumns, true);
        });
    }
67241
public function getColumnOptions()
    {
        //make sure we only run this once and then return the cached version
        if (empty($this->columnOptions)) {
            foreach ($this->getColumns() as $column) {
                $this->columnOptions[] = $column->getOptions();
            }
        }

        return $this->columnOptions;
    }
9340
private function detectRenamedColumns(array &$createdColumns, array &$droppedColumns, array &$alteredColumns)
    {
        foreach ($createdColumns as $createdIndex => $createdColumn) {
            foreach ($droppedColumns as $droppedIndex => $droppedColumn) {
                $columnDiff = $this->columnComparator->compare($droppedColumn, $createdColumn);

                if ($columnDiff->hasNameDifferenceOnly()) {
                    $alteredColumns[] = $columnDiff;

                    unset($createdColumns[$createdIndex]);
                    unset($droppedColumns[$droppedIndex]);

                    break;
                }
            }
        }
    }
602225
protected function cleanupOldBackups($rollbackDir)
    {
        $finder = $this->getOldInstallationFinder($rollbackDir);

        $fileSystem = new Filesystem;
        foreach ($finder as $file) {
            $file = (string) $file;
            $this->getIO()->writeError('<info>Removing: ' . $file . '</info>');
            $fileSystem->remove($file);
        }
    }
690295
public function removeDeleted()
    {
        $trx = models\DbMessage::getDb()->transaction !== null ? null : models\DbMessage::getDb()->beginTransaction();
        $primaryKey = models\DbMessage::primaryKey();
        $message_ids = models\DbMessage::find()
            ->withQueue($this->id)
            ->deleted()
            ->select($primaryKey)
            ->asArray()
            ->all();
        models\DbMessage::deleteAll(['in', $primaryKey, $message_ids]);
        if ($trx !== null) {
            $trx->commit();
        }

        return $message_ids;
    }
908244
public function deleteImage($updateDb = false)
    {
        $owner = $this->owner;
        $DS = DIRECTORY_SEPARATOR;

        $image = str_replace('/', $DS, $this->_oldImage);

        if (!empty($image)) {
            $dirName = Yii::getAlias($this->_savePathAlias);
            // Remove all resized images
            foreach ($this->getImageSizes() as $prefix => $size) {
                $file_name = $dirName . $DS . static::addPrefixToFile($image, $prefix);
                @unlink($file_name);
            }
            // Remove original image
            @unlink($this->getOriginalImagePath());
        }

        // Clear field value
        $owner->{$this->_imageAttribute} = null;
        $this->_oldImage = null;

        if ($updateDb) {
            $owner->update(false, [$this->_imageAttribute]);
        }
    }
1366312
public function clear()
    {
        parent::clear();

        $this->with = array();
        $this->primaryCriteria = null;
        $this->formatter = null;
        $this->select = null;
        $this->modelAlias = $this->originalModelAlias;
        $this->currentAlias = null;
        $this->setDbName($this->originalDbName);
        $this->useAliasInSQL = false;
        $this->isKeepQuery = true;
        $this->previousJoin = null;
        $this->isWithOneToMany = false;
        $this->replacedColumns = array();
        $this->foundMatch = false;

        return $this;
    }