/* This is drupal2fs (Drupal-to-filesystem) program written by Andrey Vikt. Stolyarov in 2019--2023. The program extracts the content of a site served with Drupal and places the content into text files suitable for the Thalassa CMS. Please see below the explanation of limitations (very serious!) of the program. This code is hereby put by its author into public domain; no copyright is claimed and no restrictions are set here. For countries where such copyright disclaim is not legally possible, the permission is given to any party to use, modify and redistribute this program in any way. Please note however that so-called moral rights of the author (in contrast with property rights, which copyright is) remain in effect (forever, heh), so certain care must be taken. The author hereby gives to any interested parties the permission to modify this work in any way. Mentioning the author of the original work in any derived works is encouraged but is not necessary. However, in no circumstances a modified work as a whole may be attributed to the original author, and reasonable measures must be taken to make it clear that the work has been modified by someone else than the original author. You need to install MySQL or MariaDB development files to compile this program. E.g., with MariaDB it is compiled like this: gcc -Wall -g `mariadb_config --include` drupal2fs.c \ `mariadb_config --libs` -o drupal2fs *ANY* gcc version you can find around will do the job; well, this program compiles with gcc 3.*, just like all programs I write. It could even be ANSI C as I deliberately avoid all C99-isms, but, unfortunately, mariadb headers are not ANSI-C-friendly. Ladies and gentlemen, please don't expect much from this program. It was written in order to recover a particular site's content from a EOL version of Drupal which was running on a EOL version of the PHP interpreter, using a EOL version of MySQL (not even MariaDB). The Drupal in question was of version 5.*, and I'm nearly sure that the program will require a lot of modifications to make it work with any later Drupal versions; I'm just too lazy even to try it with later drupals, primarily because I will never need it for myself. Well, you see, I'll never ever again deploy any of my websites using Drupal or any other CMS written in any interpreted language and/or dependent on external DBMSes. So, if your version of Drupal is not 5.* (and this is HIGHLY likely, as 5.* was declared EOL in 2011), this program perhaps won't serve your needs right off; you can try to perform its adaptation on your own. Well, if you agree to pay me, perhaps I can try doing this for you, but, well, my time isn't cheap. Even if your installation of Drupal is of the 5.* version, please note this program ONLY recovers nodes, comments, aliases (these custom URIs Drupal allows you to set for nodes) and also some info for user accounts. The program does NOT get other things like blocks, themes, modules, all these site parameters like the whole site's name, slogan, motto, copyright notice and so on. Furthermore, perhaps you use custom input formats on your site. This program doesn't know how these formats are stored in the database, and how they are numbered in YOUR particular database. Please see the make_format_field function below. You'll have to change it to reflect YOUR format numbers; the version found below was built empirically for the formats used on MY site. This program served me perfectly, but I only had one site to process, and that's all: I've got absolutely no reason to try making this program any better than it now is, because I don't need it any longer. However, I just as well see no reason to keep this code private. If it helps someone around to recover their sites, at least serve as a start to make their own recovery tools, it's not bad in itself. So, well... good luck :-) Ahh, almost forgot: THERE IS NO WARRANTY FOR THIS PROGRAM, OF ANY KIND, EXPRESSED, IMPLIED, WHATEVER ELSE. ACTUALLY, IF YOU CAN NAME A KIND OF WARRANTY, THAT SOLE FACT MEANS YOU DON'T HAVE THE WARRANTY OF THAT KIND, AND EVEN IF YOU DON'T KNOW ABOUT WARRANTIES OF A PARTICULAR KIND, YOU DON'T HAVE THEM AS WELL. Actually, I'm almost sure the program will NOT work for you, so it would be somewhat stupid to expect any warranty here. */ /* The structure of SQL tables this program uses is as follows, may be this will help you a bit (I had to pick them manually from all the tables I couldn't use in any way) CREATE TABLE `comments` ( `cid` int(11) NOT NULL AUTO_INCREMENT,// id (global) `pid` int(11) NOT NULL DEFAULT '0', // parend cmt. id (0 for no parent) `nid` int(11) NOT NULL DEFAULT '0', // node id `uid` int(11) NOT NULL DEFAULT '0', // 0 is for anonymous `subject` varchar(64) NOT NULL DEFAULT '', `comment` longtext NOT NULL, `hostname` varchar(128) NOT NULL DEFAULT '', `timestamp` int(11) NOT NULL DEFAULT '0', `score` mediumint(9) NOT NULL DEFAULT '0', `status` tinyint(3) unsigned NOT NULL DEFAULT '0', `format` int(11) NOT NULL DEFAULT '0', // see below `thread` varchar(255) NOT NULL, // ?! '02/' `users` longtext, // ?! something like 'a:1:{i:0;i:0;}', any ideas? `name` varchar(60) DEFAULT NULL, `mail` varchar(64) DEFAULT NULL, `homepage` varchar(255) DEFAULT NULL, PRIMARY KEY (`cid`), KEY `lid` (`nid`) ) ENGINE=MyISAM AUTO_INCREMENT=2170 DEFAULT CHARSET=utf8; //////////////////////////////// // input formats as they were in MY database: // // 1: "Filtered HTML" tags, breaks, web // //