Returns an ordered array of MigrationScriptInterface objects within the range specified.

@param int $from
@param int $to
@param string[] $skipScripts
@return MigrationScriptInterface[]
356867
public function getMigrationScripts(int $from, int $to, array $skipScripts = []): array
    {
        $migrationScripts = [];
        $provider = MigrationsStateProvider::getProvider();
        foreach ($this->migrationScripts as $scriptClass) {
            $migrationScript = new $scriptClass();
            if (!is_a($migrationScript, MigrationScriptInterface::class)) {
                throw new \Error('Non-MigrationScriptInterface object provided to MigrationManager: `' . $migrationScript.'`');
            }
            if (
                $migrationScript->version() < $from
                || $migrationScript->version() > $to
                || array_search($scriptClass, $skipScripts) !== false
            ) {
                continue;
            }
            if ($provider->isScriptComplete($scriptClass)) {
                continue;
            }
            $migrationScripts[] = $migrationScript;
        }
        usort($migrationScripts, function (MigrationScriptInterface $a, MigrationScriptInterface $b) {
            return $a->version() <=> $b->version();
        });

        return $migrationScripts;
    }
1327498
protected function longestCommonSubsequence(array $from, array $to)
    {
        $common     = array();
        $matrix     = array();
        $fromLength = count($from);
        $toLength   = count($to);

        for ($i = 0; $i <= $fromLength; ++$i) {
            $matrix[$i][0] = 0;
        }

        for ($j = 0; $j <= $toLength; ++$j) {
            $matrix[0][$j] = 0;
        }

        for ($i = 1; $i <= $fromLength; ++$i) {
            for ($j = 1; $j <= $toLength; ++$j) {
                $matrix[$i][$j] = max(
                  $matrix[$i-1][$j],
                  $matrix[$i][$j-1],
                  $from[$i-1] === $to[$j-1] ? $matrix[$i-1][$j-1] + 1 : 0
                );
            }
        }

        $i = $fromLength;
        $j = $toLength;

        while ($i > 0 && $j > 0) {
            if ($from[$i-1] === $to[$j-1]) {
                array_unshift($common, $from[$i-1]);
                --$i;
                --$j;
            }

            else if ($matrix[$i][$j-1] > $matrix[$i-1][$j]) {
                --$j;
            }

            else {
                --$i;
            }
        }

        return $common;
    }
123991
protected function prepareFrom($froms) {
        $_froms = [];
        if ($froms) {
            foreach ($froms as $from) {
                $table     = $this->dialect->getTableName($from [0]);
                $alias     = empty ($from [1]) ? $table : $from [1];
                $_froms [] = [$table, $alias];
            }
        }

        return $_froms;
    }
1340679
public static function move($names, &$from, &$to)
    {
        if (is_array($from) && is_array($to)) {
            foreach ($names as $key) {
                if (isset($from[$key]) && !isset($to[$key])) {
                    $to[$key] = static::getValue($from, $key);
                    $moved[$key] = static::removeValue($from, $key);
                }
            }
        }
        return $moved;
    }
230326
private function resolveTo($to, $from)
    {
        if (is_string($to)) {
            $to = strtolower($to);
        }

        if ($to === 'down') {
            $to = $this->versionCollection->getPreviousVersion($from);
        }

        if ($to === 'up') {
            $to = $this->versionCollection->getNextVersion($from);
        }

        if ($to === 'bottom') {
            $to = 0;
        }

        if ($to === 'top' || null === $to) {
            $to = $this->versionCollection->getLatestVersion();
        }

        if (0 !== $to && false === strtotime($to)) {
            throw new MigratorException(sprintf(
                'Unknown migration action "%s". Known actions: "%s"',
                $to,
                implode('", "', $this->actions)
            ));
        }

        if (0 !== $to && !$this->versionCollection->has($to)) {
            throw new MigratorException(sprintf(
                'Unknown version "%s"', $to
            ));
        }

        return $to;
    }
1172711
public static function DateRangeDiff(string $from, string $to)
    {
        $date_Range = new \Phunc\DateRange\DateRange();
        $date_Range->fillFromString($from, $to);
        $date_Range->getFrom()->hour(0)->minute(0)->second(0);
        $date_Range->getTo()->hour(24); //->minute(59)->second(59);
        return $date_Range->diffInDays();
    }
72196
public function setTimeRange($from, $to)
    {
        $fromDate = date('Y-m-d H:i:s', (int) $from);
        $toDate = date('Y-m-d H:i:s', (int) $to);

        $this->where(array("time > '$fromDate'", "time < '$toDate'"));

        return $this;
    }
409358
public function copyDir($from,$to,Finder $finder)
    {
        /* @var \Symfony\Component\Finder\SplFileInfo $path */

        $finder->in($from);
        foreach ($finder->files() as $path) {
            $targetDir = $to.DIRECTORY_SEPARATOR.$path->getRelativePath();
            if (!is_dir($targetDir)) {
                mkdir($targetDir,0755,true);
            }
            $target = $to.DIRECTORY_SEPARATOR.$path->getRelativePathname();
            copy($path->getRealPath(),$target);
        }
    }
1177114
public function copyTableData( $from, $to, $columns )
    {
        // get existing rows
        $cols = implode( ', ', array_keys( $columns ) );
        $cols = rtrim( $cols, ',' );

        // move all data to new table
        $rows = $this->query( "SELECT $cols FROM $to" );

        foreach ( $rows as $row )
        {
            $query = "INSERT INTO $from ( $cols ) VALUES ( " .
                rtrim( str_repeat( '?,', count( $columns ), ',' ) ) .
                " )";

            $values = [ ];

            foreach ( $row as $key => $value )
            {
                if ( in_array( $key, array_keys( $columns ) ) )
                {
                    $values[ ] = $row[ $key ];
                }
            }

            $this->execute( $query, $values );
        }
    }
820665
public function copy($from, $to, array $config = [])
    {
        list($prefixFrom, $from) = $this->getPrefixAndPath($from);

        $buffer = $this->getFilesystem($prefixFrom)->readStream($from);

        if ($buffer === false) {
            return false;
        }

        list($prefixTo, $to) = $this->getPrefixAndPath($to);

        $result = $this->getFilesystem($prefixTo)->writeStream($to, $buffer, $config);

        if (is_resource($buffer)) {
            fclose($buffer);
        }

        return $result;
    }
19961
public function copyTo(FileNode $from, FileNode $to)
    {
        $mountManager = new MountManager([
            'from' => $from->getFilesystem(),
            'to'   => $to->getFilesystem(),
        ]);

        $this->log(LogLevel::INFO, "Copying file from: '{from}', to: '{to}'", [
            'from' => $from,
            'to'   => $to,
        ]);
        if (!$mountManager->copy('from://' . $from->getPath(), 'to://' . $to->getPath())) {
            throw new TransferFailedException($from, $to);
        }

        return $to;
    }
812842
public function resetCatalog($from = null, $to = null)
    {
        $conn = $this->getConnection();
        if ($from && $to) {
            $where = [
                'created_at >= ?' => $from . ' 00:00:00',
                'created_at <= ?' => $to . ' 23:59:59',
                'imported is ?' => new \Zend_Db_Expr('not null')
            ];
        } else {
            $where = $conn->quoteInto(
                'imported is ?',
                new \Zend_Db_Expr('not null')
            );
        }
        $num = $conn->update(
            $this->getTable(Schema::EMAIL_CATALOG_TABLE),
            [
                'imported' => new \Zend_Db_Expr('null'),
                'modified' => new \Zend_Db_Expr('null'),
            ],
            $where
        );

        return $num;
    }
787410
public function migrateExpiredJobs($from, $to)
    {
        return $this->getConnection()->eval(
            LuaScripts::migrateExpiredJobs(), 3, $from, $to, $to.':notify', $this->currentTime()
        );
    }
403450
public function removeRange($from, $to)
    {
        foreach ($this->ranges as $key => $range) {
            if (array_diff_assoc(array_filter(['from' => $from, 'to' => $to]), $range) === []) {
                unset($this->ranges[$key]);

                return true;
            }
        }

        return false;
    }
471367
public function migrateExpiredJobs($from, $to, $attempt = true)
    {
        $this->redis->watch($from);

        $jobs = $this->redis->zRangeByScore($from, '-inf', $this->currentTime());

        if (!empty($jobs)) {
            $this->transaction(function () use ($from, $to, $jobs, $attempt) {

                $this->redis->zRemRangeByRank($from, 0, count($jobs) - 1);

                for ($i = 0; $i < count($jobs); $i += 100) {

                    $values = array_slice($jobs, $i, 100);

                    $this->redis->rPush($to, ...$values);
                }
            });
        }

        $this->redis->unwatch();
    }
451636
public function migrateExpiredJobs($from, $to)
    {
        //$options = ['cas' => true, 'watch' => $from, 'retry' => 10];
        $attempts = 10;

        do {
            //echo $attempts.'';

            $jobs = $this->getExpiredJobs(
                $this->getConnection(), $from, $time = $this->getTime()
            );

            //var_dump($jobs);

            if (count($jobs) > 0) {
                $this->removeExpiredJobs($this->getConnection(), $from, $time);

                $this->pushExpiredJobsOntoNewQueue($this->getConnection(), $to, $jobs);
            }
            //var_dump($queue->isEmpty());

            /*if ($queue->isEmpty()) {
                $this->getConnection()->unwatch($from);
                $this->getConnection()->discard();
                return;
            }*/

            $execResponse = $this->getConnection()->exec();
            //var_dump( $execResponse);

            if ($execResponse === null) {
                continue;
            }

            break;

        } while ($attempts-- > 0);

    }
151768
public function humanizedChanges($from, $to)
    {
        if (!$from) {
            return _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.UPLOADEDFILE', "Uploaded file");
        }

        $fromRecord = Versioned::get_version(get_class($this->owner), $this->owner->ID, $from);
        $toRecord = Versioned::get_version(get_class($this->owner), $this->owner->ID, $to);

        $diff = new DataDifferencer($fromRecord, $toRecord);
        $changes = $diff->changedFieldNames();

        $k = array_search('LastEdited', $changes);

        if ($k !== false) {
            unset($changes[$k]);
        }

        $output = array();

        foreach ($changes as $change) {
            $human = $change;

            if ($change == "ParentID") {
                // updated folder ID
                $human = _t(
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdminFile.MOVEDFOLDER',
                    "Moved file"
                );
            } elseif ($change == 'Title') {
                $human = _t(
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdminFile.RENAMEDTITLE',
                    "Updated title to "
                ) . $fromRecord->Title;
            } elseif ($change == 'Name') {
                $human = _t(
                    'SilverStripe\\AssetAdmin\\Controller\\AssetAdminFile.RENAMEDFILE',
                    "Renamed file to "
                ) . $fromRecord->Filename;
            } elseif ($change == 'File') {
                // check to make sure the files are actually different
                if ($fromRecord->getHash() != $toRecord->getHash()) {
                    $human = _t(
                        'SilverStripe\\AssetAdmin\\Controller\\AssetAdminFile.RENAMEDFILE',
                        "Replaced file"
                    );
                } else {
                    $human = false;
                }
            } else {
                $human = false;
            }

            if ($human) {
                $output[] = $human;
            }
        }

        return implode(", ", $output);
    }