Update composer.
@param  string $dir
@return boolean
482982
protected function updateComposer($dir) {
		if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
			$cmd = '"vendor/bin/composer.bat" update --working-dir "'.$dir.'"';
		else
			$cmd = './vendor/bin/composer update --working-dir "'.$dir.'"';
		return $this->runCommand($cmd);
	}
465996
public function built($dir)
    {
        $file = $dir . '/index.php';
        if ($this->fs->exists($file)) {
            $f = fopen($file, 'r');
            $beginning = fread($f, 3178);
            fclose($f);
            if (strpos($beginning, 'Drupal') !== false) {
                return true;
            }
        }
        return false;
    }
617331
public function setUploadDir($dir)
    {
        // Check to see if the upload directory exists.
        if (!file_exists($dir) || !is_dir($dir)) {
            $this->error = self::UPLOAD_ERR_DIR_NOT_EXIST;
        // Check to see if the permissions are set correctly.
        } else if (!is_writable($dir)) {
            $this->error = self::UPLOAD_ERR_DIR_NOT_WRITABLE;
        }

        $this->uploadDir = $dir;
        return $this;
    }
1185896
protected function _clearDir($dir) {

        $dirPath = $this->Dir->pwd() . $dir;

        if ( ! $this->isExistFolder($dir) ) {
            $this->err("Error : directory {$dir} not exist");
            return false;
        }

        if ( ! $this->Dir->delete($dirPath) ) {
            $this->err("Error : delete directory {$dir} failed");
            $this->verbose($this->Dir->errors());
            return false;
        }

        if ( ! $this->Dir->create($dirPath, 0777) ) {
            $this->err("Error : recreate directory {$dir} failed");
            $this->verbose($this->Dir->errors());
            return false;
        }

        return true;
    }
1328639
public static function create(string $dir = ''): bool
    {
        $ret = true;
        $dir = static::normalizePath($dir);
        if (static::verifyPath($dir) && !\file_exists($dir)) {
            $components = \explode(DIRECTORY_SEPARATOR, $dir);
            $newDirectory = '';

            foreach ($components as $component) {
                $newDirectory .= $component.DIRECTORY_SEPARATOR;
                if (static::verifyPath($dir) && !\file_exists($newDirectory)) {
                    @\mkdir($newDirectory, static::$newDirectoryMode);
                    @\chmod($newDirectory, static::$newDirectoryMode);
                }
            }
            return \file_exists($dir) ? true : false;
        }
        return $ret;
    }
51708
public function version($dir) {
        if ($this->source($dir)) {
            // Check if unbuilt Drupal
            foreach ($this->getMakefiles($dir) as $file) {
                $f = fopen($file, 'r');
                $peek = fread($f, 1000);
                fclose($f);
                foreach (explode(PHP_EOL, $peek) as $line) {
                    preg_match("/core\s*(:|=)\s*\"?(\d.\w?)\"?$/", $line, $output_array);
                    if (!empty($output_array)) {
                        return ($output_array[2] == self::DRUPAL7) ? self::DRUPAL7 : self::DRUPAL8;
                    }
                }
            }
        } elseif ($this->built($dir)) {
            return (file_exists($dir . '/core/composer.json')) ? self::DRUPAL8 : self::DRUPAL7;
        }
        return null;
    }
421
private function ensureExists($dir)
    {
        if (!is_dir($dir)) {
            mkdir($dir, 0755, true);
        }

        return $this->validatePath($dir);
    }
159912
public function ls($dir = '')
    {
        $this->isAlive(true);
        $this->errorHandler->start();
        $dir = ($dir == '' ? ftp_pwd($this->resource) : $dir);
        if (($ls = $this->driver->nlist($this->resource, $dir)) !== false) {
            $this->errorHandler->stop();

            return $ls;
        }
        $this->errorHandler->stop();

        return false;
    }
606995
public function updateComposerVendors()
    {
        chdir(DIR_BASE);

        exec('COMPOSER_HOME="' . substr(DIR_BASE, 0, -1) . '" composer -v update 2>&1', $out);
        if ($out) {
            $this->result_message[] = $out;
        }

        // Clear all caches - may be required to show fresh data
        Cacher::getInstance()->clearAllCaches();

        return $this;
    }
1214085
public function cd($dir = '')
    {
        if ($dir == '' || substr($dir, 0, 1) !== '/') {
            $dir = $this->dir . '/' . $dir;
        }

        $this->errorHandler->start();
        if (($dir = $this->driver->realpath($this->resource, $dir)) !== false) {
            $this->dir = $dir;
            $this->errorHandler->stop();

            return true;
        }

        $this->errorHandler->stop();

        return false;
    }
701174
public function cd($dir = null)
    {
        $dir = $this->_getAbsoluteRemotePath($dir);
        if (false === is_dir($dir)) {
            return $this->_trigger_error(sprintf('Unable to change remote directory to %s.', $dir));
        }
        $this->_remotepath = $dir;

        return true;
    }
355203
public function rmdirr($dir)
    {
        if ($handle = opendir("$dir")) {
            while ($item = readdir($handle)) {
                if (($item != ".") && ($item != "..")) {
                    if (is_dir("$dir/$item")) {
                        $this->rmdirr("$dir/$item");
                    } else {
                        unlink("$dir/$item");
                    }
                }
            }
            closedir($handle);
            rmdir($dir);
        }
    }
1072661
public function addToPackages($dir)
    {
        $files = glob($dir.'/*');

        $packageViews = Config::get('cms.package-menus');

        if (is_null($packageViews)) {
            $packageViews = [];
        }

        foreach ($files as $view) {
            array_push($packageViews, $view);
        }

        return Config::set('cms.package-menus', $packageViews);
    }
706068
protected function syncAssetsDirectory($dir)
    {
        $source = $this->boltPath . '/app/view/' . $dir;
        $target = $this->boltAssetsPath . '/' . $dir;

        // Mirror source and destination, overwrite existing file and clean up removed files
        $this->filesystem->mirror($source, $target, null, ['override' => true, 'delete' => true]);
    }
986180
public function rmdirRecursive($dir) {
		if (is_dir($dir)) {
			foreach (array_diff(scandir($dir), array('.', '..')) as $file) {
				@set_time_limit(30);
				$path = $dir . '/' . $file;
				(is_dir($path)) ? $this->rmdirRecursive($path) : @unlink($path);
			}
			return @rmdir($dir);
		} else if (is_file($dir)) {
			return @unlink($dir);
		}
		return false;
	}
407234
public function rm($dir)
    {
        $parseDir = $this->parseLastDirectory($dir);
        if (! ssh2_sftp_rmdir($this->getSFtp(), $parseDir)) {
            throw new DirectoryException('Directory not deleted');
        }
        return true;
    }
1125075
final public static function isDirEmpty($dir)
    {
        if (!is_readable($dir)) {
            return (null);
        }
        $handle = opendir($dir);
        while (false !== ($entry = readdir($handle))) {
            if ($entry != "." && $entry != "..") {
                return (false);
            }
        }
        return (true);
    }