コード例 #1
0
ファイル: FileMessage.class.php プロジェクト: Superbeest/Core
 /**
  * Creates a new Message object with a file.
  * @param \System\IO\File The file to send in the message
  * @param string The target filename. This is a fullpath
  * @param string The host. This can be local or remote, or an IPv4
  * @param int The port to use
  * @param string The username to connect to the local SSH server
  * @param string The password to connect to the local SSH server
  */
 public function __construct_6(\System\IO\File $file, $targetFilename, $host, $port, $username, $password)
 {
     $this->setType(\System\System\Interaction\MessageType::TYPE_SYSTEM);
     $this->setMessage('file');
     $contents = @base64_encode($file->getContents());
     $this->setParams(array('file' => $contents, 'atime' => $file->getLastAccessTime(), 'mtime' => $file->getModifiedTime(), 'host' => $host, 'port' => $port, 'username' => $username, 'password' => $password, 'target' => $targetFilename));
 }
コード例 #2
0
 /**
  * Transfer the file to its new location by copying it.
  * @param \System\IO\File The sourcefile.
  * @return bool True on success, false otherwise
  */
 public final function transferFile(\System\IO\File $file)
 {
     $target = \System\IO\Directory::getPath($this->targetFolder . $file->getFilename());
     return \System\IO\File::writeContents($target, $file->getContents()) instanceof \System\IO\File;
 }