r68952 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68951‎ | r68952 | r68953 >
Date:16:47, 3 July 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Work on porting WP filesystem abstraction classes
Modified paths:
  • /trunk/extensions/Deployment/Deployment.i18n.php (modified) (history)
  • /trunk/extensions/Deployment/includes/filesystems/FtpFilesystem.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Deployment/Deployment.i18n.php
@@ -27,4 +27,5 @@
2828 'deploy-ftp-username-required' => 'FTP username is required',
2929 'deploy-ftp-password-required' => 'FTP password is required',
3030 'deploy-ftp-hostname-required' => 'FTP hostname is required',
 31+ 'deploy-ftp-connect-failed' => 'Failed to connect to FTP server $1:$2'
3132 );
Index: trunk/extensions/Deployment/includes/filesystems/FtpFilesystem.php
@@ -76,8 +76,9 @@
7777 * @see Filesystem::connect
7878 */
7979 public function connect() {
 80+ // Attempt to create a connection, either with ssl or without.
8081 if ( $this->options['ssl'] && function_exists( 'ftp_ssl_connect' ) ) {
81 - // TODO
 82+ $this->connection = @ftp_ssl_connect( $this->options['hostname'], $this->options['port'], $this->options['timeout'] );
8283 }
8384 else {
8485 // If this is true, ftp_ssl_connect was not defined, so add an error.
@@ -85,11 +86,23 @@
8687 $this->addError( 'deploy-ftp-ssl-not-loaded' );
8788 }
8889
89 - // TODO
 90+ $this->connection = @ftp_connect( $this->options['hostname'], $this->options['port'], $this->options['timeout'] );
9091 }
9192
92 - // TODO
 93+ // Check if a connection has been established.
 94+ if ( !$this->connection ) {
 95+ $this->addErrorMessage( wfMsgExt( 'deploy-ftp-connect-failed', $this->options['hostname'], $this->options['port'] ) );
 96+ return false;
 97+ }
9398
 99+ // Attempt to set the connection to use passive FTP.
 100+ @ftp_pasv( $this->connection, true );
 101+
 102+ // Make sure the timeout is at least as much as the option.
 103+ if ( @ftp_get_option( $this->connection, FTP_TIMEOUT_SEC ) < $this->options['timeout'] ) {
 104+ @ftp_set_option( $this->connection, FTP_TIMEOUT_SEC, $this->options['timeout'] );
 105+ }
 106+
94107 return true;
95108 }
96109

Status & tagging log