[dokuwiki] Re: Auth backwards compatibility (new patch)

  • From: Guy Brand <gb@xxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sat, 16 Mar 2013 13:11:13 +0100

Hello

> > Instead, the new patch (attached) introduces backwards compatibility,
> > and could well be removed after some migration period. It introduces an
> > extra comparison, so the config variable authtype is not only checked
> > against the plugin name, but also against 'auth' + plugin name.
> 
> +1
> 
> To help depreciating this little fragment of code after the migration
> period (which could be two releases as we support a stable and
> old-stable release) how about adding a note to the admin (through the
> msg() function) inviting her/him to update the config of her/his wiki
> when the authtype setting does not match the auth plugin name? Such as
> 
>   "In your configuration, the option foo should be named authfoo, see 
>    [[this]] link"
> 
> This has been suggested in discussion on IRC too.

Attached is a patch with Moritz compatibility line and with a message
displayed to warn about the authtype setting if it does not match the
new plugin name. Opinions?

> I have updated the documentation about the upgrade from auth backend
> to the auth plugin.
> It is available on [1]. Please can you have a look, review and complete?

I've linked the message about authtype setting to this page.

Note: I suggest not to translate that new message at all, as it's there
for two releases only (e.g. our maintenance period).

-- 
bug

--- /home/bug/release/inc/auth.php      2013-03-06 14:08:08.126733164 +0100
+++ inc/auth.php        2013-03-16 13:03:48.956703006 +0100
@@ -51,7 +51,12 @@
        if ($conf['authtype'] === $plugin) {
                $auth = $plugin_controller->load('auth', $plugin);
                break;
-       }
+       } elseif ('auth' . $conf['authtype'] === $plugin) {
+        // matches old auth backends (pre-Weatherwax)
+        $auth = $plugin_controller->load('auth', $plugin);
+        msg('Your authtype setting is deprecated. You must set 
$conf[\'authconfig\'] = ' . "auth" . $conf['authtype'] 
+             . ' in your config (see <a 
href="https://www.dokuwiki.org/auth";>Authentication Backends</a>)',-1);
+      }
     }
 
        if(!isset($auth) || !$auth){

Other related posts: