Drupal

De gacq wiki
Revisión del 13:00 26 sep 2008 de Gacq (discusión | contribuciones) (Database error creating nodes)
Saltar a: navegación, buscar

Documentation


Errores

Database error creating nodes

Occurred running Drupal 6.4 using a database migrated from Drupal 5

The error:

# user warning: Duplicate entry '0' for key 2 query: INSERT INTO node (vid, type, language, title, uid, status, created, changed, comment, promote, moderate, sticky, tnid, translate) VALUES (0, 'page', 'es', 'eee', 1, 1, 1222437644, 1222437644, 2, 1, 0, 0, 0, 0) in /var/www/webapps/drupal6/includes/common.inc on line 3318.
# user warning: Duplicate entry '0' for key 1 query: INSERT INTO node_comment_statistics (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (0, 1222437644, NULL, 1, 0) in /var/www/webapps/drupal6/modules/comment/comment.module on line 607.

Apparently is produced by a problem during database upgrade, because auto_increment is not set for node_revisions table.

To fix

Obtain last node ID

SELECT max( nid ) FROM `node` 

And sum 1 to the number obtained from previous query and replace YOUR_NUMBER with it.

and run:

ALTER TABLE `node_revisions` ADD PRIMARY KEY ( `vid` )
ALTER TABLE `node_revisions` CHANGE `vid` `vid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT
ALTER TABLE `node` AUTO_INCREMENT=YOUR_NUMBER
ALTER TABLE `node_revisions` AUTO_INCREMENT=YOUR_NUMBER

Error en ejecucion de cron

From: root@otrasyerbas.com.ar (Cron Daemon)
To: www-data@otrasyerbas.com.ar
Subject: Cron <www-data@geacequ>          [ -x /usr/share/drupal/scripts/cron.sh ] && /usr/share/drupal/scripts/cron.sh

Fatal error: Call to undefined function:  mysql_connect() in /usr/share/drupal/includes/database.mysql.inc on line 31

El script del cron usa las extensiones de mysql de php4-cli que hay que habilitar editando /etc/php4/cli/php.ini y descomentando "extension=mysql.so"

Ejemplos Bloques

<?php
$uptime = shell_exec("cut -d. -f1 /proc/uptime");
$loadavg_array = explode(" ", exec("cat /proc/loadavg"));
$loadavg = $loadavg_array[2];
$days = floor($uptime/60/60/24);
$hours = $uptime/60/60%24;
$mins = $uptime/60%60;
$secs = $uptime%60;
echo "This server has been up $days day(s) $hours hour(s) $mins minute(s) and $secs second(s)";
echo "<p><br>";
print("[ Current server load: " . $loadavg . " ]");
?>