(Tips) Use MySQL to double the nodes in your Drupal database

DRUPALRANCH Newsletter:

Tips : Use MySQL to double the nodes in your Drupal database

Now as a shell script. You may have to update the MySQL user in the script. A file version of the script is attached. Download it, make it executable with chmod +x ./doublenodes, and then run it with ./doublenodes databasename

#!/bin/sh

mysql -u root -p -e "
INSERT INTO node (nid, vid) VALUES (NULL, -1);
SET @nid:= (SELECT MAX(nid) FROM node);
DELETE FROM node WHERE nid=@nid;
INSERT INTO node_revision (nid, vid) VALUES (@nid, '');
SET @vid:= (SELECT MAX(vid) FROM node_revision);
DELETE FROM node_revision WHERE vid=@vid;
INSERT INTO node
SELECT
NULL, @vid:=@vid+1,
type, language, title, uid, status, created, changed, comment, promote,
moderate, sticky, tnid, translate
FROM node;
INSERT INTO node_revision
SELECT
@nid:=@nid+1, NULL,
uid, title, body, teaser, log, timestamp, format
FROM node_revision;" $1

Read More..

Courtesy:- robshouse.net



Tag Cloud