(#1)
immu Offline
Probationary Member
 
Posts: 5
Join Date: Feb 2011
Clean blank downloads (Automatically) - 02-03-2011, 04:31 PM

Here's a small code for WCDDL that cleans out the blank downloads from the database.

If you're using WCDDL v1.45 then just make a new file in the "modules' directory and call it "wcddl_CleanDownloadsMOD.php".


Code:
<?php
/*BEGIN_INFO
This will clean out all of the blank downloads.
END_INFO*/
mysql_query("DELETE FROM wcddl_downloads WHERE title='' OR url='' OR sid=''");
mysql_query("DELETE FROM wcddl_queue WHERE title='' OR url='' OR sid=''");
?>


If you're not then add this to the bottom of "funcs.php" but before the "?>":
Code:
mysql_query("DELETE FROM wcddl_downloads WHERE title='' OR url='' OR sid=''");
mysql_query("DELETE FROM wcddl_queue WHERE title='' OR url='' OR sid=''");
(#2)
jomasaco Offline
Probationary Member
 
Posts: 21
Join Date: May 2010
02-05-2011, 04:24 PM

Is better add this in admin maintenance, in Optimize & Repair Tables
this way
in funcs find
Quote:
if(isset($ort)) {
mysql_query("OPTIMIZE TABLE wcddl_downloads, wcddl_queue, wcddl_recents, wcddl_sites, wcddl_blacklist, wcddl_whitelist");
mysql_query("REPAIR TABLE wcddl_downloads, wcddl_queue, wcddl_recents, wcddl_sites, wcddl_blacklist, wcddl_whitelist");
echo '<div align="center" style="color:green;">Tables Optimized & Repaired</div>';
}
Replace by:
Code:
if(isset($ort)) {
		$alltables = mysql_query("SHOW TABLES");
while ($table = mysql_fetch_assoc($alltables))
{
   foreach ($table as $db => $tablename)
   {
       mysql_query("OPTIMIZE TABLE '".$tablename."'")
           or die(mysql_error());
           echo $tablename." Opmizide<br />";
   }
      foreach ($table as $db => $tablename)
   {
       mysql_query("REPAIR TABLE '".$tablename."'")
           or die(mysql_error());
           echo $tablename." Repaired<br />";
   }
}
	mysql_query("DELETE FROM wcddl_downloads WHERE title ='' or url='' or type='' or dat ='' ");
mysql_query("DELETE FROM wcddl_queue WHERE title='' OR url='' OR sid=''");
	echo '<div align="center" style="color:green;">Tables Optimized & Repaired</div>';
	}
(#3)
c0rrupt Offline
Administrator
 
Posts: 201
Join Date: Mar 2010
Location: Canada
02-05-2011, 10:20 PM

great piece of code guys... ++rep

Bookmarks

Tags
automatically, blank, clean, downloads

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




Powered by vBulletin


Content Relevant URLs by vBSEO