当前位置: 首页>>代码示例>>PHP>>正文


PHP ftp_mdtm函数代码示例

本文整理汇总了PHP中ftp_mdtm函数的典型用法代码示例。如果您正苦于以下问题:PHP ftp_mdtm函数的具体用法?PHP ftp_mdtm怎么用?PHP ftp_mdtm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ftp_mdtm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getFileInfo

 function _getFileInfo($path)
 {
     //$curdir = ftp_pwd($this->_link);
     //$isDir = @ftp_chdir($this->_link, $path);
     //ftp_chdir($this->_link, $curdir);
     $size = ftp_size($this->_link, $path);
     return array(name => basename($path), modified => ftp_mdtm($this->_link, $path), size => $size, type => $size == -1 ? "text/directory" : "text/plain");
 }
开发者ID:Rudi9719,项目名称:lucid,代码行数:8,代码来源:Ftp.php

示例2: testFileModified

 public function testFileModified()
 {
     $modifiedFilePath = $this->workspace . '/modified_source_file';
     $path = tempnam(sys_get_temp_dir(), 'ftp');
     ftp_put($this->connection, $modifiedFilePath, $path, $this->mode);
     $this->assertEquals(ftp_mdtm($this->connection, $modifiedFilePath), $this->adapter->mtime($modifiedFilePath));
     $this->setExpectedException('\\Pagekit\\Component\\File\\Exception\\IOException');
     $this->adapter->mtime($this->workspace . '/unknown_file');
 }
开发者ID:jacobjjc,项目名称:PageKit-framework,代码行数:9,代码来源:FtpAdapterTest.php

示例3: is_file

 function is_file($file)
 {
     $buff = @ftp_mdtm($this->_conn, $file);
     if ($buff != -1) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:singhvicky,项目名称:pintrest,代码行数:9,代码来源:FtpUpload.php

示例4: getLastModifiedTD

 public function getLastModifiedTD($fileName)
 {
     $raw = ftp_mdtm($this->connectionId, $fileName);
     if ($raw != -1) {
         echo "{$fileName} was last modified on : " . date("F d Y  H:i:s.", $raw);
     } else {
         echo "Couldn't get mdtime";
     }
 }
开发者ID:stjohnsenekal,项目名称:EAV-Example-with-FTP-Pricefile,代码行数:9,代码来源:ftp.php

示例5: getFilesInfo

 public function getFilesInfo($conn_id, $ftp_dir, $ftp, &$model, &$count)
 {
     $attribute = Attribute::model()->findByAttributes(array('structured_comment_name' => 'num_files'));
     ftp_pasv($conn_id, true);
     $buff = ftp_rawlist($conn_id, $ftp_dir);
     if (!$buff) {
         return false;
     }
     $file_count = count($buff);
     $date = new DateTime("2050-01-01");
     $date = $date->format("Y-m-d");
     foreach ($buff as $key => $value) {
         $info = preg_split("/\\s+/", $value);
         $name = $info[8];
         $new_dir = $ftp_dir . "/" . $name;
         if ($this->is_dir($conn_id, $new_dir)) {
             $new_ftp = $ftp . "/" . $name;
             if (!$this->getFilesInfo($conn_id, $new_dir, $new_ftp, $model, $count)) {
                 return false;
             }
         } else {
             $count++;
             //var_dump($info);
             $size = $info[4];
             $stamp = date("F d Y", ftp_mdtm($conn_id, $name));
             // var_dump($name);
             $file = new File();
             $file->dataset_id = $model->dataset_id;
             $file->name = $name;
             $file->size = $size;
             $file->location = $ftp . "/" . $name;
             $file->code = "None";
             $file->date_stamp = $date;
             $extension = "";
             $format = "";
             $this->getFileExtension($file->name, $extension, $format);
             $file->extension = $extension;
             $fileformat = FileFormat::model()->findByAttributes(array('name' => $format));
             if ($fileformat != null) {
                 $file->format_id = $fileformat->id;
             }
             $file->type_id = 1;
             $file->date_stamp = $stamp;
             if (!$file->save()) {
                 $model->addError('error', "Files are not saved correctly");
                 return false;
                 //how to
                 //                    var_dump($file->name);
             } else {
                 $this->setAutoFileAttributes($file);
             }
         }
     }
     return true;
 }
开发者ID:jessesiu,项目名称:GigaDBV3,代码行数:55,代码来源:AdminFileController.php

示例6: writeTempFile

 /**
  * Write temp file to remote system and count difference
  * @param string $localPath Path to local file
  * @return int Time difference between systems
  */
 private function writeTempFile($localPath)
 {
     // Remote file name
     $tsFileName = basename($localPath);
     // Copy file to remote
     if ($this->write($localPath)) {
         // Get difference
         $diff = abs(filemtime($localPath) - ftp_mdtm($this->handle, $tsFileName));
         $this->log('Time difference between servers is [##]', $diff);
         ftp_delete($this->handle, $tsFileName);
         // Convert to hours
         return (int) ($diff > 3600 ? floor($diff / 3600) * 3600 + $diff % 3600 : 0);
     }
     return 0;
 }
开发者ID:samsonphp,项目名称:deploy,代码行数:20,代码来源:Remote.php

示例7: addFile

 public function addFile($destination_filename, $source_filename)
 {
     /*
      * !!!!!
      * Do not use realpath() - this is not a local path! 
      * 
      */
     if ($this->getOnlyIfModified()) {
         if (filemtime($source_filename) > ftp_mdtm($this->_ftp_conn_id, $destination_filename)) {
             $index = $this->_remote_base_dir . $destination_filename;
             $this->_files[$index] = $source_filename;
         }
     } else {
         $index = $this->_remote_base_dir . $destination_filename;
         $this->_files[$index] = $source_filename;
     }
 }
开发者ID:rafal2208,项目名称:blues,代码行数:17,代码来源:FtpUpdater.class.php

示例8: downloadAll

 public function downloadAll()
 {
     $Dirs = ftp_nlist($this->ftpconnection, '/sales');
     $downloadCheck = false;
     $downloadArray = array();
     foreach ($Dirs as $Dir) {
         $files = ftp_nlist($this->ftpconnection, $Dir);
         foreach ($files as $file) {
             $time = ftp_mdtm($this->ftpconnection, $file);
             if ($time !== -1) {
                 if (ftp_get($this->ftpconnection, $this->downloadPath . basename($file, ".csv") . "-" . basename($Dir) . ".csv", $file, FTP_ASCII)) {
                     $downloadCheck = true;
                     $downloadArray[] = $this->downloadPath . basename($file, ".csv") . "-" . basename($Dir) . ".csv";
                 }
             }
         }
     }
     if ($downloadCheck !== true) {
         return false;
     } else {
         return $downloadArray;
     }
 }
开发者ID:LeT0ti,项目名称:BasicFTPDownloader,代码行数:23,代码来源:FtpDownloader.php

示例9: modified

 /**
  * Return the last modified time of a given file
  *
  * @param $filename
  * @return bool
  */
 private function modified($filename)
 {
     if ($this->isSFTP()) {
         $info = @$this->ftp->lstat($filename);
         if ($info) {
             return $info['mtime'];
         }
     } else {
         if ($time = @ftp_mdtm($this->ftp, $filename)) {
             return $time;
         }
     }
     $this->fail("couldn't get the file size for {$filename}");
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:20,代码来源:FTP.php

示例10: mtime

 /**
  * {@inheritdoc}
  */
 public function mtime($key)
 {
     $this->ensureDirectoryExists($this->directory, $this->create);
     $mtime = ftp_mdtm($this->getConnection(), $this->computePath($key));
     // the server does not support this function
     if (-1 === $mtime) {
         throw new \RuntimeException('Server does not support ftp_mdtm function.');
     }
     return $mtime;
 }
开发者ID:knplabs,项目名称:gaufrette,代码行数:13,代码来源:Ftp.php

示例11: _modified

 /**
  * Return the last modified time of a given file
  *
  * @param $filename
  * @return bool
  */
 private function _modified($filename)
 {
     switch (strtolower($this->config['type'])) {
         case 'sftp':
             if ($info = @$this->ftp->lstat($filename)) {
                 return $info['mtime'];
             }
             break;
         default:
             if ($time = @ftp_mdtm($this->ftp, $filename)) {
                 return $time;
             }
     }
     \PHPUnit_Framework_Assert::fail("couldn't get the file size for {$filename}");
 }
开发者ID:samuelmoncarey,项目名称:codeception,代码行数:21,代码来源:FTP.php

示例12: lastModified

 /**
  * Return the last modified file time as an UNIX timestamp
  *
  * @param      string  $path   The path to the directory / file
  *
  * @return     int     The last modified time as an UNIX timestamp
  */
 public function lastModified(string $path) : int
 {
     return ftp_mdtm($this->resource, $path);
 }
开发者ID:ZiperRom1,项目名称:awesomeChatRoom,代码行数:11,代码来源:ftpFileManager.php

示例13: mdtm

 /**
  *
  * 返回指定文件的最后修改时间
  *
  * @param string $remote_file
  */
 public static function mdtm($remote_file)
 {
     return ftp_mdtm(self::$resource, $remote_file);
 }
开发者ID:luozhanhong,项目名称:share,代码行数:10,代码来源:ftp.php

示例14: upload

 /**
  * Uploads files to FTP
  *
  * @param array $files
  * @param array $results
  * @param boolean $force_rewrite
  * @return boolean
  */
 function upload($files, &$results, $force_rewrite = false)
 {
     $error = null;
     if (!$this->_connect($error)) {
         $results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, $error);
         return false;
     }
     $this->_set_error_handler();
     $home = @ftp_pwd($this->_ftp);
     if ($home === false) {
         $results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, sprintf('Unable to get current directory (%s).', $this->_get_last_error()));
         $this->_restore_error_handler();
         $this->_disconnect();
         return false;
     }
     foreach ($files as $file) {
         $local_path = $file['local_path'];
         $remote_path = $file['remote_path'];
         if (!file_exists($local_path)) {
             $results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, 'Source file not found.');
             continue;
         }
         @ftp_chdir($this->_ftp, $home);
         $remote_dir = dirname($remote_path);
         $remote_dirs = preg_split('~\\/+~', $remote_dir);
         foreach ($remote_dirs as $dir) {
             if (!@ftp_chdir($this->_ftp, $dir)) {
                 if (!@ftp_mkdir($this->_ftp, $dir)) {
                     $results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, sprintf('Unable to create directory (%s).', $this->_get_last_error()));
                     continue 2;
                 }
                 if (!@ftp_chdir($this->_ftp, $dir)) {
                     $results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, sprintf('Unable to change directory (%s).', $this->_get_last_error()));
                     continue 2;
                 }
             }
         }
         // basename cannot be used, kills chinese chars and similar characters
         $remote_file = substr($remote_path, strrpos($remote_path, '/') + 1);
         $mtime = @filemtime($local_path);
         if (!$force_rewrite) {
             $size = @filesize($local_path);
             $ftp_size = @ftp_size($this->_ftp, $remote_file);
             $ftp_mtime = @ftp_mdtm($this->_ftp, $remote_file);
             if ($size === $ftp_size && $mtime === $ftp_mtime) {
                 $results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_OK, 'File up-to-date.');
                 continue;
             }
         }
         $result = @ftp_put($this->_ftp, $remote_file, $local_path, FTP_BINARY);
         if ($result) {
             $this->_mdtm($remote_file, $mtime);
             $results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_OK, 'OK');
         } else {
             $results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, sprintf('Unable to upload file (%s).', $this->_get_last_error()));
         }
     }
     $this->_restore_error_handler();
     $this->_disconnect();
     return !$this->_is_error($results);
 }
开发者ID:trendyta,项目名称:bestilblomster,代码行数:69,代码来源:Ftp.php

示例15: getFileModificationTime

 /**
  * @inheritdoc
  */
 public function getFileModificationTime($filepath)
 {
     $fileMdtm = ftp_mdtm($this->getFtp(), $filepath);
     if ($fileMdtm == -1) {
         throw new \Exception(sprintf("Error when trying to get file modification time"));
     }
     return $fileMdtm;
 }
开发者ID:acassan,项目名称:remoteserver,代码行数:11,代码来源:Ftp.php


注:本文中的ftp_mdtm函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。