~ubuntu-branches/ubuntu/saucy/mediawiki-extensions/saucy

« back to all changes in this revision

Viewing changes to maintenance/OpenID/optionToTable.php

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2009-03-25 19:36:16 UTC
  • Revision ID: james.westby@ubuntu.com-20090325193616-wao3b2mgbb0qyv7i
Tags: 1.6
* Updated extensions.
* Added OpenID extension.
* Added README.Debian.
Closes: #516693
* Bumped standards version to 3.8.1
* Bumped compatibility level to 7.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
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>
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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
 
20
 *
 
21
 * @author Evan Prodromou <evan@wikitravel.org>
 
22
 * @addtogroup Extensions
 
23
 */
 
24
 
 
25
require_once('commandLine.inc');
 
26
ini_set( "include_path", "/usr/share/php:" . ini_get("include_path"));
 
27
 
 
28
require_once("$IP/extensions/OpenID/Consumer.php");
 
29
 
 
30
global $wgSharedDB, $wgDBprefix;
 
31
$tableName = "${wgDBprefix}user_openid";
 
32
if (isset($wgSharedDB)) {
 
33
        $tableName = "`$wgSharedDB`.$tableName";
 
34
}
 
35
 
 
36
$dbr =& wfGetDB( DB_SLAVE );
 
37
 
 
38
$res = $dbr->select(array('user'),
 
39
                                        array('user_name'),
 
40
                                        array('user_options LIKE "%openid_url%"'),
 
41
                                        'optionToTable',
 
42
                                        array('ORDER BY' => 'user_name'));
 
43
 
 
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'));
 
48
}
 
49
$dbr->freeResult($res);