Rename a mailbox (folder)

@param string $from
@param string $to

@return bool
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);
    }
605997
public function copyFolder( $from, $to )
	{
		$this->connection->checkConnection();
		$this->createFolder( $to );
		$reader	= new Net_FTP_Reader( $this->connection );
		$list	= $reader->getList( $from, TRUE );
		foreach( $list as $entry )
		{
			if( $entry['isdir'] )
				$this->createFolder( $to."/".$entry['name'] );
			else
				$this->copyFile( $from."/".$entry['name'], $to."/".$entry['name'] );
		}
		return TRUE;
	}
358569
public function renameFolder($old_name, $new_name, $expunge = true) {
        $this->checkConnection();
        $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
        if($expunge) $this->expunge();

        return $status;
    }
1191656
public function aliasNamespace($from, $to)
	{
		$from = trim($from, '\\');
		$to = trim($to, '\\');

		$this->namespaces[] = [$from, $to];
	}
765510
protected function deleteRelationData($from, $to)
    {
        $config  = Config::table($from);
        $content = $config->get();
        unset($content->relations->{$to});
        $config->put($content);
    }
1144101
public function replaceUser(User $from, User $to)
    {
        $items = $this->repository->findBy(['creator' => $from]);

        if (count($items) > 0) {
            foreach ($items as $item) {
                $item->setCreator($to);
            }

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

        return count($items);
    }
496466
public function replaceMessageUser(User $from, User $to)
    {
        $messages = $this->messageRepo->findByCreator($from);
        if (count($messages) > 0) {
            foreach ($messages as $message) {
                $message->setCreator($to);
                $message->setAuthor($to->getFirstName().' '.$to->getLastName());
            }
            $this->om->flush();
        }

        return count($messages);
    }
167468
private function copyFromTo($from, $to)
    {
        $directory = dirname($to);
        if (!is_dir($directory)) {
            mkdir($directory, 0777, true);
        }

        copy($from, $to);
    }
942658
public static function copyDirRecursively($from, $to)
    {
        if (! $path = self::getFilesFromDir($from)) {
            return false;
        }

        self::createDir($to = rtrim($to, '/') . '/');

        foreach ($path as $file) {
            if ($file->isFile()) {
                if (! copy($file->getRealPath(), $to . $file->getFilename())) {
                    return false;
                }
            } elseif (! $file->isDot() && $file->isDir()) {
                self::copyDirRecursively($file->getRealPath(), $to . $path);
            }
        }

        return true;
    }
177926
public function rename($from, $to) {
		return $this->getState()->rename($this->buildUrl($from), $this->buildUrl($to));
	}
1248235
public function rename($from, $to): bool
    {
        $key = $this->search($from);

        if (\is_null($key)) {
            return false;
        }

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

        return true;
    }
562459
public function replaceUser(User $from, User $to)
    {
        $portfolioUsers = $this->repo->findByUser($from);

        if (count($portfolioUsers) > 0) {
            foreach ($portfolioUsers as $portfolioUser) {
                $portfolioUser->setUser($to);
            }

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

        return count($portfolioUsers);
    }
969399
protected function moveUploadedFile($from, $to)
    {
        return $this->unitTest ? copy($from, $to) : @move_uploaded_file($from, $to);
    }
847645
protected function renameCacheEntries($to) {

		if(($cachePath = $this->folder->getCachePath(TRUE))) {

			$di	= new \DirectoryIterator($cachePath);

			foreach($di as $fileinfo) {

				$filename = $fileinfo->getFilename();

				if(	$fileinfo->isDot() ||
					!$fileinfo->isFile() ||
					strpos($filename, $this->filename) !== 0
				) {
					continue;
				}

				$renamed = substr_replace($filename, $to, 0, strlen($this->filename));
				rename($fileinfo->getRealPath(), $fileinfo->getPath() . DIRECTORY_SEPARATOR . $renamed);
			}
		}
	}
787410
public function migrateExpiredJobs($from, $to)
    {
        return $this->getConnection()->eval(
            LuaScripts::migrateExpiredJobs(), 3, $from, $to, $to.':notify', $this->currentTime()
        );
    }
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();
        }
    }
581690
public static function rename($from, $to)
    {
        $object = get_class(self::$driver);

        return $object::rename($from, $to);
    }