2012-09-24 - Re: [GRASE-Hotspot] Reset user’s “Data Usage”

Header Data

From: Timothy White <ti***8@gmail.com>
Message Hash: 3c42d812a23863a12032edbf595c19d7d9c5c8f7983b10529df84135f58dbf5a
Message ID: <CAESLx0LGeLh4hwUAdK2t_BWc0Dcuejo=r9cboYY5HUH4H+h0og@mail.gmail.com>
Reply To: <CAA-jMMQ4qq=fzxa84cuZcOrc0vuPs25VoKfRWp3Bw444cHPHPg@mail.gmail.com>
UTC Datetime: 2012-09-24 18:14:03 UTC
Raw Date: Tue, 25 Sep 2012 11:14:03 +1000

Raw message

Ick!!

Hold the train!

Instead of the following...
>                 AdminLog::getInstance()->log("data reset to zero for $username");
>
>         exec('perl /usr/share/grase/www/radmin/scripts/archive_a_users_data');

Where you call a perl script, which you copied an old script that
should probably be removed. All those "cron" scripts got migrated into
the Cron class, so I am not 100% sure the old perl scripts will work
without breaking anything. It's possible, but I wouldn't trust it.

Find the CronFunctions.class.php file, around line 480 should be a
function called condensePreviousMonthsAccounting. You can probably
just add -1 and maybe 0 to the months array at the start, then
whenever you call that function, it'll do the "condensing" properly.
Removing some of the WHERE conditions in those SQL clauses might
actually "condense" a users session that is active, and really break
things. You only want to condense sessions that are finished. (Try
first with just -1, if that doesn't condense enough, then try with a 0
in the array as well, however a 0 hasn't been tested before and may
not work as expected).

To call the function from your modifications, replace
>         exec('perl /usr/share/grase/www/radmin/scripts/archive_a_users_data');
with
>         CronFunctions::getInstance()->condensePreviousMonthsAccounting();

Let me know how it goes, and if you implement it well and submit a
clean patch I'll look at putting it as a feature.

Tim




Thread