Failed Conditions
Push — rbac ( be68b4...52c28b )
by Michael
03:11
created

ClearOAuthDataTask::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 3
cp 0
rs 9.9666
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/******************************************************************************
3
 * Wikipedia Account Creation Assistance tool                                 *
4
 *                                                                            *
5
 * All code in this file is released into the public domain by the ACC        *
6
 * Development Team. Please see team.json for a list of contributors.         *
7
 ******************************************************************************/
8
9
namespace Waca\ConsoleTasks;
10
11
use Waca\Tasks\ConsoleTaskBase;
12
13
class ClearOAuthDataTask extends ConsoleTaskBase
14
{
15
    public function execute()
16
    {
17
        // @fixme this is unsafe.
18
        // What we should be doing is iterating over all OAuth users, fetching their username, and updating the onwiki
19
        // name for the user at the same time as blatting out the OAuth credentials, otherwise we risk losing all links
20
        // to the user's onwiki account.
21
22
        $this->getDatabase()->exec(<<<SQL
23
        UPDATE user
24
        SET
25
            oauthrequesttoken = NULL,
26
            oauthrequestsecret = NULL,
27
            oauthaccesstoken = NULL,
28
            oauthaccesssecret = NULL,
29
            oauthidentitycache = NULL;
30
SQL
31
        );
32
    }
0 ignored issues
show
Coding Style introduced by
Expected //end execute()
Loading history...
33
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...