Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-26-2008, 06:39 PM
peppolone's Avatar
Pligg Donor
Pligg Version: 995-54
Pligg Template: upnews.it
 
Join Date: Dec 2006
Location: rome
Posts: 124
Thanks: 2
Thanked 35 Times in 13 Posts
Method for deleting trackback error

I think we can remove all the contents of the table _trackbacks once they were sent, but for now I wrote a script to remove only those with status error (similar to http://forums.pligg.com/pligg-mods/1...d-stories.html)

STEP 1:

Open admin_links_center.tpl and add the following:
Code:
<img src="{$my_pligg_base}/templates/{$the_template}/images/template_edit.png" align="absmiddle"/> <a href="admin_links.php" onclick="javascript:window.open('admin_delete_trackback.php', 'resultwindow', 'width=300, height=200')">Remove Trackback error</a><br/>
STEP 2:

Create a file called "admin_delete_trackback.php" in the root and add the following:
Code:
<?php
include_once('Smarty.class.php');
$main_smarty = new Smarty;

include('config.php');
include(mnminclude.'html1.php');
include(mnminclude.'link.php');
include(mnminclude.'user.php');
include(mnminclude.'smartyvariables.php');
			
// require user to log in
force_authentication();

// restrict access to god only
$amIgod = 0;
$amIgod = $amIgod + checklevel('god');
$main_smarty->assign('amIgod', $amIgod);

$canIhaveAccess = 0;
$canIhaveAccess = $canIhaveAccess + checklevel('god');
$canIhaveAccess = $canIhaveAccess + checklevel('admin');

if($canIhaveAccess == 0){	
	$main_smarty->assign('tpl_center', $the_template . '/admin_templates/admin_access_denied');
	$main_smarty->display($the_template . '/pligg.tpl');		
	die();
}
function delete_trackback_error($trackback) {
    $query="SELECT * FROM " . table_trackbacks . " WHERE trackback_id = '$trackback'";
    if (! $result=mysql_query($query)) {die (mysql_error());}
    else {$sql_array = mysql_fetch_object($result); }
    $query="DELETE FROM " . table_trackbacks . " WHERE trackback_id = '$trackback'";
    if (! $result=mysql_query($query)) {die (mysql_error());}
	}
$sql_query = "SELECT * FROM " . table_trackbacks . " WHERE trackback_status = 'error'";
$result_trackback_errors = mysql_query($sql_query);
$num_rows = mysql_num_rows($result_trackback_errors);
		while($trackback_error = mysql_fetch_object($result_trackback_errors))
		{
			delete_trackback_error($trackback_error->trackback_id);
		}
echo $num_rows. " Deleted Trackbacks";
?>
Now my table go from 7,8MB to 4,8MB
__________________
My pligg site: www.upnews.it

Last edited by peppolone; 07-26-2008 at 06:46 PM..
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
Fatal error: Call to undefined method: stdClass->get_results() in /data/c8 neale Installation and Upgrade Help 2 01-03-2008 03:25 PM
404 error with method 2 url ZoeB General Help 0 11-08-2007 05:38 PM
[SOLVED] Error: uncaught exception: Permission denied to call method XMLHttpRequest.o picklekicker Bug Report 13 09-30-2007 09:19 PM
Pligg 9.5 Beta: 500 Internal Server Error!!!! Genghis Bug Report 0 05-02-2007 03:10 AM
Got This Parse Error on c_ file on line 141 endph General Help 0 02-14-2007 06:44 PM


Search Engine Friendly URLs by vBSEO 3.2.0