GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   I need something like TEVS, but static. (https://gfy.com/showthread.php?t=868593)

Gambrinus 11-11-2008 04:14 PM

I need something like TEVS, but static.
 
I like TEVS, it does its job nicely, but these dynamic pages are killing my box. The load is brutal at 100k a day, its killing my ability to grow.

I need something TEVSesque but that generates static pages. I dont even need bulk import functionality, user uploads, any of that crap.

Something that just takes sponsor embed code, add some text, a title, and it shits out an html page with the aforementioned input.

Anything?

HorseShit 11-11-2008 04:25 PM

what kind of hardware are you running

Gambrinus 11-11-2008 04:29 PM

hw.model: Intel(R) Pentium(R) 4 CPU 2.80GHz
hw.ncpu: 2
hw.physmem: 1059479552
hw.usermem: 738578432

HorseShit 11-11-2008 04:31 PM

hit me up

Tjeezers 11-11-2008 04:37 PM

You can make TEVS static... I did it.. you can do it too.

Gambrinus 11-11-2008 04:38 PM

Tell me how to make tevs static, please.

Tjeezers 11-11-2008 04:39 PM

oke, give me a moment, opening dreamweaver to grab the codes

Gambrinus 11-11-2008 04:41 PM

you fuckin rule.

Tjeezers 11-11-2008 04:44 PM

First Step - Create a php page called cache.php
and dump this code in it....

Code:

<?
/**
 * Cache - Output caching
 * @package Cache
 * @author degro
 * @copyright 2008 Harry Varwijk - AWMS-Network.com
 */
class Cache
{

        function Cache($path, $disable=false, $disable_output=false)
        {
                if(!is_dir($path))                trigger_error("Path is not directory!", E_USER_ERROR);
                if(!is_writable($path))        trigger_error("Path is not writable!", E_USER_ERROR);

                if(!in_array(substr($path,-1),array("\\","/"))) $path.="/";
               
                $this->path = $path;
                $this->disable = (bool)$disable;
                $this->disable_output = (bool)$disable_output;
                $this->stack = array();
               
                $this->output = null;
        }
       
        function _output($output)
        {
                $this->output = $output;
                if(!$this->disable_output) echo $output;
        }

        function _load($file,$time)
        {
                $filename = $this->path.$file;
               
                if($this->disable) return false;
                if(!file_exists($filename)) return false;
               
                $f = fopen($filename, "r");
                $fstat = fstat($f);
                fclose($f);

                if(time()-$fstat['mtime']>$time) return false;
               
                return file_get_contents($filename);
               
        }

        function _start($file,$time)
        {

                $data = $this->_load($file,$time);
                if($data===false)
                {
                        $this->stack[count($this->stack)] = $file;
                        ob_start();
                        return count($this->stack);
                }
               
                $data = $this->_unpack($data);
               
                $this->_output($data['__output__']);
               
                return $data;
        }

        function _unpack($data)
        {
                return unserialize($data);
        }

        function _pack($data)
        {
                return serialize($data);
        }
       
        function save($file,$time,$data=array())
        {

                if($this->disable) return false;

                $time = (int)$time;
                if(!$file) trigger_error("n-am fisier", E_USER_ERROR);
                if($time<1) trigger_error("timpul trebuie sa fie mai mare de 0", E_USER_ERROR);
               
                if(count($this->stack) && $file == $this->stack[count($this->stack)-1])
                {
                        $filename = $this->path.$file;
                       
                        $data['__output__'] = ob_get_contents();
                        ob_end_clean();
       
                        if(file_exists($filename) && !is_writable($filename)) trigger_error("eroare la scriere", E_USER_ERROR);
       
                        $f = fopen($filename, 'w');
                        fwrite($f, $this->_pack($data));
                        fclose($f);
                       
                        $this->_output($data['__output__']);
                       
                        unset( $this->stack[count($this->stack)-1]);
                       
                        return false;
                }
                elseif( count($this->stack) &&  in_array($file,$this->stack) )
                {
                        trigger_error("eroare la stack: ".$this->stack[count($this->stack)-1], E_USER_ERROR);
                        exit;
                }
                else
                {
                        $r = $this->_start($file,$time);
                        if(is_int($r))
                        {
                                return $r;
                        }
                        else
                        {
                                for($i = 0;$i<count($data); $i++)
                                {
                                        $data[$i] = $r[$i];
                                }
                                return false;
                        }
                }
       
        }

}

?>

Wait a few moments for me to find the rest, it was like 5 months ago i did it, and it saved me a shitload of Gigs... Just make step 1 first... Be right back
Need cola and chocolate first

Tjeezers 11-11-2008 04:46 PM

Step 2, create a folder called "' cache "" and put it in the root, chmod it to 777
So folder name cache, and in 777 please

Now i need to find step 3, brb

Tjeezers 11-11-2008 04:52 PM

Step 3 ...

Code:

<?
// CALL THE CACHING CLASS

require_once("cache.php");

// SET THE CACHING FOLDER PATH

$path = "./cache";
$self = $_SERVER['PHP_SELF'];
$query = !empty($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null;
$file = md5('index');

// SET THE EXPIRATION TIME (IN SECONDS)

$expire = 3600;
$cache = new Cache($path);

// START WRITING TO CACHE

while($cache->save($file,$expire))

{

?>


You place this CODE in your index.php

variable is $expire = 3600;
Higher number, good for high traffic volume
Lower Number, good for low traffic volume

NOW step 4

You place below code above the footer include.

Code:

<?

// FINISH WRITING TO CACHE

}

?>

This should do the trick

You can see the end result on www.SmutThumb.com, as you can see there, the index refreshes every 60 minutes. So the load is way more friendly.
This code is costume. It is made to solve the problem you run into now.

Kind Regards

Harry

d-null 11-11-2008 04:55 PM

Quote:

Originally Posted by Sex2Have (Post 15039491)

You can see the end result on www.SmutThumb.com, as you can see there, the index refreshes every 60 minutes. So the load is way more friendly.
This code is costume. It is made to solve the problem you run into now.

Kind Regards

Harry


nice site Harry, is that the only mod you have done to the TEVs platform on that site? looks like it is running good and I like your php redirect to the sponsor (is that a builtin feature of TEVS)?

Tjeezers 11-11-2008 05:08 PM

Quote:

Originally Posted by d-null (Post 15039531)
nice site Harry, is that the only mod you have done to the TEVs platform on that site? looks like it is running good and I like your php redirect to the sponsor (is that a builtin feature of TEVS)?

(is that a builtin feature of TEVS)? = yes
is that the only mod you have done to the TEVs platform on that site? = yes

The rest on Smut is just some japperdiejapp html work. Nothing impressive to be honest. The only reason i have a TEVS was to have all movies of all my sponsors on 1 place. Gathered 196,000 in 2 months time. Its a bitch to do this a second time.... :1orglaugh

Gambrinus 11-11-2008 05:27 PM

Thanks. But correct me if I am wrong, this is still being created dynamically: http://www.smutthumb.com/video/BrookeSkyecom-269659/ ?

My main is static as I am using tgpx to list and rank the thumbs, TEVS to display the video the thumb links to. This is where I am having the trouble. If I sent 100k to dynamically created tevs main with 60 thumbs my box would melt, I solved that problem early with using tgpx to create the main.

Tjeezers 11-11-2008 05:35 PM

you can of course work on the code a little bit and also employ it on the deeper pages. For me the only needed gig chiller was needed on the index. You can also edit the pages and take the side elements out, or lower the amount of pictures you see on your right. If i would make it all static, the visitors would see every time the same related videos when it watches a movie 2 times. As said, when your a little bit handy, the entire TEVS can be made static. For me the need was not there. With TEVS the sponsors host the movies, so i would not be so unhappy to have 100K a day on it, i would optimize the php pages a little here and there, and 100K is easy to handle then. But heee.. im not a coder, i am more a simple webmaster.

Godsmack 11-11-2008 05:36 PM

STXT outputs static

Gambrinus 11-11-2008 05:41 PM

Thanks a bunch sex2have, Im gonna dick around with that code and see what happens.

Godsmack, if I cant get that code working you'll most likely be hearing from me shortly. :)

Zorgman 11-11-2008 10:06 PM

I would have made a static version of TEVS but the fact that some webmasters have 200,000 + videos in their database, along with no real template system made me think twice about it.

I would say if the mysql queries are hurting, their is lots of code you can drop.

Gambrinus 11-12-2008 07:58 PM

I just wanted to drop back in here and say after further investigations by host it was determined that a bad mysql config was largely to blame for the crippling load. After being fixed the load isnt a third of what it was. Tits.

Sorry Zorg, didnt want you to think I was in here bagging your script. Im a big fan of it.

Zorgman 11-12-2008 08:18 PM

It's cool. Lots of different factors play with server loads.
I had one client back in Feb that was using tevs with 50,000 videos and 20k a day traffic. Told me the script was too slow. After looking at this server there was 500 other domains using tgp and blogs on the same database.

As long as it's fixed, it's all good. :D

TDF 11-13-2008 10:08 AM

tevs has excellent support and will help webmasters with the small nuances of the script


All times are GMT -7. The time now is 06:00 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc