Synchronize the filesystem into the db in this folder.

@param int $dirId

@return RedirectResponse
767924
public function sync($dirId)
    {
        $dir = $this->getDirOrFail($dirId);
        $this->fileDB->syncWithFs($dir, 1);
        return $this->redirectTo('index', [$dir->getId()]);
    }
1373457
public function setDir($dir = null){
        $this->databaseDir = (is_null($dir)) ? realpath(__DIR__).DIRECTORY_SEPARATOR.'database'.DIRECTORY_SEPARATOR : $dir;
        return $this;
    }
635484
public function setDirectory($directory)
	{
		$this->directory = $directory;

		// Set the finder to use this directory as well
		$this->finder->in($directory);

		return $this;
	}
104155
public function get_file_by_id($fileid) {
        global $DB;

        $sql = "SELECT ".self::instance_sql_fields('f', 'r')."
                  FROM {files} f
             LEFT JOIN {files_reference} r
                       ON f.referencefileid = r.id
                 WHERE f.id = ?";
        if ($filerecord = $DB->get_record_sql($sql, array($fileid))) {
            return $this->get_file_instance($filerecord);
        } else {
            return false;
        }
    }
49027
public function syncFiles($contentId)
    {
        $block = $this->repository->getById($contentId);
        if (empty($block)) {
            return $this->respondNotFound();
        }
        $this->authorize('update', $block);
        $input = $this->validator->validate('syncFiles');
        $block = $this->fileRepository->syncWith($block, $this->buildSyncData($input));
        return $this->respondWithSuccess($block);
    }
926429
public function syncDb() {
    $local_alias = '@' . $this->getConfigValue('drush.aliases.local');
    $remote_alias = '@' . $this->getConfigValue('drush.aliases.remote');

    $task = $this->taskDrush()
      ->alias('')
      ->drush('cache-clear drush')
      ->drush('sql-sync')
      ->arg($remote_alias)
      ->arg($local_alias)
      ->option('--target-dump', sys_get_temp_dir() . '/tmp.target.sql.gz')
      ->option('structure-tables-key', 'lightweight')
      ->option('create-db');

    if ($this->getConfigValue('drush.sanitize')) {
      $task->drush('sql-sanitize');
    }

    $task->drush('cr');
    $task->drush('sqlq "TRUNCATE cache_entity"');

    $result = $task->run();

    return $result;
  }
1056870
public function setDir($dir) {
        if (false === in_array($dir, DataTablesEnumerator::enumDirs())) {
            $dir = self::DATATABLES_DIR_ASC;
        }
        $this->dir = strtoupper($dir);
        return $this;
    }
826931
public function mkdir($directory) {
        if (false === @ftp_mkdir($this->getConnection(), $directory)) {
            throw $this->newFTPException(sprintf("mkdir %s failed", $directory));
        }
        return $this;
    }
468648
public function move($directory, $name = null)
    {
        $this->dir($directory);

        $this->name($name);

        return $this;
    }
422855
public function getDirectory(string $id): Directory
    {
        if (isset($this->directories[$id])) {
            return $this->directories[$id];
        }

        if ($this->hasDirectory($id)) {
            return $this->directories[$id] = new static($this->filesystem, $this->getDirectoryPath($id), $this->format);
        }

        throw new RuntimeException(sprintf('Directory "%s" not found', $id));
    }
361039
public function downloadFile($id): FileResponse
	{
		if (is_array($id)) {
			$file = new TempFile;
			$name = 'Logs_' . Date::getCurrentTimeStamp() . '.zip';
			$archive = [];
			foreach ($id as $i) {
				$log = $this->getLog($i);
				if ($log) {
					$archive[] = $this->path . $log->name;
				}
			}
			File::zip($archive, (string) $file);
			return new FileResponse($file, $name);
		} else {
			$file = $this->getLog((string) $id)->name;
			return new FileResponse($this->path . $file, $file);
		}
	}
27305
public function makeDir($name, $parentID = 0)
    {
        $data = [
            'name'      => $name,
            'parent_id' => $parentID
        ];

        return $this->post('files/create-folder', $data, \false, 'file');
    }
355259
public function mkdir($dir) {
		$this->connectIfNeeded();
		$this->handle->mkdir($dir);
		$this->onFolderCreated(new Event(['sender' => $this, 'data' => $dir]));
	}
113585
public function files($directory)
    {
        return collect([])
            ->merge($this->filesystem->files($directory))
            ->map(function ($file) {
                return new File($file, $this);
            });
    }
449125
public function lock($pid = null) {
        if ($this->isLocked($this->pidFile)) {
            return false;
        }

        $myPid = $pid ?? getmypid();
        $pidDir = dirname($this->pidFile);
        if (!is_dir($pidDir)) {
            @mkdir($pidDir, 0744, true);
        }
        file_put_contents($this->pidFile, $myPid);
        return true;
    }
41566
public function uploadDir($dir)
	{
		$this->uploadDir = $dir;
		if(! $this->hasTrailingSlash())
		{
			$this->uploadDir .= "/";
		}

		return $this;
	}
233900
public function findByFolderId($folderId)
    {
        $qb = $this->createQueryBuilder();

        $qb->field('mediaFolder.id')->equals($folderId);

        return $qb->getQuery()->execute();
    }