This is in the .install file for the D7 version:

   // Necessary userprotect settings.
-  $query1 = db_query('SELECT perm FROM {permission} WHERE rid = 2')->fetchField();;
+  $query1 = db_result(db_query('SELECT perm FROM {permission} WHERE rid = 2'));

Comments

robertdouglass’s picture

StatusFileSize
new547 bytes

Had an extra semicolon in the first patch.

robertdouglass’s picture

StatusFileSize
new547 bytes

Looks like I had the patch backwards.

randallkent’s picture

Status: Needs review » Reviewed & tested by the community

Module installs on drupal-7.8 with patch in comment #2 applied

$ drush en simplesamlphp_auth
The following extensions will be enabled: simplesamlphp_auth
Do you really want to continue? (y/n): y
simplesamlphp_auth was enabled successfully.                                                            [ok]

Without Patch:

$ drush en simplesamlphp_auth
The following extensions will be enabled: simplesamlphp_auth
Do you really want to continue? (y/n): y
Fatal error: Call to undefined function db_result() in /var/www/html/sites/all/modules/contrib/simplesamlphp_auth/simplesamlphp_auth.install
Drush command terminated abnormally due to an unrecoverable error.
Error: Call to undefined function db_result() in /var/www/html/sites/all/modules/contrib/simplesamlphp_auth/simplesamlphp_auth.install on Line 16
thimothoeye’s picture

This patch works for me too. Can we get in into git please?

I don't like nitpicking but ideally we should leverage the new db API even more like so:

install:

 $query1 = db_select('role_permission','rp')
    ->fields('rp', array('permission'))
    ->condition('rid',2)
    ->execute()
    ->fetchField();

uninstall:

  db_update('block')
    ->fields(array('status' => 1))
    ->condition('module', 'user', '=')
    ->condition('delta',0,'=')
    ->execute();

Thank you for an otherwise very useful module!!

geekwisdom’s picture

Status: Reviewed & tested by the community » Fixed

@thimothoeye I committed the patch from @robertDouglass back in October and it's in the 7.x-1.2 release. THANK YOU @robertDouglass!

I forgot to update this thread. Sorry! I'm calling this one fixed.

If you want me to fix it according to your code feel free to attach a patch to this thread.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mrf’s picture

Status: Closed (fixed) » Needs work

The db_result is still in there on both 7.x-1.2 and 7.x-1.x preventing installation of the module.

Looks like it did get taken out of 7.x-2.x however.

westie’s picture

StatusFileSize
new2.09 KB

Had problems installing and uninstalling on 7.14 using 7.x-1.2 after applying patch, this was on $query2.

Tried:

     //example 1
     $query2 = db_update('role_permission')
      ->fields(array(
          'permission' => $new_perms))
      ->condition('WHERE rid = :RID', array(":rid" => DRUPAL_AUTHENTICATED_RID))
      ->execute();

      //example 2
      $fields['permission'] = $new_perms;
      $where['rid'] = DRUPAL_AUTHENTICATED_RID;

      $query2 = db_update('role_permission', $fields, $where)

However, should we even use db_query or db_update? Instead would it not be better to use user_role_revoke_permissions()?

Please see attached patch, I am pretty new at this but hopefully it is some help! :)

geekwisdom’s picture

Assigned: Unassigned » geekwisdom
Status: Needs work » Fixed

I used the approach provided by westie. It's now in the 7..x-2.x branch. See: http://drupalcode.org/project/simplesamlphp_auth.git/commit/c4156968745e...

mrf’s picture

Status: Fixed » Needs work

If the 1.x branch is abandoned, please mark it as such. There is no published release for 7.x-2.x and 7.x-1.x and 7.x-1.2 can't be installed without patching this issue.

geekwisdom’s picture

Status: Needs work » Needs review

I'm sorry about this you guys. I just pushed this fix into the 7.x-1.x branch. I'll role a 7.x-1.3 release with this fix and the fix for Issue #1310732 right away.

colan’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.