| Server IP : 84.32.84.0 / Your IP : 216.73.216.209 Web Server : LiteSpeed System : Linux in-mum-web1191.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64 User : u131919099 ( 131919099) PHP Version : 8.2.30 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/u131919099/ |
Upload File : |
ls
cd public_html/
ls
cd ..
cd domains/
ls
cd skyblue-rat-142693.hostingersite.com/
ls
cd public_html/
ls
ls -ls
tar -xvzf bdmbk.tgz
ls -l
mkdir backup
tar -xvzf bdmbk.tgz -C backup
ls
ll
cd public_html/
ll
cd wp-content/
ll
cd ..
ll
cd ..
ll
..
cd domains/
ll
cd white-moose-185824.hostingersite.com/
ll
cls
cleaar
clear
ll
cd public_html/
ll
cd wp-content/
ll
unzip uploads-new.zip
mv uploads-new/uploads/* uploads/
cls
clear
ll
cd uploads
ll
cd ..
cd uploads
cd ..
cd uploads-new
ll
rsync -av uploads-new/ uploads/
cd ..
rsync -av uploads-new/ uploads/
ll
find uploads -type d -exec chmod 755 {} \;
find uploads -type f -exec chmod 644 {} \;
ls uploads | head
rm -rf uploads-new
rm -f uploads-new.zip
ll
find wp-content/uploads -name "Amrit-india.png"
cd uploads/
ll
cd find wp-content/uploads
cd ..
find wp-content/uploads
cls
clear
find uploads -type f -iname "*Amrit*"
find uploads -name "Amrit-india.png"
clear
find uploads -name "Amrit-india.png"
find uploads -type f -iname "*amrit*"
clear
cd wp-content/uploads
cd ..
cd wp-content/uploads
clear
ll
cd uploads/
ll
rmdir uploads
ll
cd ..
rmdir uploads
clear
ll
cd ..
ll
import-media.php
ll
cd domains/
ll
cd white-moose-185824.hostingersite.com/
ll
cd public_html/
ll
wp --info
wp media regenerate --only-missing --yes
wp media regenerate --yes --debug
wp post list --post_type=post --meta_key=_thumbnail_id --format=ids > posts_with_fi.txt
wp eval '
$posts = get_posts([
"post_type" => "any",
"posts_per_page" => -1,
"meta_key" => "_thumbnail_id"
]);
foreach ($posts as $post) {
$thumb_id = get_post_thumbnail_id($post->ID);
if ($thumb_id && get_post($thumb_id)) {
delete_post_meta($post->ID, "_thumbnail_id");
update_post_meta($post->ID, "_thumbnail_id", $thumb_id);
clean_post_cache($post->ID);
}
}
echo "Featured images reattached.\n";
'
wp cache flush
wp transient delete --all
wp eval '
$posts = get_posts([
"post_type" => "any",
"posts_per_page" => -1,
"meta_key" => "_thumbnail_id"
]);
foreach ($posts as $post) {
$thumb_id = get_post_thumbnail_id($post->ID);
if (!$thumb_id) continue;
$attachment = get_post($thumb_id);
if (!$attachment) continue;
// If attachment is linked to Elementor library or wrong parent
if ($attachment->post_parent != $post->ID) {
wp_update_post([
"ID" => $thumb_id,
"post_parent" => $post->ID
]);
}
clean_post_cache($post->ID);
}
echo "Attachment parents fixed.\n";
'
wp cache flush
wp transient delete --all
wp eval '
$posts = get_posts([
"post_type" => "any",
"posts_per_page" => -1,
"meta_key" => "_thumbnail_id",
]);
$fixed = 0;
foreach ($posts as $post) {
$thumb_id = get_post_thumbnail_id($post->ID);
if (!$thumb_id) continue;
$attachment = get_post($thumb_id);
if (!$attachment) continue;
// Fix ONLY if attached to wrong parent (Elementor library etc.)
if ((int)$attachment->post_parent !== (int)$post->ID) {
wp_update_post([
"ID" => $thumb_id,
"post_parent"=> $post->ID,
]);
$fixed++;
}
}
echo "Fixed $fixed attachment parents\n";
'
wp eval '
$attachments = get_posts([
"post_type" => "attachment",
"posts_per_page" => -1,
]);
$fixed = 0;
foreach ($attachments as $att) {
if (
strpos($att->guid, "/uploads/elementor/screenshots/") !== false &&
$att->post_parent != 0
) {
wp_update_post([
"ID" => $att->ID,
"post_parent" => 0
]);
$fixed++;
}
}
echo "Detached $fixed Elementor screenshots\n";
'
wp cache flush
wp transient delete --all
wp eval '
require_once ABSPATH . "wp-admin/includes/image.php";
$posts = get_posts([
"post_type" => "any",
"posts_per_page" => -1,
"meta_key" => "_thumbnail_id",
]);
$fixed = 0;
foreach ($posts as $post) {
$thumb_id = get_post_thumbnail_id($post->ID);
if (!$thumb_id) continue;
$att = get_post($thumb_id);
if (!$att) continue;
// Only Elementor screenshots
if (strpos($att->guid, "/uploads/elementor/screenshots/") === false) continue;
$file = get_attached_file($att->ID);
if (!file_exists($file)) continue;
// Create NEW real attachment
$upload = wp_upload_bits(basename($file), null, file_get_contents($file));
if ($upload["error"]) continue;
$new_id = wp_insert_attachment([
"post_mime_type" => $att->post_mime_type,
"post_title" => $att->post_title,
"post_status" => "inherit",
], $upload["file"], $post->ID);
$meta = wp_generate_attachment_metadata($new_id, $upload["file"]);
wp_update_attachment_metadata($new_id, $meta);
set_post_thumbnail($post->ID, $new_id);
$fixed++;
}
echo "Converted $fixed Elementor screenshots into real featured images\n";
'
wp cache flush
wp transient delete --all
wp eval '
$posts = get_posts([
"post_type" => "any",
"posts_per_page" => -1,
"meta_key" => "_thumbnail_id",
]);
$fixed = 0;
foreach ($posts as $post) {
$thumb_id = get_post_thumbnail_id($post->ID);
if (!$thumb_id) continue;
$attachment = get_post($thumb_id);
// If attachment is missing or not an image, remove thumbnail meta
if (
!$attachment ||
$attachment->post_type !== "attachment" ||
!wp_attachment_is_image($thumb_id)
) {
delete_post_meta($post->ID, "_thumbnail_id");
$fixed++;
}
}
echo "Removed broken featured image references from $fixed posts\n";
'
wp cache flush
wp transient delete --all
clear
ll
cd domains/
cd white-moose-185824.hostingersite.com/
ll
cd public_html/
head -n 3 old_featured_images.csv
wp eval '
$csv = fopen("old_featured_images.csv", "r");
$header = fgetcsv($csv);
$restored = 0;
$skipped = 0;
while (($row = fgetcsv($csv)) !== false) {
[$old_post_id, $slug, $title, $old_thumb_id, $old_url] = $row;
// 1. Find post by slug (most reliable)
$post = get_page_by_path($slug, OBJECT, ["post","page"]);
if (!$post) {
// fallback: match by title
$posts = get_posts([
"post_type" => ["post","page"],
"title" => $title,
"posts_per_page" => 1
]);
if (!$posts) {
$skipped++;
continue;
}
$post = $posts[0];
}
// Skip if post already has a featured image
if (has_post_thumbnail($post->ID)) {
continue;
}
// 2. Match attachment by filename
$filename = basename(parse_url($old_url, PHP_URL_PATH));
$attachment_id = attachment_url_to_postid(
site_url("/wp-content/uploads/") . $filename
);
if (!$attachment_id) {
// fallback: search by filename
$attachments = get_posts([
"post_type" => "attachment",
"posts_per_page" => 1,
"s" => pathinfo($filename, PATHINFO_FILENAME),
]);
if (!$attachments) {
$skipped++;
continue;
}
$attachment_id = $attachments[0]->ID;
}
set_post_thumbnail($post->ID, $attachment_id);
$restored++;
}
fclose($csv);
echo "Restored featured images for $restored posts\n";
echo "Skipped $skipped posts (no safe match)\n";
'
wp cache flush
wp transient delete --all
wp eval '
$csv = fopen("old_featured_images.csv", "r");
$missing = fopen("missing_images.csv", "w");
fputcsv($missing, ["filename","old_url"]);
fgetcsv($csv); // header
while (($row = fgetcsv($csv)) !== false) {
[,,$,,$old_url] = array_pad($row, 5, null);
$filename = basename(parse_url($old_url, PHP_URL_PATH));
$found = attachment_url_to_postid(
site_url("/wp-content/uploads/") . $filename
);
if (!$found) {
fputcsv($missing, [$filename,$old_url]);
}
}
fclose($csv);
fclose($missing);
echo "Generated missing_images.csv\n";
'
Parse error: syntax error, unexpected token ",", expecting variable or "{" or "$" in phar:///usr/local/bin/wp-cli-2.12.0.phar/vendor/wp-cli/eval-command/src/Eval_Command.php(39) : eval()'d code on line 10
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
[u131919099@in-mum-web1191 public_html]$clear
clear
wp eval '
$csv = fopen("old_featured_images.csv", "r");
$missing = fopen("missing_images.csv", "w");
fputcsv($missing, ["filename","old_url"]);
fgetcsv($csv); // header
while (($row = fgetcsv($csv)) !== false) {
[,,$,,$old_url] = array_pad($row, 5, null);
$filename = basename(parse_url($old_url, PHP_URL_PATH));
$found = attachment_url_to_postid(
site_url("/wp-content/uploads/") . $filename
);
if (!$found) {
fputcsv($missing, [$filename,$old_url]);
}
}
fclose($csv);
fclose($missing);
echo "Generated missing_images.csv\n";
'
wp eval '
$csv = fopen("old_featured_images.csv", "r");
$missing = fopen("missing_images.csv", "w");
fputcsv($missing, ["filename","old_url"]);
// skip header
fgetcsv($csv);
while (($row = fgetcsv($csv)) !== false) {
$old_post_id = $row[0] ?? null;
$slug = $row[1] ?? null;
$title = $row[2] ?? null;
$old_thumb = $row[3] ?? null;
$old_url = $row[4] ?? null;
if (!$old_url) continue;
$filename = basename(parse_url($old_url, PHP_URL_PATH));
// try to find attachment by filename
$found = attachment_url_to_postid(
site_url("/wp-content/uploads/") . $filename
);
if (!$found) {
fputcsv($missing, [$filename, $old_url]);
}
}
fclose($csv);
fclose($missing);
echo "Generated missing_images.csv\n";
'
wp eval '
require_once ABSPATH . "wp-admin/includes/media.php";
require_once ABSPATH . "wp-admin/includes/file.php";
require_once ABSPATH . "wp-admin/includes/image.php";
$csv = fopen("missing_images.csv", "r");
fgetcsv($csv); // header
$imported = 0;
$failed = 0;
while (($row = fgetcsv($csv)) !== false) {
$filename = $row[0] ?? null;
$old_url = $row[1] ?? null;
if (!$old_url) {
$failed++;
continue;
}
// Try to find the post by slug from old_featured_images.csv
$map = fopen("old_featured_images.csv", "r");
fgetcsv($map);
while (($m = fgetcsv($map)) !== false) {
$slug = $m[1] ?? null;
$map_url = $m[4] ?? null;
if ($map_url === $old_url) {
$post = get_page_by_path($slug, OBJECT, ["post","page"]);
break;
}
}
fclose($map);
if (empty($post) || has_post_thumbnail($post->ID)) {
continue;
}
// Download image
$tmp = download_url($old_url);
if (is_wp_error($tmp)) {
$failed++;
continue;
}
$file_array = [
"name" => basename(parse_url($old_url, PHP_URL_PATH)),
"tmp_name"=> $tmp,
];
$attach_id = media_handle_sideload($file_array, $post->ID);
if (is_wp_error($attach_id)) {
@unlink($tmp);
$failed++;
continue;
}
set_post_thumbnail($post->ID, $attach_id);
$imported++;
}
fclose($csv);
echo "Imported and set featured images for $imported posts\n";
echo "Failed for $failed images\n";
'
wp cache flush
wp transient delete --all