Lines Matching refs:dir

893         foreach ($path as $dir) {
894 if (!strlen($dir)) {
897 switch ($dir) {
904 $new[] = $dir;
914 * @param string $dir
918 public function chdir($dir)
924 // assume current dir if $dir is empty
925 if ($dir === '') {
926 $dir = './';
928 } elseif ($dir[strlen($dir) - 1] != '/') {
929 $dir .= '/';
932 $dir = $this->realpath($dir);
934 // confirm that $dir is, in fact, a valid directory
935 if ($this->use_stat_cache && is_array($this->query_stat_cache($dir))) {
936 $this->pwd = $dir;
940 // we could do a stat on the alleged $dir to see if it's a directory but that doesn't tell us
945 $this->send_sftp_packet(NET_SFTP_OPENDIR, Strings::packSSH2('s', $dir));
965 $this->update_stat_cache($dir, []);
967 $this->pwd = $dir;
974 * @param string $dir
978 public function nlist($dir = '.', $recursive = false)
980 return $this->nlist_helper($dir, $recursive, '');
986 * @param string $dir
991 private function nlist_helper($dir, $recursive, $relativeDir)
993 $files = $this->readlist($dir, false);
1011 if (is_array($this->query_stat_cache($this->realpath($dir . '/' . $value)))) {
1012 $temp = $this->nlist_helper($dir . '/' . $value, true, $relativeDir . $value . '/');
1026 * @param string $dir
1030 public function rawlist($dir = '.', $recursive = false)
1032 $files = $this->readlist($dir, true);
1054 $is_directory = is_array($this->query_stat_cache($this->realpath($dir . '/' . $key)));
1056 $stat = $this->lstat($dir . '/' . $key);
1063 $files[$key] = $this->rawlist($dir . '/' . $key, true);
1076 * @param string $dir
1081 private function readlist($dir, $raw = true)
1087 $dir = $this->realpath($dir . '/');
1088 if ($dir === false) {
1093 $this->send_sftp_packet(NET_SFTP_OPENDIR, Strings::packSSH2('s', $dir));
1113 $this->update_stat_cache($dir, []);
1143 $this->update_stat_cache($dir . '/' . $shortname, []);
1146 $temp = $this->realpath($dir . '/..') . '/.';
1148 $temp = $dir . '/' . $shortname;
1290 // preg_replace('#^/|/(?=/)|/$#', '', $dir) == str_replace('//', '/', trim($path, '/'))
1295 foreach ($dirs as $i => $dir) {
1302 if (!isset($temp[$dir])) {
1303 $temp[$dir] = [];
1306 if (is_object($temp[$dir]) && is_object($value)) {
1307 if (!isset($value->stat) && isset($temp[$dir]->stat)) {
1308 $value->stat = $temp[$dir]->stat;
1310 if (!isset($value->lstat) && isset($temp[$dir]->lstat)) {
1311 $value->lstat = $temp[$dir]->lstat;
1314 $temp[$dir] = $value;
1317 $temp = &$temp[$dir];
1333 foreach ($dirs as $i => $dir) {
1338 unset($temp[$dir]);
1341 if (!isset($temp[$dir])) {
1344 $temp = &$temp[$dir];
1361 foreach ($dirs as $dir) {
1365 if (!isset($temp[$dir])) {
1368 $temp = &$temp[$dir];
1954 * @param string $dir
1959 public function mkdir($dir, $mode = -1, $recursive = false)
1965 $dir = $this->realpath($dir);
1968 $dirs = explode('/', preg_replace('#/(?=/)|/$#', '', $dir));
1981 return $this->mkdir_helper($dir, $mode);
1987 * @param string $dir
1991 private function mkdir_helper($dir, $mode)
1994 $this->send_sftp_packet(NET_SFTP_MKDIR, Strings::packSSH2('s', $dir) . "\0\0\0\0");
2009 $this->chmod($mode, $dir);
2018 * @param string $dir
2022 public function rmdir($dir)
2028 $dir = $this->realpath($dir);
2029 if ($dir === false) {
2033 $this->send_sftp_packet(NET_SFTP_RMDIR, Strings::packSSH2('s', $dir));
2048 $this->remove_from_stat_cache($dir);
2052 //$this->update_stat_cache($dir, false);
2855 return !$recursive || $this->filetype($path) != 'dir' ?
2879 return 'dir';