1 mariaespana Jan 16, 2011 12:58
3 mariaespana Jan 16, 2011 22:56
cool post, :) but I couldn't get it
does your knowledge of Evo core say that Evo will crash
if I only delete the post in
evo_items
using Heidi-SQL
kisses (K)(K)(K) :p
Maria 8|
4 sam2kb Jan 16, 2011 23:57
does your knowledge of Evo core say that Evo will crash
if I only delete the post in
evo_items
using Heidi-SQL
This may break your blog. Use the above code instead. Add it to admin.php:63 then open any admin page to run the code.
// Check global permission:
if( ! $current_User->check_perm( 'admin', 'any' ) )
{ // No permission to access admin...
require $adminskins_path.'_access_denied.main.php';
}
$foo = 123; // change to your first post id
$bar = 1234; // number of posts to delete
$crap_cache = & get_ItemCache();
++$bar;
while( $bar )
{
--$bar;
$crap = $crap_cache->get_by_ID( $foo + $bar );
$crap->dbdelete();
}
echo 'Crap removed';
5 mariaespana Jan 17, 2011 02:48
Thanx a lot, but do I understand corect that
$foo = 123; // I need to put the first _item's number that I want to delete
$bar = 1234;// I need to put the number of items I want to delete...
so in this case it would delete all evo_item form id 123 to (123+1234)=1357
any time I run the edited admin.php ???
So I have to remove it again, right?
But what do I do if the items to delete are not in a continuous number but have a category in common or I want to delete all posts with the status "Deprecated "??
Wouldn't it be clever to use "Visibility / Sharing" "Deprecated " as a delete marker and e.g the HeidiSQL Editor to setting all items to be removed as "Deprecated " by batch ?
and if this hack would instead of deleting from id xxx to Id yyy delete all "Deprecated "?
6 sam2kb Jan 17, 2011 03:05
Why do you want to keep 2000 posts slowing down your database when you can spend 3 minutes to delete them all?
If you want to delete all posts in a category that's easy as well. You should remove the script when you finish.
$main_category_ID = 123; // change to your category id
if( $rows = $DB->get_col('SELECT post_ID FROM T_items__item WHERE post_main_cat_ID = '.$main_category_ID) )
{
$crap_cache = & get_ItemCache();
$count = 0;
foreach( $rows as $post_ID )
{
$crap = $crap_cache->get_by_ID( $post_ID );
if( $crap->dbdelete() )
{
$count++;
}
}
$Messages->add("Deleted $count posts", 'success');
}
else
{
$Messages->add('Selected category is empty', 'error');
}
7 sam2kb Jan 17, 2011 03:08
Edit the query as you like. To delete all 'deprecated' use this.
SELECT post_ID FROM T_items__item WHERE post_status = "deprecated"
8 mariaespana Jan 17, 2011 03:15
eres un sol! besito!
I will try that and insert it at line 63 in admin.php!
You'd need to delete the entries in evo_post_cats as well ( or whatever it's called ... been ages since I bothered with evo core )
If it was me, I'd probably use evo to delete them so that it removed everything.
Free typed, but you get the idea.
¥