Reset the email wishlist for re-import.

@param string|null $from
@param string|null $to

@return int
485259
public function resetWishlists($from = null, $to = null)
    {
        $conn = $this->getConnection();
        if ($from && $to) {
            $where = [
                'created_at >= ?' => $from . ' 00:00:00',
                'created_at <= ?' => $to . ' 23:59:59',
                'wishlist_imported is ?' => new \Zend_Db_Expr('not null')
            ];
        } else {
            $where = $conn->quoteInto(
                'wishlist_imported is ?',
                new \Zend_Db_Expr('not null')
            );
        }
        $num = $conn->update(
            $this->getTable(Schema::EMAIL_WISHLIST_TABLE),
            [
                'wishlist_imported' => new \Zend_Db_Expr('null'),
                'wishlist_modified' => new \Zend_Db_Expr('null'),
            ],
            $where
        );

        return $num;
    }
1149175
public function replaceDocumentUser(User $from, User $to)
    {
        $documents = $this->documentRepo->findByUser($from);

        if (count($documents) > 0) {
            foreach ($documents as $document) {
                $document->setUser($to);
            }

            $this->om->flush();
        }

        return count($documents);
    }
776635
public function filterBySize($from, $to)
    {
        $this->query->andWhere('fv.fvSize >= :fvSizeFrom');
        $this->query->andWhere('fv.fvSize <= :fvSizeTo');
        $this->query->setParameter('fvSizeFrom', $from * 1024);
        $this->query->setParameter('fvSizeTo', $to * 1024);
    }
504400
public function replaceAbilityProgressUser(User $from, User $to)
    {
        $abilityyProgresses = $this->abilityProgressRepo->findByUser($from);

        if (count($abilityyProgresses) > 0) {
            foreach ($abilityyProgresses as $abilityyProgress) {
                $abilityyProgress->setUser($to);
            }

            $this->om->flush();
        }

        return count($abilityyProgresses);
    }
980839
public function replaceUser(User $from, User $to)
    {
        $contributions = $this->contributionRepository->findByContributor($from);

        if (count($contributions) > 0) {
            foreach ($contributions as $contribution) {
                $contribution->setContributor($to);
            }

            $this->om->flush();
        }

        return count($contributions);
    }
141710
public function rename($from, $to)
    {
        if (is_null($key = $this->search($from))) {
            return false;
        }

        $this->items[$key] = $this->getSlugFromName($to);

        return true;
    }
622991
public function skip($from, $to)
    {
        $current = common_ext_ExtensionsManager::singleton()->getInstalledVersion($this->getExtension()->getId());
        if (version_compare($from, $current, '<=') && version_compare($current, $to, '<')) {
            $this->setVersion($to);
        }
    }
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);

    }
106002
public function replaceUser(User $from, User $to)
    {
        $dashboards = $this->getRepository()->findByCreator($from);

        if (count($dashboards) > 0) {
            foreach ($dashboards as $dashboard) {
                $dashboard->setCreator($to);
            }

            $this->em->flush();
        }

        return count($dashboards);
    }
487228
public function replaceCategoryManager(User $from, User $to)
    {
        $categories = $this->categoryRepo->findAllCategoriesByManager($from);

        if (count($categories) > 0) {
            foreach ($categories as $category) {
                $category->removeManager($from);
                $category->addManager($to);
            }

            $this->om->flush();
        }

        return count($categories);
    }
109707
public function replaceDropUser(User $from, User $to)
    {
        $drops = $this->dropRepo->findByUser($from);

        if (count($drops) > 0) {
            foreach ($drops as $drop) {
                $drop->setUser($to);
            }

            $this->om->flush();
        }

        return count($drops);
    }
292167
public function replaceUser(User $from, User $to)
    {
        $drops = $this->em->getRepository('IcapDropzoneBundle:Drop')->findByUser($from);

        if (count($drops) > 0) {
            foreach ($drops as $drop) {
                $drop->setUser($to);
            }

            $this->em->flush();
        }

        return count($drops);
    }
222416
public function betweenStrict($from, $to)
    {
        if (!is_int($from) && !is_float($from)) {
            throw new InvalidIntOrFloatException('from', $from);
        } elseif (!is_int($to) && !is_float($to)) {
            throw new InvalidIntOrFloatException('to', $to);
        } elseif ($from > $to) {
            throw new NumberNotLessStrictlyException('from', $from, $to);
        }

        if (!is_int($this->value) && !is_float($this->value)) {
            throw new InvalidIntOrFloatException($this->name, $this->value);
        } elseif ($this->value <= $from || $this->value >= $to) {
            throw new NumberNotBetweenStrictlyException($this->name, $this->value, $from, $to);
        }

        return $this;
    }
953509
public function replaceMemberAuthor(User $from, User $to)
    {
        $fromIsMember = false;
        $froms = $this->memberRepo->findByUser($from);
        if (count($froms) > 0) {
            $fromIsMember = true;
        }

        $toIsMember = false;
        $tos = $this->memberRepo->findByUser($to);
        if (count($tos) > 0) {
            $toIsMember = true;
        }

        if ($toIsMember && $fromIsMember) {
            //user kept already have its member entry, delete the old one
            foreach ($froms as $member) {
                $this->objectManager->remove($member);
            }
            $this->objectManager->flush();
        } elseif (!$toIsMember && $fromIsMember) {
            //update entry for kept user
            foreach ($froms as $member) {
                $member->setUser($to);
            }
            $this->objectManager->flush();
        }
    }
1143789
public function replaceEntryUser(User $from, User $to)
    {
        $entries = $this->entryRepo->findByUser($from);

        if (count($entries) > 0) {
            foreach ($entries as $entry) {
                $entry->setUser($to);
            }

            $this->om->flush();
        }

        return count($entries);
    }
140488
public function byRevision(string $from, string $to = ''): Log
    {
        $this->since = ' ' . escapeshellarg($from) . '..'
                     . (empty($to) ? '' : escapeshellarg($to));
        return $this;
    }
488609
public function renameMailbox($from = '', $to = '')
    {
        if (empty($from) || empty($to)) {
            return false;
        }

        $from = imap_utf7_encode($from);
        $to = imap_utf7_encode($to);

        return imap_renamemailbox($this->conn, "{".$this->settings['server']."}INBOX.".$from,
            "{".$this->settings['server']."}INBOX.".$to);
    }