Page MenuHomePhabricator

Add SQLite Support to LDAP Authentication extension
Open, NormalPublic

Description

The latest version of LDAP Authentication (REL1_25-d4db6f0) does not include any support for SQLite and the "updatedb.php" step necessary for it to work silently fails.

More details about this bug discovery are here: https://www.mediawiki.org/wiki/Thread:Extension_talk:LDAP_Authentication/ldap_extension_on_mediawiki/sqlite:_no_such_table:_ldap_domains but I did not see a bug report filed on it. Apologies if this is a duplicate.

To fix the problem, create a schema/ldap-sqlite.sql file containing the following:

CREATE TABLE ldap_domains (
        -- IF for domain
        domain_id INTEGER PRIMARY KEY AUTOINCREMENT,

        -- domain itself
        domain TEXT,

        -- User to which this domain belongs
        user_id TEXT

) /*$wgDBTableOptions*/;

CREATE INDEX user_id on ldap_domains (user_id);

And apply this patch to LdapAuthentication.php:

*** LdapAuthentication.php.orig 2015-08-07 10:26:56.912671115 -0700
--- LdapAuthentication.php      2015-08-07 10:39:17.729696047 -0700
***************
*** 114,120 ****
        case 'postgres':
                $updater->addExtensionTable( 'ldap_domains', "$base/schema/ldap-postgres.sql" );
                break;
!       }
        return true;
  }

--- 114,123 ----
        case 'postgres':
                $updater->addExtensionTable( 'ldap_domains', "$base/schema/ldap-postgres.sql" );
                break;
!         case 'sqlite':
!                 $updater->addExtensionTable( 'ldap_domains', "$base/schema/ldap-sqlite.sql" );
!                 break;
!         }
        return true;
  }

Incorporating something like that as a permanent fix would be great for other SQLite users.

Thanks,

  • Steve Bonds

Event Timeline

sbonds created this task.Aug 7 2015, 5:58 PM
sbonds raised the priority of this task from to Needs Triage.
sbonds updated the task description. (Show Details)
sbonds added a subscriber: sbonds.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 7 2015, 5:58 PM
saper claimed this task.Jan 6 2016, 2:50 PM
saper triaged this task as Normal priority.
saper set Security to None.

Change 262707 had a related patch set uploaded (by saper):
Add SQLite Support to LDAP Authentication extension

https://gerrit.wikimedia.org/r/262707

saper added a comment.Jan 6 2016, 2:54 PM

Hi @sbonds - I have pushed your patch to the "code review" (i.e. the red tape needed to get this thing included), I only would love to include your name and email address in the git commit, since you are the author. Can you mail me at saper@saper.info? Thanks

Sorry for the late reply, @saper. I have E-mailed you from my sbonds@gmail.com account.

Dereckson moved this task from Backlog to Schema needed on the SQLite board.May 20 2017, 10:18 AM

Change 262707 merged by jenkins-bot:
[mediawiki/extensions/LdapAuthentication@master] Add SQLite Support to LDAP Authentication extension

https://gerrit.wikimedia.org/r/262707

Jdforrester-WMF added a subscriber: Jdforrester-WMF.

Mass-moving all items tagged for MediaWiki 1.30.0-wmf.3, as that was never released; instead, we're using -wmf.4.