Example #1
0
function config_graph_export() {
	switch (read_config_option("export_type")) {
		case "local":
			export();
			break;
		case "ftp_php":
			// set the temp directory
			$stExportDir = $_ENV["TMP"].'/cacti-ftp-temp';
			export_pre_ftp_upload($stExportDir);
			export_log("Using PHP built-in FTP functions.");
			export_ftp_php_execute($stExportDir);
			export_post_ftp_upload($stExportDir);
			break;
		case "ftp_ncftpput":
			if (strstr(PHP_OS, "WIN")) export_fatal("ncftpput only available in unix environment!");
			// set the temp directory
			$stExportDir = $_ENV["TMP"].'/cacti-ftp-temp';
			export_pre_ftp_upload($stExportDir);
			export_log("Using ncftpput.");
			export_ftp_ncftpput_execute($stExportDir);
			export_post_ftp_upload($stExportDir);
			break;
		case "disabled":
			break;
		default:
			export_log("Export method not specified. Updated config to use local exporting.");
			db_execute("insert into settings (name,value) values ('export_type','local')");
	};
};
Example #2
0
function config_graph_export()
{
    $total_graphs_created = 0;
    switch (read_config_option("export_type")) {
        case "local":
            $total_graphs_created = export();
            break;
        case "sftp_php":
            if (!function_exists("ftp_ssl_connect")) {
                export_fatal("Secure FTP Function does not exist.  Export can not continue.");
            }
        case "ftp_php":
            /* set the temp directory */
            if (strlen(read_config_option("export_temporary_directory")) == 0) {
                $stExportDir = $_ENV["TMP"] . '/cacti-ftp-temp';
            } else {
                $stExportDir = read_config_option("export_temporary_directory") . '/cacti-ftp-temp';
            }
            $total_graphs_created = export_pre_ftp_upload($stExportDir);
            export_log("Using PHP built-in FTP functions.");
            export_ftp_php_execute($stExportDir, read_config_option("export_type"));
            export_post_ftp_upload($stExportDir);
            break;
        case "ftp_ncftpput":
            if (strstr(PHP_OS, "WIN")) {
                export_fatal("ncftpput only available in unix environment!  Export can not continue.");
            }
            /* set the temp directory */
            if (strlen(read_config_option("export_temporary_directory")) == 0) {
                $stExportDir = $_ENV["TMP"] . '/cacti-ftp-temp';
            } else {
                $stExportDir = read_config_option("export_temporary_directory") . '/cacti-ftp-temp';
            }
            $total_graphs_created = export_pre_ftp_upload($stExportDir);
            export_log("Using ncftpput.");
            export_ftp_ncftpput_execute($stExportDir);
            export_post_ftp_upload($stExportDir);
            break;
        case "disabled":
            break;
        default:
            export_fatal("Export method not specified. Exporting can not continue.  Please set method properly in Cacti configuration.");
    }
    return $total_graphs_created;
}