3
* optionToTable.php -- Convert old user_options-based
4
* Copyright 2006,2007 Internet Brands (http://www.internetbrands.com/)
5
* By Evan Prodromou <evan@wikitravel.org>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
* @author Evan Prodromou <evan@wikitravel.org>
22
* @addtogroup Extensions
25
require_once('commandLine.inc');
26
ini_set( "include_path", "/usr/share/php:" . ini_get("include_path"));
28
require_once("$IP/extensions/OpenID/Consumer.php");
30
global $wgSharedDB, $wgDBprefix;
31
$tableName = "${wgDBprefix}user_openid";
32
if (isset($wgSharedDB)) {
33
$tableName = "`$wgSharedDB`.$tableName";
36
$dbr =& wfGetDB( DB_SLAVE );
38
$res = $dbr->select(array('user'),
40
array('user_options LIKE "%openid_url%"'),
42
array('ORDER BY' => 'user_name'));
44
while ($res && $row = $dbr->fetchObject($res)) {
45
$user = User::newFromName($row->user_name);
46
print( $user->getName() . ": " . $user->getOption('openid_url') . "\n");
47
OpenIDSetUserUrl($user, $user->getOption('openid_url'));
49
$dbr->freeResult($res);