As discussed on IRC, I have moved the welcome text into node 0 as a PHP node. Although there is a check for whether this welcome node is present for every node_page_default call, it is only a variable_get, so it is cheap. Also at every node save we check for the same variable, and if the welcome node is present, it gets silently deleted. So, as soon as the first node gets created, the welcome text disappears as it should.

The one liner in node_validate is very important when a node with nid=0 is present. Otherwise, consider it a minor speedup.

This patch should have a little positive effect on the memory requirements of node.module -- a long, rarely used text is removed.

This is not a new feature but a usability issue so let's get it into 4.6. Although there is change (two INSERTs) to database.mysql and database.pgsql it does not mandate an update.inc change 'cos most probably noone will bother with updating an empty site.

I payed special attention to spaces this time.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

We discussed this patch with Steven and killes and they do not like the code in node_save. Well, only a variable_get get's executed, so I do not see that as big a problem as it is. If we do not like it, the code can be removed, the wording changed (Steven's suggestion): "This message will guide you through your first steps with Drupal and can be removed through the administrative interface." However, in this case I'd fancy putting a check in node_delete to see whether the nid=0 gets deleted and if it is so, I'd reset the welcome_node_present variable. I'd not like to get rid of that variable, 'cos I think this is a very special page, and deserves the special treatment in node_default_page, and without this variable, I'd need to query the node table if I want the special formatting code to run.

Dries, I await your decision.

Steven’s picture

I think we should get rid of the special treatment, as it is a lot of hassle for something so simple. We can prevent links from showing up by setting the teaser and body equal (can do this with an extra SQL query in db.sql to avoid repeating the text there), and denying comments.

We should also probably put the first sentence "Welcome to your new Drupal-powered website" in the node title and remove it from the body.

We could change the theme defaults so stories don't show "submitted by" by default. This does make sense as well if you consider them to be site articles, whereas blogs being the more personal node type.

Dries’s picture

+1 on making it a node
-1 on using a special variable
-1 on modifying node_save()
-1 on storing PHP code in the node body

I'm OK with this but why the special treatment? Let people manually delete the node when they want to get rid of it.

tangent’s picture

Admins may also just edit the initial node instead of deleting it and creating a new one.

Steven’s picture

Dries: the PHP code is there to make the message be a) localizd b) adapt to clean URLs.

Bèr Kessels’s picture

What about either:
making all negative nids special nodes (mission, password-emails etc) OR
making all nodes under 100 special nodes.

That way we do not just solve a sinlge issue, but leave our options for scalability and expandability open.

0 is just one number.....

tangent’s picture

Implementing "special < 100" on sites with existing nodes would be difficult.

chx’s picture

FileSize
7.27 KB

It seems that the Greater Drupal Gods wish sg. like this.

chx’s picture

FileSize
7.16 KB

totally broken patch :(

Dries’s picture

I haven't tested this patch yet but except for the inconsistent use of whitespaces, it looks about right. What is the date set to? It might be a good idea to insert the current date, if feasible.

chx’s picture

FileSize
6.21 KB

Vauxia corrected the pgsql part, thanks! I corrected the mysql part. And yes, the created and changed time is now the time of the DB import.

Freshly rolled proper CVS diff. (I begin to enjoy this CVS diff thing.)

Dries’s picture

Why not set an author? When you try to edit/delete this node (it shows up on "administer - content"), you are presented with a lot of warnings. It makes for a bad out-of-the-box experience.

Also, this patch introduces a serious bug. You can't create a second story.

Lastly, please correct the use of whitespace around '=' in SQL queries.

chx’s picture

FileSize
10.15 KB

nid is 1 now. spaces are inserted. sequences updated.

chx’s picture

FileSize
6.34 KB

I diffed a little too much.

drumm’s picture

Status: Needs review » Needs work

I am okay with this approach. Will be nice to not have the message hard coded in node_page_default() when other node listing pages (blog, taxonomy, etc) have no such thing.

Although, I can't get it to apply.

Jaza’s picture

Version: x.y.z » 6.x-dev

Moving to 6.x-dev queue. This is definitely still a relevant issue.

Now that install profiles are in core, this (i.e. inserting the 'welcome node' into the DB) would be a perfect thing to be handled by them. Different install profiles could then very easily tailor the welcome message to suit a particular Drupal distribution.

chx’s picture

Status: Needs work » Closed (won't fix)

lack of default php filter makes this impossible.