
04-19-2011, 09:20 PM
|
|
|
Join Date: Dec 2007
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by megamoose
Null, thanks for this mod. It is perfect.
The thumbnail generator I created in the previous version had a bug in it which would cause a great server load. This new version should run a lot quicker and more efficient. Remember if it does hang on your server decrease the STEP_AMOUNT variable.
Create a file on your server called threadthumbupdate.php with the following in the file and open it in your browser.
PHP Code:
<?php $STEP_AMOUNT = 20000; ?>
<input type="button" id="btnNext" value="Process Next Results" onClick="window.location='?start='+(<?php echo $_GET["start"]; ?>+<?php echo $STEP_AMOUNT;?>)" disabled=true><br> The button above should enable once this batch is complete!<br> <br>
<?php error_reporting(E_ALL & ~E_NOTICE & ~8192);
// #################### DEFINE IMPORTANT CONSTANTS ####################### define('SKIP_SESSIONCREATE', 1); define('NOCOOKIES', 1); define('THIS_SCRIPT', 'xupdate'); define('CSRF_PROTECTION', true);
// #################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array();
// get special data templates from the datastore $specialtemplates = array();
// pre-cache templates used by all actions $globaltemplates = array();
// pre-cache templates used by specific actions $actiontemplates = array();
// ######################### REQUIRE BACK-END ############################ require_once('./global.php');
if (!$_GET["start"]) { $_GET["start"] = 0; }
$threads = $db->query_read_slave(" SELECT * FROM " . TABLE_PREFIX . "thread LIMIT ".$db->escape_string($_GET["start"]).",". $db->escape_string($STEP_AMOUNT));
while ($thread = $db->fetch_array($threads)){
$posts = $db->query_read_slave("SELECT * FROM `" . TABLE_PREFIX . "post` WHERE `postid` = '".$thread["firstpostid"]."'"); $post = $db->fetch_array($posts);
preg_match('/\[img\](.*?)\[\/img\]/i',$post["pagetext"],$matches); $query = "UPDATE `" . TABLE_PREFIX . "thread` set `thumbnailurl` = '".$db->escape_string($matches[1])."' WHERE threadid = " . $thread["threadid"];
$db->query_write($query);
} ?>
<script> document.getElementById("btnNext").disabled = false;
</script>
|
I want to give a big shout out to everyone who's helped make this script happen. It is GREAT!!!!! I hope it continues to work through-out VBs update.
|