PDA

View Full Version : Statistics Modifications - Fully integrated IRC Stats: Updated with Pisg, Cron guide.


Rawkarma
04 Mar 2007, 19:32
The reasoning behind this post came from a friend of mine that saw my Bulletin Board and requested a detailed walkthrough. Seeing as I was going to spend the time writing this, I thought linking them here and enabling others to read this would be a better use of my time. And id imagine there are many people that will benefit greatly from a more detailed explanation.

This guide will show you how to successfully implement the mod for your VB; configure pisg on your shell; how to set a crontab that will be used to update your stats (not covered by jluerken.) DOES require an eggdrop.

First, all credit for this mod should be giving to jluerken (http://www.vbulletin.org/forum/member.php?u=39212) found here (http://www.vbulletin.org/forum/showthread.php?t=68838&highlight=pisg).

All I have done is use this mod, corrected a minor error in the code and then updated the pisg help. I have taken this substantially further so you can implement pisg on your IRC Shell with ease.

Important

I am using a *nix server to run pisg and an eggdrop setup that's logging stats for my channel. You will need the same to begin with. One such IRC Shell provider id recommend is Veritynet.net (http://veritynet.net).

This mod was originally created for VB 3.0.3 and was released back in 2004, however, it is running seamlessly on my VB and I am using 6.4.

Fully integrated IRC Stats, Updated with Pisg, Cron guide.

Everything up until dealing with /includes/functions_online.php you can follow from jluerken's own words in the original post: here (http://www.vbulletin.org/forum/showthread.php?t=68838&highlight=pisg)

Now, I'll assume you have functions_online.php already open and in your preferred text editor.

Find this code:

case 'index':
$userinfo['action'] = $vbphrase['viewing_index'];
$userinfo['where'] = "<a href=\"$vboptions[forumhome].php?$session[sessionurl]\">$vboptions[bbtitle]</a>";
break;

And then add this directly below:

case 'ircstats':
$userinfo['action'] = "IRC Stats";
$userinfo['where'] = "<a href=\"ircstats.php\">IRC Stats</a>";
break;

I have included the above and bellow code in the area of functions_online.php so you can better see if it looks right.

case 'index':
$userinfo['action'] = $vbphrase['viewing_index'];
$userinfo['where'] = '<a href="' . $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q'] . '">' . $vbulletin->options['bbtitle'] . '</a>';
break;
case 'ircstats':
$userinfo['action'] = "IRC Stats";
$userinfo['where'] = "<a href=\"ircstats.php\">IRC Stats</a>";
break;
case 'online':
$userinfo['action'] = $vbphrase['viewing_whos_online'];
break;

In the original mod you're asked to find the bellow code:

case "$vboptions[forumhome].php":
$userinfo['activity'] = 'index';
break;

For me, I did not have this in my functions_online.php

Search for: case 'poll.php':

Add this above it:

case "ircstats.php":
$userinfo['activity'] = 'ircstats';
break;

So, you're adding this:

case 'poll.php':
$userinfo['activity'] = 'polls';
break;

So it looks something like this:

else
{
$userinfo['activity'] = 'index'; // where are they?
}
break;

case "ircstats.php":
$userinfo['activity'] = 'ircstats';
break;

case 'poll.php':
$userinfo['activity'] = 'polls';
break;

I don't have a use for this function on my VB, however, I still included it, and have no idea how well it will work for you.

Save the file as functions_online.php and upload it to your VB includes dir.

Example path:

/public_html/forum/includes/

At this stage we move onto the pisg configuration; jluerken's pisg help is sketchy and now outdated.

Pisg config

Download the latest version of pisg from the official site: here (http://pisg.sourceforge.net/index.php?page=download)

Download: pisg-0.70.tar.gz

I use a dedicated IRC Shell to run pisg and you will need to FTP to your own server where your eggdrop lives.

Use your favorite FTP Client and upload pisg-0.70.tar.gz to your shell root dir:

/usr/home/yourname/

Do not put this in public_html!

Now, using an Open source SSH Client we can extract pisg-0.70.tar.gz and I recommend Putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html). It's free.

Extracting the tar file

At the command prompt, assuming you have uploaded pisg-0.70.tar.gz, type the following:

tar zxvf pisg-0.70.tar.gz

The file will now extract all contents to a new folder called, pisg-0.70.

Using your FTP Client, (refresh the dir listings if necessary) you'll now see the folder, pisg-0.70.

Rename this to pisg.

We need to give pisg the correct permissions and we do this by using an FTP Client, or SSH via the 'chmod' command.

FTP

Enter the folder pisg and then right click the file, pisg and set file attributes to 755.

SSH

Type the following:

cd pisg

then

chmod +x pisg

Moving the pisg image files to the correct folder on your web server

Now we need to move the images that pisg will use when displaying your statistics to your VB image dir.

The best way to do this is to FTP into the pisg folder (on your shell) and then download gfx and layout folders to your hard drive.

Now, using your FTP on your web server, navigate to your VB image folder and upload all the contents of gfx folder, but not the folder.

To better explain where to upload this, use the path bellow:

/public_html/forum/images/misc/

Place the contents of gfx into the misc folder, but remember, do not upload the folder; just it's contents (the image files.)

Making the ircstats directory

Now, FTP to your VB main dir and create a new folder called ircstats. And inside that folder, you will need to create another folder with the channel name of your IRC channel.

Example path bellow:

/public_html/forum/ircstats/geeks/

In ircstats folder, upload 'default.css'

You can find it in the layout folder you downloaded to your hard drive.

Example path bellow:

/public_html/forum/ircstats/default.css

Ok, we are almost done you will be pleased to know.

Now we need to edit the pisg.cfg file and then set a script (don't panic, it's easy) for the shell server crontab and a cron for for the web server so your stats update at regular intervals.

pisg.cfg

I have put a pisg.cfg.example file in the pisg.zip which you may edit for your IRC channel specifications. Just rename it pisg.cfg and upload it.

The options I have set in that .cfg will output the stats in the same way as the screen shot. You may change these as you see fit. Just make sure you keep the default.css as the theme.

<channel="#yourchannel">
LogDir="/home/yourname/eggdrop/logs/geeks/"
Format="eggdrop"
Network="irc.someplace.com"
Maintainer="You"
OutputFile="/home/yourname/public_html/geeks/ircstats.pisg"
</channel>

LogDir: The place where you have your eggdrop keeping it's channel log files.

OutputFile: The directory to output the ircstats.pisg file.

Create a public_html directory that can be accessed via the web and then make folder for your channel. The ircstats.pisg will be saved inside it each time pisg updates.

/home/yourname/public_html/geeks/ircstats.pisg

I have also included a modified HTMLGenerator.pm file that will output the stats in the same way as you see from the screen shot. In jluerken's original post, he did not seem to mind how it was generating; I myself, found the original HTMLGenerator.pm in pisg didn't look right for my VB board style.

You can use mine, or use the one pisg comes with. Your choice.

Upload this file to pisg's module directory:

/usr/home/yourname/pisg/modules/Pisg/

Pisgchek

Many people use different methods, but I find using a simple script for pisg best when setting a cron.

Using your favorite text editor make a new file and place this code inside it:

#!/bin/sh

statsbin="./pisg"
statpath="/home/yourname/pisg"

cd $statpath

$statsbin

Change yourname and save it: pisgchek

Upload the file to your pisg directory:

/usr/home/yourname/pisg/pisgchek

Chmod the file +x or set file attributes to 755.

Crontabs

You can set crons in a variety of ways, but for ease of use and to save on confusion, we will do it with the bellow method in this guide. If you already know now to set a crontab, be my guest and do it the way you like.

Warning: If you use the my.crontab file you will lose any old crons you have active on your shell. Only use this if you need to -- it's best to use vi or something akin to it and manually edit your crons with: crontab -e.

Crontab on shell server

Make a new file in your text editor.

Insert the code bellow into the file:

8,18,28,38,48,58 * * * * /home/yourname/pisg/pisgchek > /dev/null 2>&1

You can change the times your statistics will update, but I recommend you don't use, 10,20,30 etc. Best to offset the time.

Save the file as: my.crontab

Place the file in your root dir:

/usr/home/yourname/my.crontab

To load your new crontab type, at the shell prompt:

crontab my.crontab

And to make sure it worked, type:

crontab -l

Crontab on web server

Again, make a new file in your text editor and enter the code bellow:

9,19,29,39,49,59 * * * * wget fetch -O /home/yourname/public_html/forum/geeks/ircstats.pisg http://yourshellserver.com/~yourusername/geeks/ircstats.pisg > /dev/null 2>&1

This will fetch the ircstats.pisg from the IRC channel folder called geeks, and which is in public_html on your shell: /usr/home/yourname/public_html/geeks/ircstats.pisg; then upload it to the directory of your VB board in folder geeks: /home/yourname/public_html/forum/geeks/ircstats.pisg > /dev/null 2>&1 every 9 mins, of every hour, of every day, of every month.

Save the file: my.crontab

At the prompt in the root dir type:

crontab my.crontab

The best way to test this is all working is to go to your shell prompt and load pisg:

you@shell:/home/yourname/pisg$ ./pisg

Then, on your webserver's command prompt:

webserver:~ > wget fetch -O /home/yourname/public_html/forum/geeks/ircstats.pisg http://yourshellserver.com/~yourusername/geeks/ircstats.pisg

Now go look at http://yourdomain.com/forum/geeks/ircstats.php and you should finally see your stats.

I have tried to make that as easy as possible. If you need any further help, post and I will check back and offer pointers etc.

daddygrim
05 Mar 2007, 22:18
interesting

ZomgStuff
06 Mar 2007, 01:29
Thanks!