HACK: Got Bandwidth Tracking Working Again... (not for everyone -- PLEASE READ)

Hey Folks,

I was going nuts when bandwidth tracking stopped working in June after “uninstalling” ProFTPD and replacing it with “vsFTPD”.

So today I was messing around with some of the files which control how bandwidth is generated, and noticed an error which was coming up whenever “bw.pl” was being run.

Apparently, due to it’s hard-coded nature, if ProFTPD isn’t detected the bandwidth tool will simply stop working all together (at least this is what appears to be the case)

So, I decided to disable all trace of this within “virtual-server-lib.pl”.

Here’s the old code snippet:

@opt_features = (‘unix’,‘dir’,‘mail’,‘dns’,‘web’,‘webalizer’,‘ssl’,‘logrotate’,‘mysql’,‘postgres’,‘ftp’,‘spam’,‘virus’,$virtualmin_pro ? (‘status’) : (),‘webmin’;

Here’s the new code snippet:

@opt_features = (‘unix’,‘dir’,‘mail’,‘dns’,‘web’,‘logrotate’,‘mysql’,‘spam’,‘virus’,‘webmin’);

*** I removed “webalizer”, “ssl”, “postgres”, and “virtualmin_pro features” in addition above because I don’t use virtualmin pro and the other features mentioned. ***

The key here was removing “ftp”.

Next there was one more section I needed to ammend to make things work correctly as the above produced an error when applied alone.

Here’s the old code snippet:

@virtualmin_backups = (‘config’,‘templates’,$virtualmin_pro ? (‘resellers’) : (),‘email’,‘custom’,$virtualmin_pro ? (‘scripts’,‘styles’) : (),‘scheds’,&has_ftp_chroot() ? (‘chroot’) : ());

Here’s the new code snippet:

@virtualmin_backups = (‘config’,‘templates’,‘email’,‘custom’,‘scheds’);

*** Again I removed “virtualmin_pro” sections since I run the GPL version. ***

The above removes &has_ftp_chroot section which is the final fix.

After applying the above changes (with backups of the orignals just in case, I re-ran the “bw.pl” file, refreshed my virtualmin screen, and badaboo! bandwith was tracking once again!

Any suggestions or comments to improve this would be greatly appreciated, and perhaps a more permanent solution will be rolled into a future release of virtualmin for maximum flexibility and stability.