************************************************************/ if (get_conf('autobackup.db_backup')) { if (!$quiet) { print "Tworzę kopię bazy danych \n"; } if (!($filename_sql = $LMS->DataBaseCreate(get_conf('autobackup.db_gz', true), get_conf('autobackup.db_stats', false)))) { $filename_sql = false; } if (!$quiet) { print "Utworzono kopię bazy danych " . $filename_sql . "\n"; } if (get_conf('autobackup.db_ftpsend') && $filename_sql && $FTP->connect($ssl)) { $filename = str_replace(get_conf('directories.backup_dir') . '/', '', $filename_sql); $tmp = str_replace('.sql', '', $filename_sql); // $tmp = .' $FTP->chdir(get_conf('autobackup.db_ftppath'), true); if (!$quiet) { print "Tworze kopie bazy na FTP: " . $filename . "\n"; } $result = $FTP->upload($filename_sql, $filename, 'auto', $akcja); $FTP->close(); if (SYSLOG) { if ($result) { addlogs('lms-autobackup -> Utworzono kopię bazy ' . $filename . ' na serwerze FTP: ' . get_conf('autobackup.ftphost'), 'e=add;m=admin;'); } else { addlogs('lms-autobackup -> Nie utworzono kopii bazy ' . $filename . ' na serwerze FTP: ' . get_conf('autobackup.ftphost'), 'e=err;m=admin;'); } } } } // end if db backup
/** * Gets a parsed rawlist from ftp. * * @param FTP $ftpConnection * @param string $directory * @return array $rawlist */ public static function getRawlist(FTP $ftp, $directory = '') { $currentDir = $ftp->pwd(); if (!@$ftp->chdir($directory)) { // try again without leading slash $directory = FileUtil::removeLeadingSlash($directory); if (!@$ftp->chdir($directory)) { $directory = $currentDir; if (!@$ftp->chdir($directory)) { return false; } } } $rawlist = @$ftp->rawlist('-a'); if (count($rawlist) <= 1) { $rawlist = @$ftp->rawlist(''); } $rawlist = self::parseRawlist($rawlist); @$ftp->chdir($currentDir); return $rawlist; }