commit 7dc4e84abab736e93fb30d9611a0fdf57224cf1f
parent 72ddd239ea905b2b91b5a5cfd23ebef133364d3c
Author: Jan Dankert <devnull@localhost>
Date: Fri, 30 Nov 2018 17:43:00 +0100
Fehlerhandling umgestellt: Statt Returncodes Exceptions verwenden
Diffstat:
9 files changed, 251 insertions(+), 351 deletions(-)
diff --git a/modules/cms-core/action/FolderAction.class.php b/modules/cms-core/action/FolderAction.class.php
@@ -1396,10 +1396,7 @@ class FolderAction extends ObjectAction
foreach( $publish->publishedObjects as $o )
$list[] = $o['full_filename'];
- if ( !$publish->ok )
- $this->addNotice('folder',$this->folder->name,'PUBLISHED_ERROR',OR_NOTICE_ERROR,array(),$publish->log);
- else
- $this->addNotice('folder',$this->folder->name,'PUBLISHED',OR_NOTICE_OK,array(),$list);
+ $this->addNotice('folder',$this->folder->name,'PUBLISHED',OR_NOTICE_OK,array(),$list);
// Wenn gewuenscht, das Zielverzeichnis aufraeumen
if ( $this->hasRequestVar('clean') )
diff --git a/modules/cms-core/action/PageAction.class.php b/modules/cms-core/action/PageAction.class.php
@@ -784,8 +784,8 @@ class PageAction extends ObjectAction
$this->addNotice( 'page',
$this->page->fullFilename,
- 'PUBLISHED'.($this->page->publish->ok?'':'_ERROR'),
- $this->page->publish->ok,
+ 'PUBLISHED',
+ OR_NOTICE_OK,
array(),
$this->page->publish->log );
}
diff --git a/modules/cms-core/action/PageelementAction.class.php b/modules/cms-core/action/PageelementAction.class.php
@@ -1472,15 +1472,10 @@ class PageelementAction extends Action
$this->page->publish();
$this->page->publish->close();
-// foreach( $this->page->publish->publishedObjects as $o )
-// {
-// $this->addNotice($o['type'],$o['full_filename'],'PUBLISHED','ok');
-// }
-
$this->addNotice( 'page',
$this->page->fullFilename,
- 'PUBLISHED'.($this->page->publish->ok?'':'_ERROR'),
- $this->page->publish->ok,
+ 'PUBLISHED',
+ OR_NOTICE_OK,
array(),
$this->page->publish->log );
}
diff --git a/modules/cms-core/action/TemplateAction.class.php b/modules/cms-core/action/TemplateAction.class.php
@@ -609,8 +609,8 @@ class TemplateAction extends Action
$this->addNotice( 'page',
$page->fullFilename,
- 'PUBLISHED'.($page->publish->ok?'':'_ERROR'),
- $page->publish->ok,
+ 'PUBLISHED',
+ OR_NOTICE_OK,
array(),
$page->publish->log );
}
diff --git a/modules/cms-publish/Ftp.class.php b/modules/cms-publish/Ftp.class.php
@@ -0,0 +1,208 @@
+<?php
+// OpenRat Content Management System
+// Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+/**
+ * Darstellen einer FTP-Verbindung, das beinhaltet
+ * das Login, das Kopieren von Dateien sowie praktische
+ * FTP-Funktionen
+ *
+ * @author $Author$
+ * @version $Revision$
+ * @package openrat.services
+ */
+class Ftp
+{
+ var $verb;
+ var $url;
+ var $log = array();
+
+ var $passive = false;
+
+ var $ok = true;
+
+ private $path;
+
+
+ // Konstruktor
+ public function __construct( $url )
+ {
+ $this->connect( $url );
+ }
+
+
+ // Aufbauen der Verbindung
+ private function connect( $url )
+ {
+ $this->url = $url;
+
+ global $conf;
+
+ $conf_ftp = $conf['publish']['ftp'];
+ $ftp = parse_url( $this->url );
+
+ // Die projektspezifischen Werte gewinnen bei �berschneidungen mit den Default-Werten
+ $ftp = array_merge($conf_ftp,$ftp);
+
+ // Nur FTP und FTPS (seit PHP 4.3) erlaubt
+ if ( !in_array(@$ftp['scheme'],array('ftp','ftps')) )
+ {
+ throw new OpenRatException( 'ERROR_PUBLISH','Unknown scheme in FTP Url: '.@$ftp['scheme'].
+ '. Only FTP (and FTPS, if compiled in) are supported');
+ }
+
+ if ( function_exists('ftp_ssl_connect') && $ftp['scheme'] == 'ftps' )
+ $this->verb = @ftp_ssl_connect( $ftp['host'],$ftp['port'] );
+ else
+ $this->verb = @ftp_connect( $ftp['host'],$ftp['port'] );
+
+ if ( !$this->verb )
+ {
+ Logger::error('Cannot connect to '.$ftp['host'].':'.$ftp['port']);
+ throw new OpenRatException('ERROR_PUBLISH','Cannot connect to '.$ftp['scheme'].'-server: '.$ftp['host'].':'.$ftp['port']);
+ }
+
+ $this->log[] = 'Connected to FTP server '.$ftp['host'].':'.$ftp['port'];
+
+ if ( empty($ftp['user']) )
+ {
+ $ftp['user'] = 'anonymous';
+ $ftp['pass'] = 'openrat@openrat.de';
+ }
+
+ if ( ! ftp_login( $this->verb,$ftp['user'],$ftp['pass'] ) )
+ throw new OpenRatException('ERROR_PUBLISH','Unable to login as user '.$ftp['user']);
+
+ $this->log[] = 'Logged in as user '.$ftp['user'];
+
+ $pasv = (!empty($ftp['fragment']) && $ftp['fragment'] == 'passive' );
+
+ $this->log[] = 'entering passive mode '.($pasv?'on':'off');
+ if ( ! ftp_pasv($this->verb,true) )
+ throw new OpenRatException('ERROR_PUBLISH','Cannot switch to FTP PASV mode');
+
+ if ( !empty($ftp['query']) )
+ {
+ parse_str( $ftp['query'],$ftp_var );
+
+ if ( isset( $ftp_var['site'] ) )
+ {
+ $site_commands = explode( ',',$ftp_var['site'] );
+ foreach( $site_commands as $cmd )
+ {
+ if ( ! @ftp_site( $this->verb,$cmd ) )
+ throw new OpenRatException('ERROR_PUBLISH','unable to do SITE command: '.$cmd);
+ }
+ }
+ }
+
+ $this->path = rtrim( $ftp['path'],'/' );
+
+ $this->log[] = 'Changing directory to '.$this->path;
+
+ if ( ! @ftp_chdir( $this->verb,$this->path ) )
+ throw new OpenRatException('ERROR_PUBLISH','unable CHDIR to directory: '.$this->path);
+ }
+
+
+ /**
+ * Kopieren einer Datei vom lokalen System auf den FTP-Server.
+ *
+ * @param String Quelle
+ * @param String Ziel
+ * @param int FTP-Mode (BINARY oder ASCII)
+ */
+ public function put( $source,$dest )
+ {
+ $dest = $this->path.'/'.$dest;
+
+ $this->log .= "Copying file: $source -> $dest ...\n";
+
+ $mode = FTP_BINARY;
+ $p = strrpos( basename($dest),'.' ); // Letzten Punkt suchen
+
+ if ($p!==false) // Wennn letzten Punkt gefunden, dann dort aufteilen
+ {
+ $extension = substr( basename($dest),$p+1 );
+ $type = config('mime-types',$extension);
+ if ( substr($type,0,5) == 'text/')
+ $mode = FTP_ASCII;
+ }
+
+ Logger::debug("FTP PUT target:$dest mode:".(($mode==FTP_ASCII)?'ascii':'binary'));
+
+ if ( !@ftp_put( $this->verb,$dest,$source,$mode ) )
+ {
+ if ( !$this->mkdirs( dirname($dest) ) )
+ return; // Fehler.
+
+ ftp_chdir( $this->verb,$this->path );
+
+ if ( ! @ftp_put( $this->verb,$dest,$source,$mode ) )
+ throw new OpenRatException('ERROR_PUBLISH',
+ "FTP PUT failed.\n".
+ "source : $source\n".
+ "destination: $dest");
+
+ }
+ }
+
+
+
+ /**
+ * Private Methode zum rekursiven Anlegen von Verzeichnissen.
+ *
+ * @param String Pfad
+ * @return boolean true, wenn ok
+ */
+ private function mkdirs( $strPath )
+ {
+ if ( @ftp_chdir($this->verb,$strPath) )
+ return true; // Verzeichnis existiert schon :)
+
+ $pStrPath = dirname($strPath);
+
+ if ( !$this->mkdirs($pStrPath) )
+ return false;
+
+ if ( ! @ftp_mkdir($this->verb,$strPath) )
+ throw new OpenRatException('ERROR_PUBLISH',"failed to create remote directory: $strPath");
+
+ return true;
+ }
+
+
+
+ /**
+ * Schliessen der FTP-Verbindung.<br>
+ * Sollte unbedingt aufgerufen werden, damit keine unn�tigen Sockets aufbleiben.
+ */
+ public function close()
+ {
+ if ( ! @ftp_quit( $this->verb ) )
+ {
+ // Closing not possible.
+ // Only logging. Maybe we could throw an Exception here?
+ Logger::warn('Failed to close FTP connection. Continueing...');
+ return;
+ }
+ }
+}
+
+
+?>
+\ No newline at end of file
diff --git a/modules/cms-publish/Publish.class.php b/modules/cms-publish/Publish.class.php
@@ -36,45 +36,45 @@ class Publish
* zu einem FTP-Server veroeffentlicht werden soll.
* @var Object
*/
- var $ftp;
+ public $ftp;
/**
* Flag, ob in das lokale Dateisystem veroeffentlicht werden soll.
* @var boolean
*/
- var $with_local = false;
+ public $with_local = false;
/**
* Flag, ob zu einem FTP-Server ver�ffentlicht werden soll.
* @var boolean
*/
- var $with_ftp = false;
+ public $with_ftp = false;
- var $local_destdir = '';
+ public $local_destdir = '';
/**
* Enthaelt die gleichnamige Einstellung aus dem Projekt.
* @var boolean
*/
- var $content_negotiation = false;
+ public $content_negotiation = false;
/**
* Enthaelt die gleichnamige Einstellung aus dem Projekt.
* @var boolean
*/
- var $cut_index = false;
+ public $cut_index = false;
/**
* Enthaelt die gleichnamige Einstellung aus dem Projekt.
* @var String
*/
- var $cmd_after_publish = '';
+ public $cmd_after_publish = '';
/**
* Enthaelt am Ende der Ver�ffentlichung ein Array mit den ver�ffentlichten Objekten.
* @var Array
*/
- var $publishedObjects = array();
+ public $publishedObjects = array();
/**
* Enthaelt im Fehlerfall (wenn 'ok' auf 'false' steht) eine
@@ -82,31 +82,23 @@ class Publish
*
* @var String
*/
- var $log = array();
+ public $log = array();
/**
- * Stellt nach der Ver�ffentlichung fest, ob der Vorgang erfolgreich ist.
- * Falls nicht, enth�lt die Variable 'log' eine Fehlermeldung.
- * @var boolean
- */
- var $ok = true;
-
- /**
* Konstruktor.<br>
* <br>
* Oeffnet ggf. Verbindungen.
*
* @return Publish
*/
- function __construct( $projectid )
+ public function __construct( $projectid )
{
$confPublish = config('publish');
if ( config('security','nopublish') )
{
- $this->ok = false;
- $this->log[] = 'publishing is disabled.';
- return;
+ Logger::warn('publishing is disabled.');
+ return; // this is no error.
}
$project = new Project( $projectid );
@@ -126,14 +118,7 @@ class Publish
if ( ! empty($ftpUrl) )
{
$this->with_ftp = true;
- $this->ftp = new Ftp( $project->ftp_url ); // Aufbauen einer FTP-Verbindung
-
- if ( ! $this->ftp->ok ) // FTP-Verbindung ok?
- {
- $this->ok = false;
- $this->log = $this->ftp->log;
- return; // Ende. Ohne FTP brauchen wir nicht weitermachen.
- }
+ $this->ftp = new Ftp($project->ftp_url); // Aufbauen einer FTP-Verbindung
$this->ftp->passive = ( $project->ftp_passive == '1' );
}
@@ -148,6 +133,7 @@ class Publish
{
if ( empty( $localDir))
$localDir = $project->name;
+
// Konfiguriertes Verzeichnis verwenden.
$this->local_destdir = $confPublish['filesystem']['directory'].$localDir;
}
@@ -157,12 +143,7 @@ class Publish
if ( $this->local_destdir != '' )
{
if ( !is_writeable( $this->local_destdir ) )
- {
- $this->ok = false;
- $this->log[] = 'directory not writable: '.$this->local_destdir;
- $this->log[] = 'please correct the file permissions.';
- return;
- }
+ throw new OpenRatException('ERROR_PUBLISH','directory not writable: '.$this->local_destdir );
$this->with_local = true;
}
@@ -193,11 +174,8 @@ class Publish
* @param String $tmp_filename
* @param String $dest_filename
*/
- function copy( $tmp_filename,$dest_filename,$lastChangeDate=null )
+ public function copy( $tmp_filename,$dest_filename,$lastChangeDate=null )
{
- if ( !$this->ok)
- return;
-
global $conf;
$source = $tmp_filename;
@@ -211,13 +189,10 @@ class Publish
return; // Fehler bei Verzeichniserstellung, also abbrechen.
if (!@copy( $source,$dest ))
- {
- $this->ok = false;
- $this->log[] = 'failed copying local file:';
- $this->log[] = 'source : '.$source;
- $this->log[] = 'destination: '.$dest;
- return; // Fehler beim Kopieren, also abbrechen.
- }
+ throw new OpenRatException('ERROR_PUBLISH','failed copying local file:'."\n".
+ 'source : '.$source."\n".
+ 'destination: '.$dest);
+
if ( ! is_null($lastChangeDate) )
@touch( $dest,$lastChangeDate );
@@ -228,11 +203,7 @@ class Publish
{
// CHMOD auf der Datei ausfuehren.
if ( ! @chmod($dest,octdec($conf['security']['chmod'])) )
- {
- $this->ok = false;
- $this->log[] = 'Unable to CHMOD file '.$dest;
- return;
- }
+ throw new OpenRatException('ERROR_PUBLISH','Unable to CHMOD file '.$dest);
}
}
@@ -240,12 +211,6 @@ class Publish
{
$dest = $dest_filename;
$this->ftp->put( $source,$dest );
-
- if ( ! $this->ftp->ok )
- {
- $this->ok = false;
- $this->log[] = $this->ftp->log;
- }
}
}
@@ -260,7 +225,7 @@ class Publish
* @param String Verzeichnis
* @return boolean
*/
- function mkdirs( $strPath )
+ private function mkdirs( $strPath )
{
global $conf;
@@ -268,29 +233,22 @@ class Publish
return true;
$pStrPath = dirname($strPath);
+
if ( !$this->mkdirs($pStrPath) )
return false;
if ( ! @mkdir($strPath,0777) )
- {
- $this->ok = false;
- $this->log[] = 'Cannot create directory: '.$strPath;
- return false;
- }
+ throw new OpenRatException('ERROR_PUBLISH','Cannot create directory: '.$strPath);
// CHMOD auf dem Verzeichnis ausgef�hren.
if (!empty($conf['security']['chmod_dir']))
{
if ( ! @chmod($strPath,octdec($conf['security']['chmod_dir'])) )
- {
- $this->ok = false;
- $this->log[] = 'Unable to CHMOD directory: '.$strPath;
- return false;
- }
+ throw new OpenRatException('ERROR_PUBLISH','Unable to CHMOD directory: '.$strPath);
}
- return $this->ok;
+ return true;
}
@@ -309,7 +267,7 @@ class Publish
}
// Ausfuehren des Systemkommandos.
- if ( !empty($this->cmd_after_publish) && $this->ok )
+ if ( !empty($this->cmd_after_publish) )
{
$ausgabe = array();
$rc = false;
@@ -320,20 +278,12 @@ class Publish
putenv("CMS_USER_MAIL=".$user->mail );
exec( $this->cmd_after_publish,$ausgabe,$rc );
- if ( $rc != 0 ) // Wenn Returncode ungleich 0, dann Ausgabe ins Log schreiben und Fehler melden.
- {
- $this->log = $ausgabe;
- $this->log[] = 'OpenRat: System command failed - returncode is '.$rc;
- $this->ok = false;
-
- Logger::warn('System command '.$this->cmd_after_publish.' failed with status '.$rc );
-
- }
+ if ( $rc != 0 ) // Wenn Returncode ungleich 0, dann Fehler melden.
+ throw new OpenRatException('ERROR_PUBLISH','System command failed - returncode is '.$rc."\n".
+ $ausgabe);
else
- {
Logger::debug('System command successful' );
- }
-
+
}
}
@@ -345,11 +295,8 @@ class Publish
* Datei, die laenger existiert als der aktuelle Request alt ist, wird geloescht.<br>
* Natuerlich darf diese Funktion nur nach einem Gesamt-Veroeffentlichen ausgefuehrt werden.
*/
- function clean()
+ public function clean()
{
- if ( $this->ok )
- return;
-
if ( !empty($this->local_destdir) )
$this->cleanFolder($this->local_destdir);
}
@@ -362,7 +309,7 @@ class Publish
*
* @param String Verzeichnis
*/
- function cleanFolder( $folderName )
+ private function cleanFolder( $folderName )
{
$dh = opendir( $folderName );
@@ -391,4 +338,3 @@ class Publish
}
-?>
-\ No newline at end of file
diff --git a/modules/cms-publish/require.php b/modules/cms-publish/require.php
@@ -1,5 +1,6 @@
<?php
require_once( __DIR__.'/'.'Publish.class.php' );
+ require_once( __DIR__.'/'.'Ftp.class.php' );
require_once( __DIR__.'/'.'PreviewLinkSchema.class.php' );
require_once( __DIR__.'/'.'PublicLinkSchema.class.php' );
diff --git a/modules/util/Ftp.class.php b/modules/util/Ftp.class.php
@@ -1,246 +0,0 @@
-<?php
-// OpenRat Content Management System
-// Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-
-/**
- * Darstellen einer FTP-Verbindung, das beinhaltet
- * das Login, das Kopieren von Dateien sowie praktische
- * FTP-Funktionen
- *
- * @author $Author$
- * @version $Revision$
- * @package openrat.services
- */
-class Ftp
-{
- var $verb;
- var $url;
- var $log = array();
-
- var $passive = false;
-
- var $ok = true;
-
- private $path;
-
-
- // Konstruktor
- function __construct( $url )
- {
- $this->connect( $url );
- }
-
-
- // Aufbauen der Verbindung
- function connect( $url )
- {
- $this->url = $url;
-
- global $conf;
-
- $conf_ftp = $conf['publish']['ftp'];
- $ftp = parse_url( $this->url );
-
- // Die projektspezifischen Werte gewinnen bei �berschneidungen mit den Default-Werten
- $ftp = array_merge($conf_ftp,$ftp);
-
- // Nur FTP und FTPS (seit PHP 4.3) erlaubt
- if ( !in_array(@$ftp['scheme'],array('ftp','ftps')) )
- {
- $this->log[] = 'Unknown scheme in FTP Url: '.@$ftp['scheme'];
- $this->log[] = 'Only FTP (and FTPS, if compiled in) are supported';
- $this->ok = false;
- return;
- }
-
- if ( function_exists('ftp_ssl_connect') && $ftp['scheme'] == 'ftps' )
- $this->verb = @ftp_ssl_connect( $ftp['host'],$ftp['port'] );
- else
- $this->verb = @ftp_connect( $ftp['host'],$ftp['port'] );
-
- if ( !$this->verb )
- {
- $this->log[] = 'Cannot connect to '.$ftp['scheme'].'-server: '.$ftp['host'].':'.$ftp['port'];
- $this->ok = false;
-
- Logger::error('Cannot connect to '.$ftp['host'].':'.$ftp['port']);
- return;
- }
-
- $this->log[] = 'Connected to FTP server '.$ftp['host'].':'.$ftp['port'];
-
- if ( empty($ftp['user']) )
- {
- $ftp['user'] = 'anonymous';
- $ftp['pass'] = 'openrat@openrat.de';
- }
-
- if ( ! ftp_login( $this->verb,$ftp['user'],$ftp['pass'] ) )
- {
- $this->log[] = 'Unable to login as user '.$ftp['user'];
- $this->ok = false;
- return;
- }
-
- $this->log[] = 'Logged in as user '.$ftp['user'];
-
- $pasv = (!empty($ftp['fragment']) && $ftp['fragment'] == 'passive' );
-
- $this->log[] = 'entering passive mode '.($pasv?'on':'off');
- if ( ! ftp_pasv($this->verb,true) )
- {
- $this->log[] = 'cannot switch PASV mode';
- $this->ok = false;
- return;
- }
-
- if ( !empty($ftp['query']) )
- {
- parse_str( $ftp['query'],$ftp_var );
-
- if ( isset( $ftp_var['site'] ) )
- {
- $site_commands = explode( ',',$ftp_var['site'] );
- foreach( $site_commands as $cmd )
- {
- $this->log .= 'executing SITE command: '.$cmd;
-
- if ( ! @ftp_site( $this->verb,$cmd ) )
- {
- $this->log[] = 'unable to do SITE command: '.$cmd;
- $this->ok = false;
- return;
- }
- }
- }
- }
-
- $this->path = rtrim( $ftp['path'],'/' );
-
- $this->log[] = 'Changing directory to '.$this->path;
-
- if ( ! @ftp_chdir( $this->verb,$this->path ) )
- {
- $this->log[] = 'unable CHDIR to directory: '.$this->path;
- $this->ok = false;
- return;
- }
- }
-
-
- /**
- * Kopieren einer Datei vom lokalen System auf den FTP-Server.
- *
- * @param String Quelle
- * @param String Ziel
- * @param int FTP-Mode (BINARY oder ASCII)
- */
- function put( $source,$dest )
- {
- if ( ! $this->ok )
- return;
-
- $ftp = parse_url( $this->url );
-
- $dest = $this->path.'/'.$dest;
-
- $this->log .= "Copying file: $source -> $dest ...\n";
-
- $mode = FTP_BINARY;
- $p = strrpos( basename($dest),'.' ); // Letzten Punkt suchen
-
- if ($p!==false) // Wennn letzten Punkt gefunden, dann dort aufteilen
- {
- $extension = substr( basename($dest),$p+1 );
- $type = config('mime-types',$extension);
- if ( substr($type,0,5) == 'text/')
- $mode = FTP_ASCII;
- }
-
- Logger::debug("FTP PUT target:$dest mode:".(($mode==FTP_ASCII)?'ascii':'binary'));
-
- if ( !@ftp_put( $this->verb,$dest,$source,$mode ) )
- {
- if ( !$this->mkdirs( dirname($dest) ) )
- return; // Fehler.
-
- ftp_chdir( $this->verb,$this->path );
-
- if ( ! @ftp_put( $this->verb,$dest,$source,$mode ) )
- {
- $this->ok = false;
- $this->log[] = 'FTP PUT failed...';
- $this->log[] = 'source : '.$source;
- $this->log[] = 'destination: '.$dest;
- return;
- }
-
- }
- }
-
-
-
- /**
- * Private Methode zum rekursiven Anlegen von Verzeichnissen.
- *
- * @param String Pfad
- * @return boolean true, wenn ok
- */
- function mkdirs( $strPath )
- {
- if ( @ftp_chdir($this->verb,$strPath) )
- return true; // Verzeichnis existiert schon :)
-
- $pStrPath = dirname($strPath);
-
- if ( !$this->mkdirs($pStrPath) )
- return false;
-
- if ( ! @ftp_mkdir($this->verb,$strPath) )
- {
- $this->ok = false;
- $this->log[] = "failed to create remote directory: $strPath";
- }
-
- return $this->ok;
- }
-
-
-
- /**
- * Schlie�en der FTP-Verbindung.<br>
- * Sollte unbedingt aufgerufen werden, damit keine unn�tigen Sockets aufbleiben.
- */
- function close()
- {
- if ( !$this->ok ) // Noch alles ok?
- return;
-
- if ( ! @ftp_quit( $this->verb ) )
- {
- // Das Schlie�en der Verbindung hat nicht funktioniert.
- // Eigentlich k�nnten wir das ignorieren, aber wir sind anst�ndig und melden eine Fehler.
- $this->log[] = 'failed to close connection';
- $this->ok = false;
- return;
- }
- }
-}
-
-
-?>
-\ No newline at end of file
diff --git a/modules/util/require.php b/modules/util/require.php
@@ -20,7 +20,7 @@ require_once( __DIR__.'/'.'JSqueeze.class.php' );
require_once( __DIR__.'/'.'Spyc.class.php' );
require_once( __DIR__.'/'.'TreeElement.class.php' );
require_once( __DIR__.'/'.'Tree.class.php');
-require_once( __DIR__.'/'.'Ftp.class.php' );
+require_once(__DIR__ . '/');
require_once( __DIR__.'/'.'Macro.class.php' );
require_once( __DIR__.'/'.'Dynamic.class.php' );
require_once( __DIR__.'/'.'Api.class.php' );