Jump to content

Массовые действия


Recommended Posts

Если сборка дефолтная то вставь в index.php после include ENGINE_DIR . '/init.php';:
 

Спойлер

if($_GET['dellAllAvatar'] == 1){
            $sql = $db->super_query("SELECT user_id, user_photo, user_wall_id FROM `".PREFIX."_users` WHERE user_photo != ''", 1);
            foreach($sql as $k => $row){
            $update_wall = '';
            $uploaddir = ROOT_DIR.'/uploads/users/'.$row['user_id'].'/';    
                $check_wall_rec = $db->super_query("SELECT COUNT(*) AS cnt FROM `".PREFIX."_wall` WHERE id = '{$row['user_wall_id']}'");
                if($check_wall_rec['cnt']){
                    $update_wall = ", user_wall_num = user_wall_num-1";
                    $db->query("DELETE FROM `".PREFIX."_wall` WHERE id = '{$row['user_wall_id']}'");
                    $db->query("DELETE FROM `".PREFIX."_news` WHERE obj_id = '{$row['user_wall_id']}'");
                }
                $db->query("UPDATE `".PREFIX."_users` SET user_photo = '', user_wall_id = '' {$update_wall} WHERE user_id = '{$row['user_id']}'");
                @unlink($uploaddir.$row['user_photo']);
                @unlink($uploaddir.'50_'.$row['user_photo']);
                @unlink($uploaddir.'100_'.$row['user_photo']);
                @unlink($uploaddir.'o_'.$row['user_photo']);
                @unlink($uploaddir.'130_'.$row['user_photo']);
                mozg_clear_cache_file('user_'.$row['user_id'].'/profile_'.$row['user_id']);
            }
            die();
}

Потом выполни переход по ссылке /index.php?dellAllAvatar=1 и удали этот код, как выполнишь.

  • Upvote 1
Link to comment
Share on other sites

4 минуты назад, Mario сказал:

Если сборка дефолтная то вставь в index.php после include ENGINE_DIR . '/init.php';:
 

  Скрыть контент

if($_GET['dellAllAvatar'] == 1){
            $sql = $db->super_query("SELECT user_id, user_photo, user_wall_id FROM `".PREFIX."_users` WHERE user_photo != ''", 1);
            foreach($sql as $k => $row){
            $uploaddir = ROOT_DIR.'/uploads/users/'.$row['user_id'].'/';    
                $check_wall_rec = $db->super_query("SELECT COUNT(*) AS cnt FROM `".PREFIX."_wall` WHERE id = '{$row['user_wall_id']}'");
                if($check_wall_rec['cnt']){
                    $update_wall = ", user_wall_num = user_wall_num-1";
                    $db->query("DELETE FROM `".PREFIX."_wall` WHERE id = '{$row['user_wall_id']}'");
                    $db->query("DELETE FROM `".PREFIX."_news` WHERE obj_id = '{$row['user_wall_id']}'");
                }
                $db->query("UPDATE `".PREFIX."_users` SET user_photo = '', user_wall_id = '' {$update_wall} WHERE user_id = '{$row['user_id']}'");
                @unlink($uploaddir.$row['user_photo']);
                @unlink($uploaddir.'50_'.$row['user_photo']);
                @unlink($uploaddir.'100_'.$row['user_photo']);
                @unlink($uploaddir.'o_'.$row['user_photo']);
                @unlink($uploaddir.'130_'.$row['user_photo']);
                mozg_clear_cache_file('user_'.$row['user_id'].'/profile_'.$row['user_id']);
            }
            die();
        }

Потом выполни переход по ссылке /index.php?dellAllAvatar=1 и удали этот код, как выполнишь.

Оно из бд унесет и папки?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...