When i'm creating a node through node_save() i can't set a path because of the limitation of path_nodeapi() (http://api.drupal.org/api/drupal/modules--path--path.module/function/pat...). In this function there is a user_access() call and the user running the installation profile is user 0, that imply that the user_access() check fails and the path attribute can't be set.

The bigger question is why the user running the installation profile isn't defined as user 1.
Here is a snippet to run if you want to reproduce the issue:

  // Create page presentation
    $node = array(
    'title' => t('Presentation'),
    'body' => t('Full description of the presentation node'),
    'nid' => NULL,
    'type' => 'page',
    'teaser' => NULL,
    'log' => '',
    'created' => '',
    'format' => FILTER_FORMAT_DEFAULT,
    'path' => 'presentation',
    'uid' => 1,
  );
  $node = (object) $node;
  node_save($node);

Thanks!

Comments

steven jones’s picture

Is this a general support question about install profiles? Or is this a specific problem when using Aegir to install your site using the install profile?

artusamak’s picture

I know it's true for Aegir for sure, but it can also apply as a general question. ;)

steven jones’s picture

Title: Can't set a path to a node » Provision installs Drupal 6 in different order to Drupal

Looking at the code, it would seem that Drupal logs user 1 in before the profile gets to run its tasks, but in provision it seems that we run the tasks, and then create the user, never logging them in.

This probably needs confirming properly, and then fixing?

artusamak’s picture

For sure the user in the Aegir installation context is 0.

steven jones’s picture

Version: » 6.x-2.x-dev
Priority: Normal » Major

Yeah, going to say this is a major AegirWTF, we should see if we can leverage Drush site-install, and if not, at least re-jig our stuff so that things are done in the same order as Drupal core.

helmo’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

The 6.x-2.x branch will go EOL along with Drupal this week. So I'm closing
this issue. If it remains a confirmed issue in 7.x-3.x, feel free to re-open,
or better yet, create a new issue referencing this one.