drupal

  • strict warning: Non-static method view::load() should not be called statically in /var/www/freeasinkittens.com/sites/all/modules/views/views.module on line 906.
  • strict warning: Declaration of views_handler_argument::init() should be compatible with views_handler::init(&$view, $options) in /var/www/freeasinkittens.com/sites/all/modules/views/handlers/views_handler_argument.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /var/www/freeasinkittens.com/sites/all/modules/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /var/www/freeasinkittens.com/sites/all/modules/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter_node_status::operator_form() should be compatible with views_handler_filter::operator_form(&$form, &$form_state) in /var/www/freeasinkittens.com/sites/all/modules/views/modules/node/views_handler_filter_node_status.inc on line 0.
  • strict warning: Non-static method view::load() should not be called statically in /var/www/freeasinkittens.com/sites/all/modules/views/views.module on line 906.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /var/www/freeasinkittens.com/sites/all/modules/views/plugins/views_plugin_style_default.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /var/www/freeasinkittens.com/sites/all/modules/views/plugins/views_plugin_row.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /var/www/freeasinkittens.com/sites/all/modules/views/plugins/views_plugin_row.inc on line 0.

Slash code to drupal conversion, finally done!

[[updated feb 17 to include info on redirecting old slashcode urls to the new drupal urls]]

Started as part of a workshop I did at the 3rd NYC Drupal Camp on converting to/from drupal, I have finally finished converting the Autonomedia/Interactivist Info Exchange site from slash to drupal. It will relaunch soon at http://info.interactivist.net

While it might have been somewhat more "correct" for me to have written a php script that bootstrapped drupal and then just grab the data and pass it through drupal's user and node api's, I was stubbornly determined to convert the site by only writing sql queries between the databases.

Part of my reasoning for doing this sql only was that converting thousands of nodes and users via the drupal api can take forever, where direct database manipulation is fast.

While I will write this up better later and post it to drupal.org, I wanted to get it up before I got distracted onto other tasks.

so, without further delay: here are the step by step notes I took as I went through the process.
[much thanks to Blake Carver of LIS News http://www.lisnews.org/ for the motivation to finish and the queries that populate the node and node revisions tables]

first step:
setup two databases; one for drupal one for slash
in this example they are
autono_slash and autono_drupal

install drupal

go to modules config page and make sure all the modules you need are on:
in my case I had to turn on
aggrigator
blog
path
poll
profile

----------------
TAXONOMY

Create taxonomy vocabularies for the topics and sections of slashcode

make note of the vid's for those vocabularies
in my case:
Section=1
Topic=2

In order to make tagging of old content easier at a later step, we add in a column to the term_data table here that we will delete at the end of the process

ALTER TABLE `term_data` ADD `oldid` VARCHAR(5) NULL;

Now we move over terms for Sections (vid1)

INSERT INTO autono_drupal.term_data (vid,name,oldid) SELECT "1",title,id from autono_slash.sections;

And the same for Topics (vid2)

INSERT INTO autono_drupal.term_data (vid,name,oldid) SELECT "2",alttext,tid from autono_slash.topics;

Next we set all terms at having no parent terms

INSERT INTO autono_drupal.term_hierarchy (tid,parent) SELECT tid,"0" from autono_drupal.term_data

At this point you can check in the taxonomy admin page to see that your terms have been moved over.

----------------
USERS

This is the simple part.

drupal uses uid 0 for anon, slashcode uses uid 1 for anon

so, the primary admin of a slashcode site is usually uid2

this allows you to setup your drupal site, create a primary admin (uid 1) and not have any problems moving over your user data (no collision of ids)

later we'll set content and comments that should be anon from uid 1 to uid 0.

INSERT INTO autono_drupal.users (uid,name,mail,pass,status) SELECT uid, nickname, realemail, passwd, "1" FROM autono_slash.users WHERE uid >1;

Set user roles

create new user roles manually in drupal. you might need more roles depending on the various seclev settings you are using in slashcode. for my use I need the following in addition to the standard drupal roles:
blog user
site admin
full admin

make note of the rid's for those roles
in my case:
blog user=3
site admin=4
full admin=5

for my site, I'm using those with slashcode seclev of 99 or higher = blog user, 200 or higher = site admin, 800 or higher = full admin

INSERT INTO autono_drupal.users_roles (uid,rid) SELECT uid,"3" from autono_slash.users where seclev > 99;

INSERT INTO autono_drupal.users_roles (uid,rid) SELECT uid,"4" from autono_slash.users where seclev > 200;

INSERT INTO autono_drupal.users_roles (uid,rid) SELECT uid,"5" from autono_slash.users where seclev > 800;

-------------------

CONTENT!

now we create a temporary table in the database that will be used to create all content.

it is a merger of the node table and the slash story table

CREATE TABLE autono_drupal.slash_content_convert (
nid int( 10 ) NOT NULL auto_increment,
sid varchar( 16 ),
tid smallint( 5 ),
newtid smallint(5),
uid mediumint( 8 ),
title varchar( 100 ),
dept varchar( 100 ) default NULL ,
time datetime,
hits mediumint( 8 ),
section varchar( 30 ),
discussion mediumint( 8 ),
submitter mediumint( 8 ),
day_published date,
last_update timestamp,
body_length mediumint( 8 ),
word_count mediumint( 8 ),
vid int( 10 ),
type varchar( 32 ),
status int( 4 ),
comment int( 2 ),
promote int( 2 ),
moderate int( 2 ),
sticky int( 2 ),
body longtext,
teaser longtext,
log longtext,
timestamp int( 11 ),
format int( 4 ),
PRIMARY KEY ( nid )
);

now we move over the content!
the main idea here is to move the stories over and get a nid/sid relationship created by the auto increment column

first standard slash "stories", the primary content type for slashcode become story nodes (note the type of "story" in the select/insert)

INSERT INTO autono_drupal.slash_content_convert (sid,tid,uid,title,time,section,discussion,submitter,day_published,last_update,teaser,body,type)
SELECT autono_slash.stories.sid,autono_slash.stories.tid,autono_slash.stories.uid,autono_slash.stories.title,autono_slash.stories.time,autono_slash.stories.section,autono_slash.stories.discussion,autono_slash.stories.submitter,autono_slash.stories.day_published,autono_slash.stories.last_update,autono_slash.story_text.introtext,autono_slash.story_text.bodytext,"story" from autono_slash.stories join autono_slash.story_text on autono_slash.stories.sid = autono_slash.story_text.sid;

next we move over the slashcode journals preparing it to become blog content.

INSERT INTO autono_drupal.slash_content_convert (tid,uid,title,time,discussion,body,type)
SELECT autono_slash.journals.tid,autono_slash.journals.uid,autono_slash.journals.description,autono_slash.journals.date,autono_slash.journals.discussion,autono_slash.journals_text.article, "blog" from autono_slash.journals join autono_slash.journals_text on autono_slash.journals.id = autono_slash.journals_text.id;

soon we'll come back to content and move things to the drupal node/revisions tables, but first we prepare comments in the same way as we did content

create a unified table combining critical elements of both schema, essentially this is a subset of the drupal comment table with the sid of slashcode. the important thing is that this will be used to combine journal "discussions" with story comments, as drupal does not make the same distinctions that slash does. (we will add name and email fields for comments after comments are converted to make the queries more simple to follow (fewer joins)

CREATE TABLE autono_drupal.slash_comment_convert (
cid int(11) NOT NULL auto_increment,
pid int(11),
nid int(11),
uid int(11),
subject varchar(64),
comment longtext,
timestamp int(11),
comment_date datetime,
format int(11),
thread varchar(255),
name varchar(60),
mail varchar(64),
discussion int(11),
oldcid int(11),
oldpid int(11),
PRIMARY KEY ( cid )
);

INSERT INTO autono_drupal.slash_comment_convert (uid,subject,comment,comment_date,oldcid,oldpid,discussion)
SELECT autono_slash.comments.uid,autono_slash.comments.subject,autono_slash.comment_text.comment,autono_slash.comments.date,autono_slash.comments.cid,autono_slash.comments.pid,autono_slash.comments.sid from autono_slash.comments join autono_slash.comment_text on autono_slash.comments.cid=autono_slash.comment_text.cid;

now... at this point in my work, I realize that we might just need to use the slashcode discussionID as nodeID to make it all easier; as well we might just need to keep the old cid and pid's as well.

so for that we alter the node and comment table
ALTER TABLE `node` CHANGE `nid` `nid` INT( 10 ) UNSIGNED NOT NULL
ALTER TABLE `comments` CHANGE `cid` `cid` INT( 11 ) NOT NULL

-------------------------------

clean up and sync of meta data (taxonomy, etc)

we need to set the newtid to the drupal term id instead of the slash topic id

update autono_drupal.slash_content_convert set newtid = (select tid from term_data where oldid=slash_content_convert.tid and vid=2);

next we need to map the slash section column with the drupal tid
mysql> select distinct section from slash_content_convert;
+---------------+
| section |
+---------------+
| articles |
| features |
| Events |
| BookReviews |
| news |
| the_new_war |
| analysis |
| announcements |
| books |
| |
| rnc |
| NULL |
+---------------+

+-----+-----+---------------------+-------------+--------+-------+
| tid | vid | name | description | weight | oldid |
+-----+-----+---------------------+-------------+--------+-------+
| 1 | 1 | Articles | NULL | 0 | 1 |
| 2 | 1 | Announcements | NULL | 0 | 2 |
| 3 | 1 | Events | NULL | 0 | 3 |
| 4 | 1 | All Sections | NULL | 0 | 4 |
| 5 | 1 | Analysis & Polemic | NULL | 0 | 5 |
| 6 | 1 | Reviews | NULL | 0 | 6 |
| 7 | 1 | News | NULL | 0 | 7 |
| 8 | 1 | At the Brink | NULL | 0 | 8 |
| 9 | 1 | Books | NULL | 0 | 9 |
| 10 | 1 | Index | NULL | 0 | 10 |
| 11 | 1 | RNC 2004 | NULL | 0 | 11 |

update autono_drupal.slash_content_convert set section=1 where section="articles";
update autono_drupal.slash_content_convert set section=2 where section="announcements";
update autono_drupal.slash_content_convert set section=3 where section="Events";
update autono_drupal.slash_content_convert set section=1 where section="";
update autono_drupal.slash_content_convert set section=5 where section="analysis";
update autono_drupal.slash_content_convert set section=6 where section="BookReviews";
update autono_drupal.slash_content_convert set section=7 where section="news";
update autono_drupal.slash_content_convert set section=8 where section="the_new_war";
update autono_drupal.slash_content_convert set section=9 where section="books";
update autono_drupal.slash_content_convert set section=1 where section is NULL;
update autono_drupal.slash_content_convert set section=11 where section="rnc";

--
move all comments and content tagged as uid1 to uid0

update slash_comment_convert set uid=0 where uid=1;
update slash_content_convert set uid=0 where uid=1;

turns out that some journal entries don't have discussion id's. so to fix this and make sure I did not use a nid already in use

update slash_content_convert set discussion=(nid+5000) where discussion is NULL;

move nodes to node table and revisions table

insert into node (nid,vid,type,title,uid,status,created,changed,comment,promote,moderate,sticky) SELECT
autono_drupal.slash_content_convert.discussion,
autono_drupal.slash_content_convert.discussion,
autono_drupal.slash_content_convert.type,
autono_drupal.slash_content_convert.title,
autono_drupal.slash_content_convert.uid,"1",
UNIX_TIMESTAMP(slash_content_convert.time),
UNIX_TIMESTAMP(slash_content_convert.time),
"2","0","0","0" from slash_content_convert;

insert into node_revisions (nid,vid,uid,title,body,teaser,log,timestamp,format) SELECT
autono_drupal.slash_content_convert.discussion,
autono_drupal.slash_content_convert.discussion,
autono_drupal.slash_content_convert.uid,
autono_drupal.slash_content_convert.title,
concat(autono_drupal.slash_content_convert.teaser,autono_drupal.slash_content_convert.body),
autono_drupal.slash_content_convert.teaser,
"Imported From Slashcode",
UNIX_TIMESTAMP(slash_content_convert.time),
"1" from slash_content_convert;

move comments to comments table

insert into comments (cid,pid,nid,uid,subject,comment,timestamp,status,format,thread) SELECT oldcid,oldpid,discussion,uid,subject,comment,UNIX_TIMESTAMP(slash_comment_convert.comment_date),0,1,'01/' from slash_comment_convert;

update node_revisions set teaser = body where teaser ="";

set taxonomy terms for nodes based on section and tid

insert into term_node (nid,tid) select discussion,tid from slash_content_convert;

insert into term_node (nid,tid) select discussion,section from slash_content_convert;

some nodes came over with out body copy

update node_revisions set body = teaser where body ="";

reset nid and cid as auto_increment

set sequences, for no real logical reason I wanted to add 10 to the highest node/comment/user id when I set the sequences table.

update sequences set id=(select uid from users order by uid desc limit 1)+10 where name="users_uid";

update sequences set id=(select nid from node order by nid desc limit 1)+10 where name="node_nid";

update sequences set id=(select vid from node_revisions order by vid desc limit 1)+10 where name="node_revisions_vid";

and with that, we're done

I still have some more modules to put in.

I could put in userpoints and move over old user's karma

I should put in captcha and recaptcha for preventing spam

I need to put in the event module and start using event nodes instead of stories for the events section.

[UPDATE]

i screwed something up, so I had to do the following to get the blog content in the node_revisions table

UPDATE node_revisions LEFT JOIN slash_content_convert ON node_revisions.nid=slash_content_convert.discussion SET node_revisions.body= slash_content_convert.body WHERE slash_content_convert.type="blog";

UPDATE node_revisions LEFT JOIN slash_content_convert ON node_revisions.nid=slash_content_convert.discussion SET node_revisions.teaser= slash_content_convert.body WHERE slash_content_convert.type="blog";

then I realized I did not move over the account creation date and last access dates. this confused the initial test users so I added it in

update autono_drupal.users left join autono_slash.users_info on autono_drupal.users.uid=autono_slash.users_info.uid set autono_drupal.users.created = UNIX_TIMESTAMP(autono_slash.users_info.created_at);

---

ok, now it's time to launch the site and get the old slash urls redirecting to new urls

make a table for this in the drupal db
CREATE TABLE `slash_redirects` (
`sid` VARCHAR( 36 ) NOT NULL ,
`nid` SMALLINT NOT NULL ,
PRIMARY KEY ( `sid` )
) TYPE = MYISAM ;

then populate that from the slash_content_convert table
insert into slash_redirects (sid,nid) select sid,discussion from slash_content_convert where sid !="";

now, we need to write a simple perl script to handle taking calls to article.pl, parsing out the sid and sending a 301 redirect to the browser. this hopefully will keep the damage to search engine listings to a minimum and preserve people's bookmarks to specific old content

here is my article.pl script

#!/usr/bin/perl -w
use strict;
use CGI;
use DBI;
my $query = CGI->new();
my $sid=$query->param('sid');
my $nidquery='SELECT nid FROM slash_redirects WHERE sid ="'.$sid.'"';
my %varinfo = do 'hide/vars.txt';
my $dsn = "dbi:mysql:$varinfo{sqldbname}:localhost:3306";
my $dbh = DBI->connect($dsn, $varinfo{sqldbuser}, $varinfo{sqldbpass});
my $sth= $dbh->prepare($nidquery);
$sth->execute();
my $nid;
my @nidresult=$sth->fetchrow_array();
my $nodetogoto="http://info.interactivist.net/node/".@nidresult[0];
$sth->finish();
$dbh->disconnect();
my $q = CGI->new();
print $q->redirect(
-location => $nodetogoto,
-status => 301,
);

-----
the script calls in db user/pass info from an external file that is protected from download/access by .htaccess

the var file is in the following format

sqldbserver => 'mysql',
sqldbname => 'database_name',
sqldbuser => 'database_user',
sqldbpass => 'db_password',
sqldbhost => 'localhost',

-----

Nice conversion

I understand how much trouble that probably was and why you did it.

I came across this article searching for some unrelated drupal answers.

nice to hear from you simon

thanks for the compliment (and it is good to hear from you again)

Sorry for a dumb question,

Sorry for a dumb question, but I really can't get, what SELECT is?...

I seem to be having some

I seem to be having some trouble with the article.pl script

details?

post some details and I'll help you out. what's the exact error you are seeing in the browser, and are there any errors in the apache logs?

Thanks for sharing your knowledge

Thanks for sharing your knowledge dude ! It works well for me !

Any thoughts/advice one year later?

I need to launch a site that works like Slashdot, but just the thought of using Slashcode & Perl is intimidating, so had been looking unsuccessfully for a Drupal-based site and came across your site

Just curious if, one year later, you'd do anything differently? Is there a way to get Slashcode functionality without having to install Slashcode?

Thanks in advance, and thank you for the notes!

it depends on what features are most critical to you

even though I don't get to use it often anymore, I still love perl. The more I use php, the less I like it and the more I want to go back to perl.

But, I could never go back to using slashcode.

You can get most, if not all, of the features of slashcode with any number of different Free Software tools these days. I am really happy with Drupal, the size of and activity of the community makes up for my hate of php. I've used bricolage for some projects and want to look more at joomla and cms made simple.

I'd suggest you write up a detailed list of functionality that you want and do a comparison of drupal, joomla, bricolage, cms made simple, and even plone. Each has strengths.

It's a shame that slashcode abandoned any idea of community in favor of exclusively developing for slashdot.org sometime back in 2002 or so. It could be where Drupal is now if they had taken a different path. Think about it: before anyone used the word Blog, there was the journal feature of slashcode; before anyone friendstered or facebooked, slashcode had a friends/foes system. But without a community to use it and move it forward, it stagnated and is, in my opinion, dead as anything other than the tool that runs slashdot.org

To directly answer your question: A year later, I think I made the right choice. The few things I gave up are far overshadowed by the strength of drupal as a tool and a community.

Now that is what I call an

Now that is what I call an excellent post, thanks...

Yes very good post, I agree

Yes very good post, I agree .

Josh

great work and thanks

It is great to see a lot of people supporting drupal, no wonder it is getting more popular from time to time.
Great work and keep it up.

great site! I'm so glad I

great site! I'm so glad I came across it. so many wonderful pieces of advice! exactly what a new person in this stuff like I need:) have used to find great blogs with useful pieces of information by torrents.rapid4me.com search engine, but always search for smth more. I really liked what your tutoial has to offer. Hopefully one day I will be in the possition to do stuff with drupal without looking up tutorials every step of the way. thanks!

thanks for the code,

thanks for the code, bookmarked

Hopefully one day I will be

Hopefully one day I will be in the possition to do stuff with drupal without looking up tutorials every step of the way. thanks!
Regards

Very nice step by step

Very nice step by step walkthrough, I'm installing slashcode in a new site, and doing some test.

Nice code

Thanks for the code. It is so helpful to me.

Drupal Development for Community Media Centers

Jul 10 2008 1:30 pm
Jul 10 2008 3:00 pm

Usually, I post these before the presentation, not the day after, but this happened last minute.

Brian and Tony from Denver Open Media were going to be in DC at the Alliance for Community Media conference and wanted to talk to some openflows folks about collaborating on the (soon to be renamed) pegspace project. Jason was organizing a panel (that included Tony and Emily) on public access centers and their use of drupal. Emily suggested that Mark and I present the work that the Openflows Community Technology Lab has been doing for Manhattan Neighborhood Network, which will form the foundation of the Free Software collaboration soon to not be known as pegspace

So, with little notice Mark and I took a round trip bus trip to Washington DC via the chinatown bus.

I think that those of us on the panel enjoyed seeing each other's work more than presenting their own. We had much more fun than the the audience, and judging from the questions after the audience had a good time.

Location

Omni Shorham Hotel Washington DC, DC
United States

What I'm blocking this week

A little follow-up on my earlier post about using ad block plus to keep google analytics from violating your privacy :

Here are the filters that I've added in this past week:

*.hitbox.com/*
drupal.org/files/hbx/hbx.js

These two were added to avoid the nasty slowdown and privacy violations recently instituted on the drupal.org site. It seems that the Drupal Association is doing a study of site usage, and decided to use a (donated license) proprietary system that works via complex javascript on the client side instead of a Free Software system that would use server logs. Oh well, I guess they won't learn anything from my use of the site as I am now invisible to the system in use.

Actually, given that the users of the site tend to be rather technologically savvy, I'd bet that the majority of users of the site are blocking the javascript and therefor the information generated by the expensive system will be rather useless. shrug.

I also added the following, but I can't remember what site prompted me to do so.
*.statcounter.com/counter/counter_xhtml.js
s1.amazon.com/exec/*

Nice

I didn't bother on your last post but this morning, while listening to the news about Yahoo and thinking that maybe I'd write a wee blog post about how trusting capitalists is like trusting a tiger. Meaning that we have no idea what will set them off and sure some will lie purring in your lap for decades but that doesn't mean you know the first thing about tigers. So I thought that and then went to work and I think that what is next is that I'll go ahead and install adblock plus.

a bit of a tangent, but

the entire reason opensource/free software/GNU/ the GPL etc exists is, as you point out, capitalists can't be trusted.

Software was assumed free, put in the public domain. Corporations saw code in the public domain that was useful and stole it. Legally they were allowed to take it out of the public domain and put it under their copyright. The GPL exists to prevent that from happening. It's the answer to the question of how to write code that is available to everyone in a way that can't be stolen by by anyone. (however this does not prevent capitalists from manipulating the communities that produce Free Software, that requires transparency and clear definition of process)

Filestore2 files recovered

Finally after being lost in limbo since upgrading to drupal 5, I've managed to recover the old files uploaded to the radicalreference.info website.

Drupal is a great tool, but I've learned the hard way that you really have to be careful what contributed modules you rely on. 4 years ago when I first built the radicalreference.info site in drupal 4.5, I decided to use a module that was not long for this world. after upgrading from 4.5 to 4.6 (where filestore became filestore2) and then to 4.7, the filestore2 and fscache modules ceased development. This left us with a ton of data that was not accessible (ok not a ton, but 77 nodes/files from the early days of the project).

At last weekend's NYC Drupal Camp #5, Joe Golden and I started working on a perl script that would recover the files and move the nodes from filestore2 to standard drupal page nodes with file attachments.

What follows is the end result, it's also attached to this post if you want to download it and use it.

Thanks Joe for the motivation to finally get this task out of the way!

#!/usr/bin/perl
#
#
# This is for converting filestore2 nodes/files into attachments to page nodes
#
# Use at your own risk
#
# written to recover files for the RadicalReference.info website
# by Joe Golden and Eric Goldhagen
# code licensed under:
# GNU GENERAL PUBLIC LICENSE
# Version 2, June 1991

# connect to database and format results
use DBI;
#DATA SOURCE NAME
my $dsn = "dbi:mysql:databasename:localhost:3306";
# PERL DBI CONNECT
my $dbh = DBI->connect($dsn, "username", "password");
#initialize various variables
my $number_changed="0";
my $starting_revision="0";
my $starting_revisions="";
my $howmanyfiles="0";

#directories relative to location of this script
#set the path to fscache directories
my $oldpath="misc/fscache/fscache/";
#set path to dir drupal uploads files to now
my $newpath="documents/";

#get starting number for fid
my $starting_fids="";
my $starting_fid="";
$sth=$dbh->prepare("select id from sequences where name='files_fid'");
$sth->execute();
$starting_fids=$sth->fetchrow_hashref();
$starting_fid=$starting_fids->{'id'};
$starting_fid=$starting_fid+1;

#select information to be used in moving files
print $starting_revision."--start at\n\n";
$sth2= $dbh->prepare("select filestore2.nid, fscache.filename, fscache.cachename, fscache.mimetype, fscache.size from filestore2 join fscache on filestore2.fsid = fscache.fsid");
$sth2->execute();
#loop through results
while (@data = $sth2->fetchrow_array()) {

my $filename, $path_stored, $realpath;

my $nid=$data[0];
my $file=$data[1];
my $cachename=$data[2];
my $filemime=$data[3];
my $filesize=$data[4];

$filename = $file;
$path_stored = $cachename;
if ( $path_stored =~ /(..)(..)(....)/ ){
$realpath = $oldpath.$1."/".$2."/".$path_stored;
# print "real path is $realpath\n";
} else {
print "badd pattern". $nid."\n";
}
my $cleanfilename = $filename;
$cleanfilename =~ s/ /\\ /go;
my $filemover= "cp ".$realpath." ".$newpath.$cleanfilename;
my $newfilepath=$newpath.$filename;
print "file: ".$realpath." moved to ".$newpath.$filename."\n";
`$filemover`;

#increment the counter for files
$howmanyfiles=$howmanyfiles+1;

#db query to insert a new file attachment
#for the right node
my $constructed_statement ='insert into files (fid,nid,filename,filepath,filemime,filesize) values ('.$starting_fid.','.$nid.',"'.$filename.'","'.$newfilepath.'","'.$filemime.'","'.$filesize.'")';
$sth = $dbh->prepare($constructed_statement);
$sth->execute();

#db query for update of file_revision

#need vid of node for vid here
my $nodevids="";
my $nodevid="";

my $nodevidstatement="select vid from node where nid=".$nid;
$sth=$dbh->prepare($nodevidstatement);
$sth->execute();
$nodevids=$sth->fetchrow_hashref();
$nodevid=$nodevids->{'vid'};

my $constructed_statement='insert into file_revisions (fid,vid,description,list) values ('.$starting_fid.','.$nodevid.',"",1)';
$sth=$dbh->prepare($constructed_statement);
print $constructed_statement."\n";
$sth->execute();

print "attached to node:". $nid." revision:".$nodevid."\n\n";

#increment the fid
$starting_fid=$starting_fid+1;
}

#db query change info for node type after we're done moving everything
$sth=$dbh->prepare('update node set type="page" where type="filestore2"');
$sth->execute();

#insert our new node fid into sequence table

my $constructed_statement='UPDATE sequences set id='.$starting_fid.' where name="files_fid"';
$sth=$dbh->prepare($constructed_statement);

print "-----------------------------------\n";
print "final fid is ".$starting_fid."\n";
$sth->execute();
print $howmanyfiles." files converted\n\n";
print "please check the output above for any errors that might have happened\n\n";

DBI->disconnect_all();
exit;

Thank you!

Hi Eric - I can't believe you just posted this. I am in the process of upgrading a client from Drupal 4.6 -> 6 and just realized that we have a big issue with converting from filestore2. Your script seems to be the solution. I'll give it a try and let you know how it goes. Thank you!

let me know how it goes!

good luck, let me know if anything is confusing or needs better documentation. Note that the script is written explicitly against the mysql database schema for drupal 5, so run it when you are at that point of the upgrade.

Worked

Hi,

Just to let you know, I finally made the time to get back to this upgrade and your script worked perfectly. Thanks for pointing out that it needed to run against Drupal 5, as I was originally planning on running it at 4.7.

Thanks again!
-Courtney

Filestore2 files recovered

Hi,

Your post has helped me to recover my old files. Thanks for the script.

Drupalcamp, How to and Q & A

Mar 6 2009 3:00 pm
Mar 6 2009 4:00 pm

Curious what it takes to run a Drupalcamp? Drupalcamp organizers from the U.S, Europe and around are gathering to discuss what it takes to run a drupalcamp as well as tips, tricks and best practices. We'll cover topics such as costs, venue choices, and how to find your audience. You'll leave this session with the knowledge and tools to hold a successful Drupalcamp.

Presented by:
Eric Goldhagen
Jacob Redding
Crystal Williams
Greg Knaddison
Chris Charlton
Blake Hall

Location

Washington DC Convention Center DC
United States

Radical Reference, Free Software Use in Librarianship

Apr 28 2009 4:30 pm
Apr 28 2009 5:20 pm

Radical Reference is an online reference service provided by volunteer library workers in a collaborative virtual setting using free/open source technology. Come learn more about how you can use this model to deliver services in your own communities (social, political, familial, spiritual, etc.). Presenters will share the five year history of the group and discuss how it collaborates, as well as give an accessible history of free/open source software.

Location

Ocean Place Resort & Spa Long Branch, NJ
United States

Drupal Fundamentals: An Intermediate Hands-On Workshop

Jul 7 2010 10:00 am

I'll be leading a two day Drupal training on July 7th and 14th thanks to the folks at the Metropolitian New York Library Council. Here's the description from their Summer 2010 catalog: Drupal has fast become one of the most popular, stable, and internationally-supported open source Content Management Systems for websites small and large.

Through four discrete modules delivered over two days, participants will receive training on the fundamental concepts, terminology, and skills needed to install, configure, and maintain a simple website using Drupal.

NOTE: Participants are not expected to have a foundation in PHP or database work. All work will be done via the Drupal administrative interface; no writing of PHP code will be necessary, although some code snippets will be discussed, explained and used as part of the exercises. This workshop is intended for those with some familiarity with Drupal, but no previous site creation or management is presumed.

By the end of this program, participants will:

  • Install an instance of Drupal for experimentation and further learning
  • Develop a basic understanding of Drupal concepts and terminology, permissions, users, and role settings
  • Learn how to set up and configure a Drupal website with contributed modules
  • Use Drupal’s administrative interface to create and manipulate “content types,”
  • Display content in customized ways using the “views” module
  • Automate simple tasks using the “Rules” module
  • Learn how to evaluate existing Drupal modules when deciding what to use for specific tasks in the future

Location

METRO
57 E. 11th Street, New York, NY 10003
United States
40° 43' 59.3652" N, 73° 59' 32.4492" W

not dead yet

The "rock star" meme in the drupal community drives me insane, but I seem to be in the minority on that. To me, rock stars (in the music world) tend to be the least talented, they tend to be splashy and lack substance, but if anyone in the drupal community deserves start staus, webchick is certainly among them.

Tonight was the NYC stop on webchick's world tour. Webchick, aka Angie Byron, is the lead on the 7.x release of Drupal. The leadership she's shown in the drupal community is really impressive. She's traveling around doing training sessions and some folks in the community used her NYC visit as an excuse to have a party.

It's really nice to be able to debate, even strongly disagree, with people in the NYC Drupal community one day and then the next night be able to be able to sit around with many of those folks, have a beer and have the discussions be full of respect and finding common ground.

I'm still concerned about some of the changes in drupal and the community, but I'm happy to say it's not dead yet.

---
today's photo is of an entrance to one of NYC's oldest subway stations which also now is home to a subway sandwich shop.

Whenever people talk about

Whenever people talk about rockstars as a tech metaphor, I find myself imagining some dude in black leather pants, reclining on a chaise lounge complaining about the volume of bubbles in his mineral water. I also picture sinks piled with encrusted dishes.

DrupalCamp NYC #9!

Number 9, yes, folks... the 9th NYC DrupalCamp is happening at the end of the month. Once again, we're using the unconference format. Everyone that shows up will have a voice in how the day is organized. While there are folks that don't get it, using the term "camp" in most free software communities is synonymous with unconference -- that's what is so special about these events.

The unconference format reflects the ideals and community-centric nature of the software being discussed.

Registration will open on thursday, keep your eyes on http://groups.drupal.org/node/141719 the nyc drupal group for more details (and for what might turn into an interesting debate about the gentrification of the drupal community and those that feel the right to appropriate terms and change their meaning to make themselves feel better).

I'll expand on this theme soon, but for now I'm just too tired.

a wonderful drupal honor

At today's 10th NYC DrupalCamp, Ben Melancon gave me a copy of his new book, The Definitive Guide to Drupal 7. That would have been honor enough, but when I got home and saw how he signed it, I felt so honored I'm without words