Visualizzazione risultati 1 fino 3 di 3

Discussione: ARticoli che si cancellano in parte da soli

  1. #1
    Guest

    Exclamation ARticoli che si cancellano in parte da soli

    Salve a tutti, ho un problema molto grave.
    Pubblicando qualche articolo ho notato che massimo il giorno seguente l'80%del contenuto dell'articolo scompare.

    Articoli con 200/300 parole ridotti ad una sessantina.

    Questo è il link:
    http://edsoft.altervista.org/itastream/

    Potete aiutarmi a capire cosa causa questo problema?

    Ho controllato ora ed anche sul sito principale ho lo stesso problema:
    http://edsoft.altervista.org/


    Non sò proprio cosa fare
    Ultima modifica di emindemiri : 15-06-2015 alle ore 01.30.35

  2. #2
    karl94 non è connesso Staff AV
    Data registrazione
    03-10-2005
    Messaggi
    17,744

    Predefinito

    Se vai a modificare l'articolo, nell'editor c'è tutto? È comunque probabile che ci sia qualche plugin che crea problemi, quali sono quelli che usi su entrambi i blog?

  3. #3
    Guest

    Predefinito

    Credo di aver capito cosa ha causato il problema, per lo meno credo.

    Ogni tanto lancio questo script per pulire gli articoli dalle lettere accentate sbagliate di www.edsoft.altervista.org/anarcosocial


    Questo è il codice dello script:
    Codice:
    <?php
        error_reporting(E_ALL);
        ini_set('display_errors', 1);
    
        /**
        * @var string Target encoding
        */
        $new_encoding = 'UTF-8';
    
        /**
        * @var string New collation for the table
        */
        $new_mysql_collation = 'utf8_general_ci';
    
        /**
        * @var string New character set for the table
        */
        $new_mysql_encoding = 'utf8';
    
        /**
        * You would set this switch to true if you have used this script before
        * and Your titles contain invalid non-ascii charactes like "für"
        * Your database entries are utf-8 encoded and need to be decoded, not converted.
        *
        * @var bool UTF-8 decode your content instead
        */
        $decode = true;
    
        require_once '../wp-config.php';
    
        // Connect
        $DBC = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
        mysql_select_db(DB_NAME, $DBC);
    
        $result = mysql_query('SHOW TABLES FROM ' . DB_NAME, $DBC);
    
        echo '<pre>';
        echo 'Mode is <strong>' . (($decode) ? 'decode' : 'convert') . "</strong>\n";
        echo 'New encoding is <strong>' . $new_encoding . "</strong>\n";
        echo 'New encoding for mysql is <strong>' . $new_mysql_encoding . "</strong>\n";
        echo 'New collation for mysql is <strong>' . $new_mysql_collation . "</strong>\n";
        while ($row = mysql_fetch_row($result)) {
            // Skip Non-WP tables
            if (!empty($table_prefix) && substr($row[0], 0, strlen($table_prefix)) != $table_prefix ) continue;
            // Convert the tables encoding
            $sql = 'ALTER TABLE ' . ek($row[0]) . ' DEFAULT CHARACTER SET ' .  $new_mysql_encoding . ' COLLATE ' . $new_mysql_collation;
            mysql_query($sql);
            // Convert the fields
            $sql = 'SHOW CREATE TABLE ' . ek($row[0]);
            $result2 = mysql_query($sql);
            $table_sql = mysql_fetch_assoc($result2);
            foreach (explode("\n", $table_sql['Create Table']) as $line) {
                $line = trim($line);
                if (!preg_match('/ character set ([^ ]+)/', $line, $match_cs)) continue;
                $line = preg_replace('/collate [0-9a-z_]+/i', '', $line); // Remove old collate
                preg_match('/^`[^`]+`/', $line, $match_field);
                $sql = 'ALTER TABLE ' . ek($row[0])
                . ' CHANGE ' . $match_field[0] . ' '
                . str_replace($match_cs[0], ' character set ' . $new_mysql_encoding . ' COLLATE ' .  $new_mysql_collation, substr($line, 0, -1));
                mysql_query($sql);
            }
            // Convert its data
            $result_data = mysql_query('SELECT * FROM ' . $row[0]);
            echo $row[0] . ' ';
            while ($data = mysql_fetch_assoc($result_data)) {
                $sql = 'UPDATE ' . $row[0];
                // Build set
                $set = array();
                foreach ($data as $key => $val) {
                    if ($decode) {
                        $set[] = ek($key) . '=' . ev(utf8_decode($data[$key]));
                    } else {
                        $set[] = ek($key) . '=' . ev(mb_convert_encoding($data[$key], $new_encoding));
                    }
                }
                $sql .= ' SET ' . join(', ', $set);
                // Build where
                $where = array();
                foreach ($data as $key => $val) {
                    if (!preg_match('/^[0-9]+$/', $val)) continue; // Use only numbers in where
                    $where[] = ek($key) . '=' . ev($data[$key]);
                }
                if (empty($where)) continue 2; // Table has no numeric fields, skip it
                $sql .= ' WHERE ' . join(' AND ', $where);
                $query_result = mysql_query($sql, $DBC);
                if (!$query_result) {
                    die( 'Query failed: ' . $sql . ' (' . mysql_error() . ')' );
                }
                echo '.';
                flush();
            }
            echo "\n";
        }
        echo "All done.\n";
        echo '<span style="color: #ff0000;">Remember to remove this script!</span>' . "\n";
        echo '</pre>';
    
        // Disconnect
        mysql_close($DBC);
    
        function ek($string)
        {
            global $DBC;
            return "`" . mysql_real_escape_string($string, $DBC) . "`";
        }
    
        function ev($string)
        {
            global $DBC;
            return "'" . mysql_real_escape_string($string, $DBC) . "'";
        }
    
    ?>

    Se è colpa di questo script cosa posso modificare per continuare a pulire gli articoli senza eliminarne altri?

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •