Failed Conditions
Push — newinternal-releasecandidate ( a30d14...06bb07 )
by Simon
08:31
created
includes/Tasks/TaskBase.php 1 patch
Indentation   +225 added lines, -225 removed lines patch added patch discarded remove patch
@@ -23,229 +23,229 @@
 block discarded – undo
23 23
 
24 24
 abstract class TaskBase implements ITask
25 25
 {
26
-    /** @var SiteConfiguration */
27
-    private $siteConfiguration;
28
-    /** @var IEmailHelper */
29
-    private $emailHelper;
30
-    /** @var HttpHelper */
31
-    private $httpHelper;
32
-    /** @var WikiTextHelper */
33
-    private $wikiTextHelper;
34
-    /** @var ILocationProvider */
35
-    private $locationProvider;
36
-    /** @var IXffTrustProvider */
37
-    private $xffTrustProvider;
38
-    /** @var IRDnsProvider */
39
-    private $rdnsProvider;
40
-    /** @var IAntiSpoofProvider */
41
-    private $antiSpoofProvider;
42
-    /** @var IOAuthProtocolHelper */
43
-    private $oauthHelper;
44
-    /** @var PdoDatabase */
45
-    private $database;
46
-    /** @var IrcNotificationHelper */
47
-    private $notificationHelper;
48
-    /** @var TorExitProvider */
49
-    private $torExitProvider;
50
-
51
-    /**
52
-     * @return IEmailHelper
53
-     */
54
-    final public function getEmailHelper()
55
-    {
56
-        return $this->emailHelper;
57
-    }
58
-
59
-    /**
60
-     * @param IEmailHelper $emailHelper
61
-     */
62
-    final public function setEmailHelper($emailHelper)
63
-    {
64
-        $this->emailHelper = $emailHelper;
65
-    }
66
-
67
-    /**
68
-     * @return HttpHelper
69
-     */
70
-    final public function getHttpHelper()
71
-    {
72
-        return $this->httpHelper;
73
-    }
74
-
75
-    /**
76
-     * @param HttpHelper $httpHelper
77
-     */
78
-    final public function setHttpHelper($httpHelper)
79
-    {
80
-        $this->httpHelper = $httpHelper;
81
-    }
82
-
83
-    /**
84
-     * @return WikiTextHelper
85
-     */
86
-    final public function getWikiTextHelper()
87
-    {
88
-        return $this->wikiTextHelper;
89
-    }
90
-
91
-    /**
92
-     * @param WikiTextHelper $wikiTextHelper
93
-     */
94
-    final public function setWikiTextHelper($wikiTextHelper)
95
-    {
96
-        $this->wikiTextHelper = $wikiTextHelper;
97
-    }
98
-
99
-    /**
100
-     * @return ILocationProvider
101
-     */
102
-    final public function getLocationProvider()
103
-    {
104
-        return $this->locationProvider;
105
-    }
106
-
107
-    /**
108
-     * @param ILocationProvider $locationProvider
109
-     */
110
-    final public function setLocationProvider(ILocationProvider $locationProvider)
111
-    {
112
-        $this->locationProvider = $locationProvider;
113
-    }
114
-
115
-    /**
116
-     * @return IXffTrustProvider
117
-     */
118
-    final public function getXffTrustProvider()
119
-    {
120
-        return $this->xffTrustProvider;
121
-    }
122
-
123
-    /**
124
-     * @param IXffTrustProvider $xffTrustProvider
125
-     */
126
-    final public function setXffTrustProvider(IXffTrustProvider $xffTrustProvider)
127
-    {
128
-        $this->xffTrustProvider = $xffTrustProvider;
129
-    }
130
-
131
-    /**
132
-     * @return IRDnsProvider
133
-     */
134
-    final public function getRdnsProvider()
135
-    {
136
-        return $this->rdnsProvider;
137
-    }
138
-
139
-    /**
140
-     * @param IRDnsProvider $rdnsProvider
141
-     */
142
-    public function setRdnsProvider($rdnsProvider)
143
-    {
144
-        $this->rdnsProvider = $rdnsProvider;
145
-    }
146
-
147
-    /**
148
-     * @return IAntiSpoofProvider
149
-     */
150
-    public function getAntiSpoofProvider()
151
-    {
152
-        return $this->antiSpoofProvider;
153
-    }
154
-
155
-    /**
156
-     * @param IAntiSpoofProvider $antiSpoofProvider
157
-     */
158
-    public function setAntiSpoofProvider($antiSpoofProvider)
159
-    {
160
-        $this->antiSpoofProvider = $antiSpoofProvider;
161
-    }
162
-
163
-    /**
164
-     * @return PdoDatabase
165
-     */
166
-    final public function getDatabase()
167
-    {
168
-        return $this->database;
169
-    }
170
-
171
-    /**
172
-     * @param PdoDatabase $database
173
-     */
174
-    final public function setDatabase($database)
175
-    {
176
-        $this->database = $database;
177
-    }
178
-
179
-    /**
180
-     * @return IOAuthProtocolHelper
181
-     */
182
-    public function getOAuthProtocolHelper()
183
-    {
184
-        return $this->oauthHelper;
185
-    }
186
-
187
-    /**
188
-     * @param IOAuthProtocolHelper $oauthProtocolHelper
189
-     */
190
-    public function setOAuthProtocolHelper($oauthProtocolHelper)
191
-    {
192
-        $this->oauthHelper = $oauthProtocolHelper;
193
-    }
194
-
195
-    /**
196
-     * @return void
197
-     */
198
-    abstract public function execute();
199
-
200
-    /**
201
-     * @return IrcNotificationHelper
202
-     */
203
-    public function getNotificationHelper()
204
-    {
205
-        return $this->notificationHelper;
206
-    }
207
-
208
-    /**
209
-     * @param IrcNotificationHelper $notificationHelper
210
-     */
211
-    public function setNotificationHelper($notificationHelper)
212
-    {
213
-        $this->notificationHelper = $notificationHelper;
214
-    }
215
-
216
-    /**
217
-     * @return TorExitProvider
218
-     */
219
-    public function getTorExitProvider()
220
-    {
221
-        return $this->torExitProvider;
222
-    }
223
-
224
-    /**
225
-     * @param TorExitProvider $torExitProvider
226
-     */
227
-    public function setTorExitProvider($torExitProvider)
228
-    {
229
-        $this->torExitProvider = $torExitProvider;
230
-    }
231
-
232
-    /**
233
-     * Gets the site configuration object
234
-     *
235
-     * @return SiteConfiguration
236
-     */
237
-    final protected function getSiteConfiguration()
238
-    {
239
-        return $this->siteConfiguration;
240
-    }
241
-
242
-    /**
243
-     * Sets the site configuration object for this page
244
-     *
245
-     * @param SiteConfiguration $configuration
246
-     */
247
-    final public function setSiteConfiguration($configuration)
248
-    {
249
-        $this->siteConfiguration = $configuration;
250
-    }
26
+	/** @var SiteConfiguration */
27
+	private $siteConfiguration;
28
+	/** @var IEmailHelper */
29
+	private $emailHelper;
30
+	/** @var HttpHelper */
31
+	private $httpHelper;
32
+	/** @var WikiTextHelper */
33
+	private $wikiTextHelper;
34
+	/** @var ILocationProvider */
35
+	private $locationProvider;
36
+	/** @var IXffTrustProvider */
37
+	private $xffTrustProvider;
38
+	/** @var IRDnsProvider */
39
+	private $rdnsProvider;
40
+	/** @var IAntiSpoofProvider */
41
+	private $antiSpoofProvider;
42
+	/** @var IOAuthProtocolHelper */
43
+	private $oauthHelper;
44
+	/** @var PdoDatabase */
45
+	private $database;
46
+	/** @var IrcNotificationHelper */
47
+	private $notificationHelper;
48
+	/** @var TorExitProvider */
49
+	private $torExitProvider;
50
+
51
+	/**
52
+	 * @return IEmailHelper
53
+	 */
54
+	final public function getEmailHelper()
55
+	{
56
+		return $this->emailHelper;
57
+	}
58
+
59
+	/**
60
+	 * @param IEmailHelper $emailHelper
61
+	 */
62
+	final public function setEmailHelper($emailHelper)
63
+	{
64
+		$this->emailHelper = $emailHelper;
65
+	}
66
+
67
+	/**
68
+	 * @return HttpHelper
69
+	 */
70
+	final public function getHttpHelper()
71
+	{
72
+		return $this->httpHelper;
73
+	}
74
+
75
+	/**
76
+	 * @param HttpHelper $httpHelper
77
+	 */
78
+	final public function setHttpHelper($httpHelper)
79
+	{
80
+		$this->httpHelper = $httpHelper;
81
+	}
82
+
83
+	/**
84
+	 * @return WikiTextHelper
85
+	 */
86
+	final public function getWikiTextHelper()
87
+	{
88
+		return $this->wikiTextHelper;
89
+	}
90
+
91
+	/**
92
+	 * @param WikiTextHelper $wikiTextHelper
93
+	 */
94
+	final public function setWikiTextHelper($wikiTextHelper)
95
+	{
96
+		$this->wikiTextHelper = $wikiTextHelper;
97
+	}
98
+
99
+	/**
100
+	 * @return ILocationProvider
101
+	 */
102
+	final public function getLocationProvider()
103
+	{
104
+		return $this->locationProvider;
105
+	}
106
+
107
+	/**
108
+	 * @param ILocationProvider $locationProvider
109
+	 */
110
+	final public function setLocationProvider(ILocationProvider $locationProvider)
111
+	{
112
+		$this->locationProvider = $locationProvider;
113
+	}
114
+
115
+	/**
116
+	 * @return IXffTrustProvider
117
+	 */
118
+	final public function getXffTrustProvider()
119
+	{
120
+		return $this->xffTrustProvider;
121
+	}
122
+
123
+	/**
124
+	 * @param IXffTrustProvider $xffTrustProvider
125
+	 */
126
+	final public function setXffTrustProvider(IXffTrustProvider $xffTrustProvider)
127
+	{
128
+		$this->xffTrustProvider = $xffTrustProvider;
129
+	}
130
+
131
+	/**
132
+	 * @return IRDnsProvider
133
+	 */
134
+	final public function getRdnsProvider()
135
+	{
136
+		return $this->rdnsProvider;
137
+	}
138
+
139
+	/**
140
+	 * @param IRDnsProvider $rdnsProvider
141
+	 */
142
+	public function setRdnsProvider($rdnsProvider)
143
+	{
144
+		$this->rdnsProvider = $rdnsProvider;
145
+	}
146
+
147
+	/**
148
+	 * @return IAntiSpoofProvider
149
+	 */
150
+	public function getAntiSpoofProvider()
151
+	{
152
+		return $this->antiSpoofProvider;
153
+	}
154
+
155
+	/**
156
+	 * @param IAntiSpoofProvider $antiSpoofProvider
157
+	 */
158
+	public function setAntiSpoofProvider($antiSpoofProvider)
159
+	{
160
+		$this->antiSpoofProvider = $antiSpoofProvider;
161
+	}
162
+
163
+	/**
164
+	 * @return PdoDatabase
165
+	 */
166
+	final public function getDatabase()
167
+	{
168
+		return $this->database;
169
+	}
170
+
171
+	/**
172
+	 * @param PdoDatabase $database
173
+	 */
174
+	final public function setDatabase($database)
175
+	{
176
+		$this->database = $database;
177
+	}
178
+
179
+	/**
180
+	 * @return IOAuthProtocolHelper
181
+	 */
182
+	public function getOAuthProtocolHelper()
183
+	{
184
+		return $this->oauthHelper;
185
+	}
186
+
187
+	/**
188
+	 * @param IOAuthProtocolHelper $oauthProtocolHelper
189
+	 */
190
+	public function setOAuthProtocolHelper($oauthProtocolHelper)
191
+	{
192
+		$this->oauthHelper = $oauthProtocolHelper;
193
+	}
194
+
195
+	/**
196
+	 * @return void
197
+	 */
198
+	abstract public function execute();
199
+
200
+	/**
201
+	 * @return IrcNotificationHelper
202
+	 */
203
+	public function getNotificationHelper()
204
+	{
205
+		return $this->notificationHelper;
206
+	}
207
+
208
+	/**
209
+	 * @param IrcNotificationHelper $notificationHelper
210
+	 */
211
+	public function setNotificationHelper($notificationHelper)
212
+	{
213
+		$this->notificationHelper = $notificationHelper;
214
+	}
215
+
216
+	/**
217
+	 * @return TorExitProvider
218
+	 */
219
+	public function getTorExitProvider()
220
+	{
221
+		return $this->torExitProvider;
222
+	}
223
+
224
+	/**
225
+	 * @param TorExitProvider $torExitProvider
226
+	 */
227
+	public function setTorExitProvider($torExitProvider)
228
+	{
229
+		$this->torExitProvider = $torExitProvider;
230
+	}
231
+
232
+	/**
233
+	 * Gets the site configuration object
234
+	 *
235
+	 * @return SiteConfiguration
236
+	 */
237
+	final protected function getSiteConfiguration()
238
+	{
239
+		return $this->siteConfiguration;
240
+	}
241
+
242
+	/**
243
+	 * Sets the site configuration object for this page
244
+	 *
245
+	 * @param SiteConfiguration $configuration
246
+	 */
247
+	final public function setSiteConfiguration($configuration)
248
+	{
249
+		$this->siteConfiguration = $configuration;
250
+	}
251 251
 }
252 252
\ No newline at end of file
Please login to merge, or discard this patch.
includes/DataObjects/OAuthToken.php 1 patch
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -14,42 +14,42 @@  discard block
 block discarded – undo
14 14
 
15 15
 class OAuthToken extends DataObject
16 16
 {
17
-    /** @var int */
18
-    private $user;
19
-    /** @var string */
20
-    private $token;
21
-    /** @var string */
22
-    private $secret;
23
-    /** @var string */
24
-    private $type;
25
-    /** @var string */
26
-    private $expiry;
27
-
28
-    public function save()
29
-    {
30
-        if ($this->isNew()) {
31
-            // insert
32
-            $statement = $this->dbObject->prepare(<<<SQL
17
+	/** @var int */
18
+	private $user;
19
+	/** @var string */
20
+	private $token;
21
+	/** @var string */
22
+	private $secret;
23
+	/** @var string */
24
+	private $type;
25
+	/** @var string */
26
+	private $expiry;
27
+
28
+	public function save()
29
+	{
30
+		if ($this->isNew()) {
31
+			// insert
32
+			$statement = $this->dbObject->prepare(<<<SQL
33 33
                 INSERT INTO oauthtoken ( user, token, secret, type, expiry )
34 34
                 VALUES ( :user, :token, :secret, :type, :expiry );
35 35
 SQL
36
-            );
37
-            $statement->bindValue(":user", $this->user);
38
-            $statement->bindValue(":token", $this->token);
39
-            $statement->bindValue(":secret", $this->secret);
40
-            $statement->bindValue(":type", $this->type);
41
-            $statement->bindValue(":expiry", $this->expiry);
42
-
43
-            if ($statement->execute()) {
44
-                $this->id = (int)$this->dbObject->lastInsertId();
45
-            }
46
-            else {
47
-                throw new Exception($statement->errorInfo());
48
-            }
49
-        }
50
-        else {
51
-            // update
52
-            $statement = $this->dbObject->prepare(<<<SQL
36
+			);
37
+			$statement->bindValue(":user", $this->user);
38
+			$statement->bindValue(":token", $this->token);
39
+			$statement->bindValue(":secret", $this->secret);
40
+			$statement->bindValue(":type", $this->type);
41
+			$statement->bindValue(":expiry", $this->expiry);
42
+
43
+			if ($statement->execute()) {
44
+				$this->id = (int)$this->dbObject->lastInsertId();
45
+			}
46
+			else {
47
+				throw new Exception($statement->errorInfo());
48
+			}
49
+		}
50
+		else {
51
+			// update
52
+			$statement = $this->dbObject->prepare(<<<SQL
53 53
                 UPDATE oauthtoken
54 54
                 SET   token = :token
55 55
                     , secret = :secret
@@ -58,109 +58,109 @@  discard block
 block discarded – undo
58 58
                     , updateversion = updateversion + 1
59 59
                 WHERE id = :id AND updateversion = :updateversion;
60 60
 SQL
61
-            );
62
-
63
-            $statement->bindValue(':id', $this->id);
64
-            $statement->bindValue(':updateversion', $this->updateversion);
65
-
66
-            $statement->bindValue(":token", $this->token);
67
-            $statement->bindValue(":secret", $this->secret);
68
-            $statement->bindValue(":type", $this->type);
69
-            $statement->bindValue(":expiry", $this->expiry);
70
-
71
-            if (!$statement->execute()) {
72
-                throw new Exception($statement->errorInfo());
73
-            }
74
-
75
-            if ($statement->rowCount() !== 1) {
76
-                throw new OptimisticLockFailedException();
77
-            }
78
-
79
-            $this->updateversion++;
80
-        }
81
-    }
82
-
83
-    #region properties
84
-
85
-    /**
86
-     * @return mixed
87
-     */
88
-    public function getUserId()
89
-    {
90
-        return $this->user;
91
-    }
92
-
93
-    /**
94
-     * @param mixed $user
95
-     */
96
-    public function setUserId($user)
97
-    {
98
-        $this->user = $user;
99
-    }
100
-
101
-    /**
102
-     * @return mixed
103
-     */
104
-    public function getToken()
105
-    {
106
-        return $this->token;
107
-    }
108
-
109
-    /**
110
-     * @param mixed $token
111
-     */
112
-    public function setToken($token)
113
-    {
114
-        $this->token = $token;
115
-    }
116
-
117
-    /**
118
-     * @return mixed
119
-     */
120
-    public function getSecret()
121
-    {
122
-        return $this->secret;
123
-    }
124
-
125
-    /**
126
-     * @param mixed $secret
127
-     */
128
-    public function setSecret($secret)
129
-    {
130
-        $this->secret = $secret;
131
-    }
132
-
133
-    /**
134
-     * @return mixed
135
-     */
136
-    public function getType()
137
-    {
138
-        return $this->type;
139
-    }
140
-
141
-    /**
142
-     * @param mixed $type
143
-     */
144
-    public function setType($type)
145
-    {
146
-        $this->type = $type;
147
-    }
148
-
149
-    /**
150
-     * @return string
151
-     */
152
-    public function getExpiry()
153
-    {
154
-        return $this->expiry;
155
-    }
156
-
157
-    /**
158
-     * @param string $expiry
159
-     */
160
-    public function setExpiry($expiry)
161
-    {
162
-        $this->expiry = $expiry;
163
-    }
164
-    #endregion
61
+			);
62
+
63
+			$statement->bindValue(':id', $this->id);
64
+			$statement->bindValue(':updateversion', $this->updateversion);
65
+
66
+			$statement->bindValue(":token", $this->token);
67
+			$statement->bindValue(":secret", $this->secret);
68
+			$statement->bindValue(":type", $this->type);
69
+			$statement->bindValue(":expiry", $this->expiry);
70
+
71
+			if (!$statement->execute()) {
72
+				throw new Exception($statement->errorInfo());
73
+			}
74
+
75
+			if ($statement->rowCount() !== 1) {
76
+				throw new OptimisticLockFailedException();
77
+			}
78
+
79
+			$this->updateversion++;
80
+		}
81
+	}
82
+
83
+	#region properties
84
+
85
+	/**
86
+	 * @return mixed
87
+	 */
88
+	public function getUserId()
89
+	{
90
+		return $this->user;
91
+	}
92
+
93
+	/**
94
+	 * @param mixed $user
95
+	 */
96
+	public function setUserId($user)
97
+	{
98
+		$this->user = $user;
99
+	}
100
+
101
+	/**
102
+	 * @return mixed
103
+	 */
104
+	public function getToken()
105
+	{
106
+		return $this->token;
107
+	}
108
+
109
+	/**
110
+	 * @param mixed $token
111
+	 */
112
+	public function setToken($token)
113
+	{
114
+		$this->token = $token;
115
+	}
116
+
117
+	/**
118
+	 * @return mixed
119
+	 */
120
+	public function getSecret()
121
+	{
122
+		return $this->secret;
123
+	}
124
+
125
+	/**
126
+	 * @param mixed $secret
127
+	 */
128
+	public function setSecret($secret)
129
+	{
130
+		$this->secret = $secret;
131
+	}
132
+
133
+	/**
134
+	 * @return mixed
135
+	 */
136
+	public function getType()
137
+	{
138
+		return $this->type;
139
+	}
140
+
141
+	/**
142
+	 * @param mixed $type
143
+	 */
144
+	public function setType($type)
145
+	{
146
+		$this->type = $type;
147
+	}
148
+
149
+	/**
150
+	 * @return string
151
+	 */
152
+	public function getExpiry()
153
+	{
154
+		return $this->expiry;
155
+	}
156
+
157
+	/**
158
+	 * @param string $expiry
159
+	 */
160
+	public function setExpiry($expiry)
161
+	{
162
+		$this->expiry = $expiry;
163
+	}
164
+	#endregion
165 165
 
166 166
 }
167 167
\ No newline at end of file
Please login to merge, or discard this patch.
includes/DataObjects/JobQueue.php 2 patches
Indentation   +253 added lines, -253 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 class JobQueue extends DataObject
19 19
 {
20
-    /*
20
+	/*
21 21
      * Status workflow is this:
22 22
      *
23 23
      * 1) Ready. The job has been added to the queue
@@ -26,78 +26,78 @@  discard block
 block discarded – undo
26 26
      * 3) Complete / Failed. The job has been processed
27 27
      *
28 28
      */
29
-    const STATUS_READY = 'ready';
30
-    const STATUS_WAITING = 'waiting';
31
-    const STATUS_RUNNING = 'running';
32
-    const STATUS_COMPLETE = 'complete';
33
-    const STATUS_CANCELLED = 'cancelled';
34
-    const STATUS_FAILED = 'failed';
35
-    const STATUS_HELD = 'held';
36
-
37
-    /** @var string */
38
-    private $task;
39
-    /** @var int */
40
-    private $user;
41
-    /** @var int */
42
-    private $request;
43
-    /** @var int */
44
-    private $emailtemplate;
45
-    /** @var string */
46
-    private $status;
47
-    /** @var string */
48
-    private $enqueue;
49
-    /** @var string */
50
-    private $parameters;
51
-    /** @var string */
52
-    private $error;
53
-    /** @var int */
54
-    private $acknowledged;
55
-    /** @var int */
56
-    private $parent;
57
-
58
-    /**
59
-     * This feels like the least bad place to put this method.
60
-     */
61
-    public static function getTaskDescriptions() {
62
-        return array(
63
-            BotCreationTask::class  => 'Create account (via bot)',
64
-            UserCreationTask::class => 'Create account (via OAuth)',
65
-            WelcomeUserTask::class  => 'Welcome user',
66
-        );
67
-    }
68
-
69
-    /**
70
-     * Saves a data object to the database, either updating or inserting a record.
71
-     * @return void
72
-     * @throws Exception
73
-     * @throws OptimisticLockFailedException
74
-     */
75
-    public function save()
76
-    {
77
-        if ($this->isNew()) {
78
-            // insert
79
-            $statement = $this->dbObject->prepare(<<<SQL
29
+	const STATUS_READY = 'ready';
30
+	const STATUS_WAITING = 'waiting';
31
+	const STATUS_RUNNING = 'running';
32
+	const STATUS_COMPLETE = 'complete';
33
+	const STATUS_CANCELLED = 'cancelled';
34
+	const STATUS_FAILED = 'failed';
35
+	const STATUS_HELD = 'held';
36
+
37
+	/** @var string */
38
+	private $task;
39
+	/** @var int */
40
+	private $user;
41
+	/** @var int */
42
+	private $request;
43
+	/** @var int */
44
+	private $emailtemplate;
45
+	/** @var string */
46
+	private $status;
47
+	/** @var string */
48
+	private $enqueue;
49
+	/** @var string */
50
+	private $parameters;
51
+	/** @var string */
52
+	private $error;
53
+	/** @var int */
54
+	private $acknowledged;
55
+	/** @var int */
56
+	private $parent;
57
+
58
+	/**
59
+	 * This feels like the least bad place to put this method.
60
+	 */
61
+	public static function getTaskDescriptions() {
62
+		return array(
63
+			BotCreationTask::class  => 'Create account (via bot)',
64
+			UserCreationTask::class => 'Create account (via OAuth)',
65
+			WelcomeUserTask::class  => 'Welcome user',
66
+		);
67
+	}
68
+
69
+	/**
70
+	 * Saves a data object to the database, either updating or inserting a record.
71
+	 * @return void
72
+	 * @throws Exception
73
+	 * @throws OptimisticLockFailedException
74
+	 */
75
+	public function save()
76
+	{
77
+		if ($this->isNew()) {
78
+			// insert
79
+			$statement = $this->dbObject->prepare(<<<SQL
80 80
                 INSERT INTO jobqueue (task, user, request, emailtemplate, parameters, parent) 
81 81
                 VALUES (:task, :user, :request, :emailtemplate, :parameters, :parent)
82 82
 SQL
83
-            );
84
-            $statement->bindValue(":task", $this->task);
85
-            $statement->bindValue(":user", $this->user);
86
-            $statement->bindValue(":request", $this->request);
87
-            $statement->bindValue(":emailtemplate", $this->emailtemplate);
88
-            $statement->bindValue(":parameters", $this->parameters);
89
-            $statement->bindValue(":parent", $this->parent);
90
-
91
-            if ($statement->execute()) {
92
-                $this->id = (int)$this->dbObject->lastInsertId();
93
-            }
94
-            else {
95
-                throw new Exception($statement->errorInfo());
96
-            }
97
-        }
98
-        else {
99
-            // update
100
-            $statement = $this->dbObject->prepare(<<<SQL
83
+			);
84
+			$statement->bindValue(":task", $this->task);
85
+			$statement->bindValue(":user", $this->user);
86
+			$statement->bindValue(":request", $this->request);
87
+			$statement->bindValue(":emailtemplate", $this->emailtemplate);
88
+			$statement->bindValue(":parameters", $this->parameters);
89
+			$statement->bindValue(":parent", $this->parent);
90
+
91
+			if ($statement->execute()) {
92
+				$this->id = (int)$this->dbObject->lastInsertId();
93
+			}
94
+			else {
95
+				throw new Exception($statement->errorInfo());
96
+			}
97
+		}
98
+		else {
99
+			// update
100
+			$statement = $this->dbObject->prepare(<<<SQL
101 101
                 UPDATE jobqueue SET 
102 102
                       status = :status
103 103
                     , error = :error
@@ -105,187 +105,187 @@  discard block
 block discarded – undo
105 105
                     , updateversion = updateversion + 1
106 106
                 WHERE id = :id AND updateversion = :updateversion;
107 107
 SQL
108
-            );
109
-
110
-            $statement->bindValue(":id", $this->id);
111
-            $statement->bindValue(":updateversion", $this->updateversion);
112
-
113
-            $statement->bindValue(":status", $this->status);
114
-            $statement->bindValue(":error", $this->error);
115
-            $statement->bindValue(":ack", $this->acknowledged);
116
-
117
-            if (!$statement->execute()) {
118
-                throw new Exception($statement->errorInfo());
119
-            }
120
-
121
-            if ($statement->rowCount() !== 1) {
122
-                throw new OptimisticLockFailedException();
123
-            }
124
-
125
-            $this->updateversion++;
126
-        }
127
-    }
128
-
129
-    #region Properties
130
-
131
-    /**
132
-     * @return string
133
-     */
134
-    public function getTask()
135
-    {
136
-        return $this->task;
137
-    }
138
-
139
-    /**
140
-     * @param string $task
141
-     */
142
-    public function setTask($task)
143
-    {
144
-        $this->task = $task;
145
-    }
146
-
147
-    /**
148
-     * @return int
149
-     */
150
-    public function getTriggerUserId()
151
-    {
152
-        return $this->user;
153
-    }
154
-
155
-    /**
156
-     * @param int $user
157
-     */
158
-    public function setTriggerUserId($user)
159
-    {
160
-        $this->user = $user;
161
-    }
162
-
163
-    /**
164
-     * @return int
165
-     */
166
-    public function getRequest()
167
-    {
168
-        return $this->request;
169
-    }
170
-
171
-    /**
172
-     * @param int $request
173
-     */
174
-    public function setRequest($request)
175
-    {
176
-        $this->request = $request;
177
-    }
178
-
179
-    /**
180
-     * @return string
181
-     */
182
-    public function getStatus()
183
-    {
184
-        return $this->status;
185
-    }
186
-
187
-    /**
188
-     * @param string $status
189
-     */
190
-    public function setStatus($status)
191
-    {
192
-        $this->status = $status;
193
-    }
194
-
195
-    /**
196
-     * @return string
197
-     */
198
-    public function getEnqueue()
199
-    {
200
-        return $this->enqueue;
201
-    }
202
-
203
-    /**
204
-     * @param string $enqueue
205
-     */
206
-    public function setEnqueue($enqueue)
207
-    {
208
-        $this->enqueue = $enqueue;
209
-    }
210
-
211
-    /**
212
-     * @return string
213
-     */
214
-    public function getParameters()
215
-    {
216
-        return $this->parameters;
217
-    }
218
-
219
-    /**
220
-     * @param string $parameters
221
-     */
222
-    public function setParameters($parameters)
223
-    {
224
-        $this->parameters = $parameters;
225
-    }
226
-
227
-    /**
228
-     * @return mixed
229
-     */
230
-    public function getError()
231
-    {
232
-        return $this->error;
233
-    }
234
-
235
-    /**
236
-     * @param mixed $error
237
-     */
238
-    public function setError($error)
239
-    {
240
-        $this->error = $error;
241
-    }
242
-
243
-    /**
244
-     * @return int
245
-     */
246
-    public function getAcknowledged()
247
-    {
248
-        return $this->acknowledged;
249
-    }
250
-
251
-    /**
252
-     * @param int $acknowledged
253
-     */
254
-    public function setAcknowledged($acknowledged)
255
-    {
256
-        $this->acknowledged = $acknowledged;
257
-    }
258
-
259
-    /**
260
-     * @return int
261
-     */
262
-    public function getParent()
263
-    {
264
-        return $this->parent;
265
-    }
266
-
267
-    /**
268
-     * @param int $parent
269
-     */
270
-    public function setParent($parent)
271
-    {
272
-        $this->parent = $parent;
273
-    }
274
-
275
-    /**
276
-     * @return int
277
-     */
278
-    public function getEmailTemplate()
279
-    {
280
-        return $this->emailtemplate;
281
-    }
282
-
283
-    /**
284
-     * @param int $emailTemplate
285
-     */
286
-    public function setEmailTemplate($emailTemplate)
287
-    {
288
-        $this->emailtemplate = $emailTemplate;
289
-    }
290
-    #endregion
108
+			);
109
+
110
+			$statement->bindValue(":id", $this->id);
111
+			$statement->bindValue(":updateversion", $this->updateversion);
112
+
113
+			$statement->bindValue(":status", $this->status);
114
+			$statement->bindValue(":error", $this->error);
115
+			$statement->bindValue(":ack", $this->acknowledged);
116
+
117
+			if (!$statement->execute()) {
118
+				throw new Exception($statement->errorInfo());
119
+			}
120
+
121
+			if ($statement->rowCount() !== 1) {
122
+				throw new OptimisticLockFailedException();
123
+			}
124
+
125
+			$this->updateversion++;
126
+		}
127
+	}
128
+
129
+	#region Properties
130
+
131
+	/**
132
+	 * @return string
133
+	 */
134
+	public function getTask()
135
+	{
136
+		return $this->task;
137
+	}
138
+
139
+	/**
140
+	 * @param string $task
141
+	 */
142
+	public function setTask($task)
143
+	{
144
+		$this->task = $task;
145
+	}
146
+
147
+	/**
148
+	 * @return int
149
+	 */
150
+	public function getTriggerUserId()
151
+	{
152
+		return $this->user;
153
+	}
154
+
155
+	/**
156
+	 * @param int $user
157
+	 */
158
+	public function setTriggerUserId($user)
159
+	{
160
+		$this->user = $user;
161
+	}
162
+
163
+	/**
164
+	 * @return int
165
+	 */
166
+	public function getRequest()
167
+	{
168
+		return $this->request;
169
+	}
170
+
171
+	/**
172
+	 * @param int $request
173
+	 */
174
+	public function setRequest($request)
175
+	{
176
+		$this->request = $request;
177
+	}
178
+
179
+	/**
180
+	 * @return string
181
+	 */
182
+	public function getStatus()
183
+	{
184
+		return $this->status;
185
+	}
186
+
187
+	/**
188
+	 * @param string $status
189
+	 */
190
+	public function setStatus($status)
191
+	{
192
+		$this->status = $status;
193
+	}
194
+
195
+	/**
196
+	 * @return string
197
+	 */
198
+	public function getEnqueue()
199
+	{
200
+		return $this->enqueue;
201
+	}
202
+
203
+	/**
204
+	 * @param string $enqueue
205
+	 */
206
+	public function setEnqueue($enqueue)
207
+	{
208
+		$this->enqueue = $enqueue;
209
+	}
210
+
211
+	/**
212
+	 * @return string
213
+	 */
214
+	public function getParameters()
215
+	{
216
+		return $this->parameters;
217
+	}
218
+
219
+	/**
220
+	 * @param string $parameters
221
+	 */
222
+	public function setParameters($parameters)
223
+	{
224
+		$this->parameters = $parameters;
225
+	}
226
+
227
+	/**
228
+	 * @return mixed
229
+	 */
230
+	public function getError()
231
+	{
232
+		return $this->error;
233
+	}
234
+
235
+	/**
236
+	 * @param mixed $error
237
+	 */
238
+	public function setError($error)
239
+	{
240
+		$this->error = $error;
241
+	}
242
+
243
+	/**
244
+	 * @return int
245
+	 */
246
+	public function getAcknowledged()
247
+	{
248
+		return $this->acknowledged;
249
+	}
250
+
251
+	/**
252
+	 * @param int $acknowledged
253
+	 */
254
+	public function setAcknowledged($acknowledged)
255
+	{
256
+		$this->acknowledged = $acknowledged;
257
+	}
258
+
259
+	/**
260
+	 * @return int
261
+	 */
262
+	public function getParent()
263
+	{
264
+		return $this->parent;
265
+	}
266
+
267
+	/**
268
+	 * @param int $parent
269
+	 */
270
+	public function setParent($parent)
271
+	{
272
+		$this->parent = $parent;
273
+	}
274
+
275
+	/**
276
+	 * @return int
277
+	 */
278
+	public function getEmailTemplate()
279
+	{
280
+		return $this->emailtemplate;
281
+	}
282
+
283
+	/**
284
+	 * @param int $emailTemplate
285
+	 */
286
+	public function setEmailTemplate($emailTemplate)
287
+	{
288
+		$this->emailtemplate = $emailTemplate;
289
+	}
290
+	#endregion
291 291
 }
292 292
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,8 @@
 block discarded – undo
58 58
     /**
59 59
      * This feels like the least bad place to put this method.
60 60
      */
61
-    public static function getTaskDescriptions() {
61
+    public static function getTaskDescriptions()
62
+    {
62 63
         return array(
63 64
             BotCreationTask::class  => 'Create account (via bot)',
64 65
             UserCreationTask::class => 'Create account (via OAuth)',
Please login to merge, or discard this patch.
includes/ApplicationBase.php 1 patch
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -25,155 +25,155 @@
 block discarded – undo
25 25
 
26 26
 abstract class ApplicationBase
27 27
 {
28
-    private $configuration;
29
-
30
-    public function __construct(SiteConfiguration $configuration)
31
-    {
32
-        $this->configuration = $configuration;
33
-    }
34
-
35
-    /**
36
-     * Application entry point.
37
-     *
38
-     * Sets up the environment and runs the application, performing any global cleanup operations when done.
39
-     */
40
-    public function run()
41
-    {
42
-        try {
43
-            if ($this->setupEnvironment()) {
44
-                $this->main();
45
-            }
46
-        }
47
-        catch (Exception $ex) {
48
-            print $ex->getMessage();
49
-        }
50
-        finally {
51
-            $this->cleanupEnvironment();
52
-        }
53
-    }
54
-
55
-    /**
56
-     * Environment setup
57
-     *
58
-     * This method initialises the tool environment. If the tool cannot be initialised correctly, it will return false
59
-     * and shut down prematurely.
60
-     *
61
-     * @return bool
62
-     * @throws EnvironmentException
63
-     */
64
-    protected function setupEnvironment()
65
-    {
66
-        $this->setupDatabase();
67
-
68
-        return true;
69
-    }
70
-
71
-    /**
72
-     * @return PdoDatabase
73
-     * @throws EnvironmentException
74
-     * @throws Exception
75
-     */
76
-    protected function setupDatabase()
77
-    {
78
-        // check the schema version
79
-        $database = PdoDatabase::getDatabaseConnection('acc');
80
-
81
-        /** @var int $actualVersion */
82
-        $actualVersion = (int)$database->query('SELECT version FROM schemaversion')->fetchColumn();
83
-        if ($actualVersion !== $this->getConfiguration()->getSchemaVersion()) {
84
-            throw new EnvironmentException('Database schema is wrong version! Please either update configuration or database.');
85
-        }
86
-
87
-        return $database;
88
-    }
89
-
90
-    /**
91
-     * @return SiteConfiguration
92
-     */
93
-    public function getConfiguration()
94
-    {
95
-        return $this->configuration;
96
-    }
97
-
98
-    /**
99
-     * Main application logic
100
-     * @return void
101
-     */
102
-    abstract protected function main();
103
-
104
-    /**
105
-     * Any cleanup tasks should go here
106
-     *
107
-     * Note that we need to be very careful here, as exceptions may have been thrown and handled.
108
-     * This should *only* be for cleaning up, no logic should go here.
109
-     *
110
-     * @return void
111
-     */
112
-    abstract protected function cleanupEnvironment();
113
-
114
-    /**
115
-     * @param ITask             $page
116
-     * @param SiteConfiguration $siteConfiguration
117
-     * @param PdoDatabase       $database
118
-     * @param PdoDatabase       $notificationsDatabase
119
-     *
120
-     * @return void
121
-     */
122
-    protected function setupHelpers(
123
-        ITask $page,
124
-        SiteConfiguration $siteConfiguration,
125
-        PdoDatabase $database,
126
-        PdoDatabase $notificationsDatabase = null
127
-    ) {
128
-        $page->setSiteConfiguration($siteConfiguration);
129
-
130
-        // setup the global database object
131
-        $page->setDatabase($database);
132
-
133
-        // set up helpers and inject them into the page.
134
-        $httpHelper = new HttpHelper(
135
-            $siteConfiguration->getUserAgent(),
136
-            $siteConfiguration->getCurlDisableVerifyPeer()
137
-        );
138
-
139
-        $page->setEmailHelper(new EmailHelper());
140
-        $page->setHttpHelper($httpHelper);
141
-        $page->setWikiTextHelper(new WikiTextHelper($siteConfiguration, $page->getHttpHelper()));
142
-
143
-        if ($siteConfiguration->getLocationProviderApiKey() === null) {
144
-            $page->setLocationProvider(new FakeLocationProvider());
145
-        }
146
-        else {
147
-            $page->setLocationProvider(
148
-                new IpLocationProvider(
149
-                    $database,
150
-                    $siteConfiguration->getLocationProviderApiKey(),
151
-                    $httpHelper
152
-                ));
153
-        }
154
-
155
-        $page->setXffTrustProvider(new XffTrustProvider($siteConfiguration->getSquidList(), $database));
156
-
157
-        $page->setRdnsProvider(new CachedRDnsLookupProvider($database));
158
-
159
-        $page->setAntiSpoofProvider(new CachedApiAntispoofProvider(
160
-            $database,
161
-            $this->getConfiguration()->getMediawikiWebServiceEndpoint(),
162
-            $httpHelper));
163
-
164
-        $page->setOAuthProtocolHelper(new OAuthProtocolHelper(
165
-            $siteConfiguration->getOAuthBaseUrl(),
166
-            $siteConfiguration->getOAuthConsumerToken(),
167
-            $siteConfiguration->getOAuthConsumerSecret(),
168
-            $httpHelper,
169
-            $siteConfiguration->getMediawikiWebServiceEndpoint()
170
-        ));
171
-
172
-        $page->setNotificationHelper(new IrcNotificationHelper(
173
-            $siteConfiguration,
174
-            $database,
175
-            $notificationsDatabase));
176
-
177
-        $page->setTorExitProvider(new TorExitProvider($database));
178
-    }
28
+	private $configuration;
29
+
30
+	public function __construct(SiteConfiguration $configuration)
31
+	{
32
+		$this->configuration = $configuration;
33
+	}
34
+
35
+	/**
36
+	 * Application entry point.
37
+	 *
38
+	 * Sets up the environment and runs the application, performing any global cleanup operations when done.
39
+	 */
40
+	public function run()
41
+	{
42
+		try {
43
+			if ($this->setupEnvironment()) {
44
+				$this->main();
45
+			}
46
+		}
47
+		catch (Exception $ex) {
48
+			print $ex->getMessage();
49
+		}
50
+		finally {
51
+			$this->cleanupEnvironment();
52
+		}
53
+	}
54
+
55
+	/**
56
+	 * Environment setup
57
+	 *
58
+	 * This method initialises the tool environment. If the tool cannot be initialised correctly, it will return false
59
+	 * and shut down prematurely.
60
+	 *
61
+	 * @return bool
62
+	 * @throws EnvironmentException
63
+	 */
64
+	protected function setupEnvironment()
65
+	{
66
+		$this->setupDatabase();
67
+
68
+		return true;
69
+	}
70
+
71
+	/**
72
+	 * @return PdoDatabase
73
+	 * @throws EnvironmentException
74
+	 * @throws Exception
75
+	 */
76
+	protected function setupDatabase()
77
+	{
78
+		// check the schema version
79
+		$database = PdoDatabase::getDatabaseConnection('acc');
80
+
81
+		/** @var int $actualVersion */
82
+		$actualVersion = (int)$database->query('SELECT version FROM schemaversion')->fetchColumn();
83
+		if ($actualVersion !== $this->getConfiguration()->getSchemaVersion()) {
84
+			throw new EnvironmentException('Database schema is wrong version! Please either update configuration or database.');
85
+		}
86
+
87
+		return $database;
88
+	}
89
+
90
+	/**
91
+	 * @return SiteConfiguration
92
+	 */
93
+	public function getConfiguration()
94
+	{
95
+		return $this->configuration;
96
+	}
97
+
98
+	/**
99
+	 * Main application logic
100
+	 * @return void
101
+	 */
102
+	abstract protected function main();
103
+
104
+	/**
105
+	 * Any cleanup tasks should go here
106
+	 *
107
+	 * Note that we need to be very careful here, as exceptions may have been thrown and handled.
108
+	 * This should *only* be for cleaning up, no logic should go here.
109
+	 *
110
+	 * @return void
111
+	 */
112
+	abstract protected function cleanupEnvironment();
113
+
114
+	/**
115
+	 * @param ITask             $page
116
+	 * @param SiteConfiguration $siteConfiguration
117
+	 * @param PdoDatabase       $database
118
+	 * @param PdoDatabase       $notificationsDatabase
119
+	 *
120
+	 * @return void
121
+	 */
122
+	protected function setupHelpers(
123
+		ITask $page,
124
+		SiteConfiguration $siteConfiguration,
125
+		PdoDatabase $database,
126
+		PdoDatabase $notificationsDatabase = null
127
+	) {
128
+		$page->setSiteConfiguration($siteConfiguration);
129
+
130
+		// setup the global database object
131
+		$page->setDatabase($database);
132
+
133
+		// set up helpers and inject them into the page.
134
+		$httpHelper = new HttpHelper(
135
+			$siteConfiguration->getUserAgent(),
136
+			$siteConfiguration->getCurlDisableVerifyPeer()
137
+		);
138
+
139
+		$page->setEmailHelper(new EmailHelper());
140
+		$page->setHttpHelper($httpHelper);
141
+		$page->setWikiTextHelper(new WikiTextHelper($siteConfiguration, $page->getHttpHelper()));
142
+
143
+		if ($siteConfiguration->getLocationProviderApiKey() === null) {
144
+			$page->setLocationProvider(new FakeLocationProvider());
145
+		}
146
+		else {
147
+			$page->setLocationProvider(
148
+				new IpLocationProvider(
149
+					$database,
150
+					$siteConfiguration->getLocationProviderApiKey(),
151
+					$httpHelper
152
+				));
153
+		}
154
+
155
+		$page->setXffTrustProvider(new XffTrustProvider($siteConfiguration->getSquidList(), $database));
156
+
157
+		$page->setRdnsProvider(new CachedRDnsLookupProvider($database));
158
+
159
+		$page->setAntiSpoofProvider(new CachedApiAntispoofProvider(
160
+			$database,
161
+			$this->getConfiguration()->getMediawikiWebServiceEndpoint(),
162
+			$httpHelper));
163
+
164
+		$page->setOAuthProtocolHelper(new OAuthProtocolHelper(
165
+			$siteConfiguration->getOAuthBaseUrl(),
166
+			$siteConfiguration->getOAuthConsumerToken(),
167
+			$siteConfiguration->getOAuthConsumerSecret(),
168
+			$httpHelper,
169
+			$siteConfiguration->getMediawikiWebServiceEndpoint()
170
+		));
171
+
172
+		$page->setNotificationHelper(new IrcNotificationHelper(
173
+			$siteConfiguration,
174
+			$database,
175
+			$notificationsDatabase));
176
+
177
+		$page->setTorExitProvider(new TorExitProvider($database));
178
+	}
179 179
 }
180 180
\ No newline at end of file
Please login to merge, or discard this patch.
includes/ConsoleStart.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -15,74 +15,74 @@
 block discarded – undo
15 15
 
16 16
 class ConsoleStart extends ApplicationBase
17 17
 {
18
-    /**
19
-     * @var ConsoleTaskBase
20
-     */
21
-    private $consoleTask;
18
+	/**
19
+	 * @var ConsoleTaskBase
20
+	 */
21
+	private $consoleTask;
22 22
 
23
-    /**
24
-     * ConsoleStart constructor.
25
-     *
26
-     * @param SiteConfiguration $configuration
27
-     * @param ConsoleTaskBase   $consoleTask
28
-     */
29
-    public function __construct(SiteConfiguration $configuration, ConsoleTaskBase $consoleTask)
30
-    {
31
-        parent::__construct($configuration);
32
-        $this->consoleTask = $consoleTask;
33
-    }
23
+	/**
24
+	 * ConsoleStart constructor.
25
+	 *
26
+	 * @param SiteConfiguration $configuration
27
+	 * @param ConsoleTaskBase   $consoleTask
28
+	 */
29
+	public function __construct(SiteConfiguration $configuration, ConsoleTaskBase $consoleTask)
30
+	{
31
+		parent::__construct($configuration);
32
+		$this->consoleTask = $consoleTask;
33
+	}
34 34
 
35
-    protected function setupEnvironment()
36
-    {
37
-        // initialise super-global providers
38
-        WebRequest::setGlobalStateProvider(new FakeGlobalStateProvider());
35
+	protected function setupEnvironment()
36
+	{
37
+		// initialise super-global providers
38
+		WebRequest::setGlobalStateProvider(new FakeGlobalStateProvider());
39 39
 
40
-        if (WebRequest::method() !== null) {
41
-            throw new EnvironmentException('This is a console task, which cannot be executed via the web.');
42
-        }
40
+		if (WebRequest::method() !== null) {
41
+			throw new EnvironmentException('This is a console task, which cannot be executed via the web.');
42
+		}
43 43
 
44
-        return parent::setupEnvironment();
45
-    }
44
+		return parent::setupEnvironment();
45
+	}
46 46
 
47
-    protected function cleanupEnvironment()
48
-    {
49
-    }
47
+	protected function cleanupEnvironment()
48
+	{
49
+	}
50 50
 
51
-    /**
52
-     * Main application logic
53
-     */
54
-    protected function main()
55
-    {
56
-        $database = PdoDatabase::getDatabaseConnection('acc');
51
+	/**
52
+	 * Main application logic
53
+	 */
54
+	protected function main()
55
+	{
56
+		$database = PdoDatabase::getDatabaseConnection('acc');
57 57
 
58
-        if ($this->getConfiguration()->getIrcNotificationsEnabled()) {
59
-            $notificationsDatabase = PdoDatabase::getDatabaseConnection('notifications');
60
-        }
61
-        else {
62
-            // pass through null
63
-            $notificationsDatabase = null;
64
-        }
58
+		if ($this->getConfiguration()->getIrcNotificationsEnabled()) {
59
+			$notificationsDatabase = PdoDatabase::getDatabaseConnection('notifications');
60
+		}
61
+		else {
62
+			// pass through null
63
+			$notificationsDatabase = null;
64
+		}
65 65
 
66
-        $this->setupHelpers($this->consoleTask, $this->getConfiguration(), $database, $notificationsDatabase);
66
+		$this->setupHelpers($this->consoleTask, $this->getConfiguration(), $database, $notificationsDatabase);
67 67
 
68
-        // initialise a database transaction
69
-        if (!$database->beginTransaction()) {
70
-            throw new Exception('Failed to start transaction on primary database.');
71
-        }
68
+		// initialise a database transaction
69
+		if (!$database->beginTransaction()) {
70
+			throw new Exception('Failed to start transaction on primary database.');
71
+		}
72 72
 
73
-        try {
74
-            // run the task
75
-            $this->consoleTask->execute();
73
+		try {
74
+			// run the task
75
+			$this->consoleTask->execute();
76 76
 
77
-            if ($database->hasActiveTransaction()) {
78
-                $database->commit();
79
-            }
80
-        }
81
-        finally {
82
-            // Catch any hanging on transactions
83
-            if ($database->hasActiveTransaction()) {
84
-                $database->rollBack();
85
-            }
86
-        }
87
-    }
77
+			if ($database->hasActiveTransaction()) {
78
+				$database->commit();
79
+			}
80
+		}
81
+		finally {
82
+			// Catch any hanging on transactions
83
+			if ($database->hasActiveTransaction()) {
84
+				$database->rollBack();
85
+			}
86
+		}
87
+	}
88 88
 }
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
includes/ConsoleTasks/RefreshOAuthDataTask.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -17,35 +17,35 @@
 block discarded – undo
17 17
 
18 18
 class RefreshOAuthDataTask extends ConsoleTaskBase
19 19
 {
20
-    public function execute()
21
-    {
22
-        $database = $this->getDatabase();
23
-
24
-        $idList = $database
25
-            ->query('SELECT user FROM oauthtoken WHERE type = \'access\' AND expiry IS NULL')
26
-            ->fetchAll(PDO::FETCH_COLUMN);
27
-
28
-        if (count($idList) > 0) {
29
-            /** @var User[] $users */
30
-            $users = UserSearchHelper::get($database)->inIds($idList)->fetch();
31
-
32
-            $expiredStatement = $database
33
-                ->prepare('UPDATE oauthtoken SET expiry = CURRENT_TIMESTAMP() WHERE user = :u AND type = \'access\'');
34
-
35
-            foreach ($users as $u) {
36
-                $oauth = new OAuthUserHelper($u, $database, $this->getOAuthProtocolHelper(),
37
-                    $this->getSiteConfiguration());
38
-
39
-                try {
40
-                    $oauth->refreshIdentity();
41
-                }
42
-                catch (OAuthException $ex) {
43
-                    $expiredStatement->execute(array(':u' => $u->getId()));
44
-                }
45
-            }
46
-        }
47
-
48
-        $this->getDatabase()
49
-            ->exec('DELETE FROM oauthtoken WHERE expiry IS NOT NULL AND expiry < NOW() AND type = \'request\'');
50
-    }
20
+	public function execute()
21
+	{
22
+		$database = $this->getDatabase();
23
+
24
+		$idList = $database
25
+			->query('SELECT user FROM oauthtoken WHERE type = \'access\' AND expiry IS NULL')
26
+			->fetchAll(PDO::FETCH_COLUMN);
27
+
28
+		if (count($idList) > 0) {
29
+			/** @var User[] $users */
30
+			$users = UserSearchHelper::get($database)->inIds($idList)->fetch();
31
+
32
+			$expiredStatement = $database
33
+				->prepare('UPDATE oauthtoken SET expiry = CURRENT_TIMESTAMP() WHERE user = :u AND type = \'access\'');
34
+
35
+			foreach ($users as $u) {
36
+				$oauth = new OAuthUserHelper($u, $database, $this->getOAuthProtocolHelper(),
37
+					$this->getSiteConfiguration());
38
+
39
+				try {
40
+					$oauth->refreshIdentity();
41
+				}
42
+				catch (OAuthException $ex) {
43
+					$expiredStatement->execute(array(':u' => $u->getId()));
44
+				}
45
+			}
46
+		}
47
+
48
+		$this->getDatabase()
49
+			->exec('DELETE FROM oauthtoken WHERE expiry IS NOT NULL AND expiry < NOW() AND type = \'request\'');
50
+	}
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
includes/ConsoleTasks/ClearOAuthDataTask.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@
 block discarded – undo
14 14
 
15 15
 class ClearOAuthDataTask extends ConsoleTaskBase
16 16
 {
17
-    public function execute()
18
-    {
19
-        $database = $this->getDatabase();
17
+	public function execute()
18
+	{
19
+		$database = $this->getDatabase();
20 20
 
21
-        $users = UserSearchHelper::get($database)->inIds(
22
-            $database->query('SELECT user FROM oauthtoken WHERE type = \'access\'')->fetchColumn());
21
+		$users = UserSearchHelper::get($database)->inIds(
22
+			$database->query('SELECT user FROM oauthtoken WHERE type = \'access\'')->fetchColumn());
23 23
 
24
-        foreach ($users as $u){
25
-            $oauth = new OAuthUserHelper($u, $database, $this->getOAuthProtocolHelper(), $this->getSiteConfiguration());
26
-            $oauth->detach();
27
-        }
24
+		foreach ($users as $u){
25
+			$oauth = new OAuthUserHelper($u, $database, $this->getOAuthProtocolHelper(), $this->getSiteConfiguration());
26
+			$oauth->detach();
27
+		}
28 28
 
29
-        $database->exec('DELETE FROM oauthtoken');
30
-        $database->exec('DELETE FROM oauthidentity');
31
-    }
29
+		$database->exec('DELETE FROM oauthtoken');
30
+		$database->exec('DELETE FROM oauthidentity');
31
+	}
32 32
 }
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         $users = UserSearchHelper::get($database)->inIds(
22 22
             $database->query('SELECT user FROM oauthtoken WHERE type = \'access\'')->fetchColumn());
23 23
 
24
-        foreach ($users as $u){
24
+        foreach ($users as $u) {
25 25
             $oauth = new OAuthUserHelper($u, $database, $this->getOAuthProtocolHelper(), $this->getSiteConfiguration());
26 26
             $oauth->detach();
27 27
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         $users = UserSearchHelper::get($database)->inIds(
22 22
             $database->query('SELECT user FROM oauthtoken WHERE type = \'access\'')->fetchColumn());
23 23
 
24
-        foreach ($users as $u){
24
+        foreach ($users as $u) {
25 25
             $oauth = new OAuthUserHelper($u, $database, $this->getOAuthProtocolHelper(), $this->getSiteConfiguration());
26 26
             $oauth->detach();
27 27
         }
Please login to merge, or discard this patch.
includes/Pages/RequestAction/RequestActionBase.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -19,54 +19,54 @@
 block discarded – undo
19 19
 
20 20
 abstract class RequestActionBase extends InternalPageBase
21 21
 {
22
-    /**
23
-     * @param PdoDatabase $database
24
-     *
25
-     * @return Request
26
-     * @throws ApplicationLogicException
27
-     */
28
-    protected function getRequest(PdoDatabase $database)
29
-    {
30
-        $requestId = WebRequest::postInt('request');
31
-        if ($requestId === null) {
32
-            throw new ApplicationLogicException('Request ID not found');
33
-        }
22
+	/**
23
+	 * @param PdoDatabase $database
24
+	 *
25
+	 * @return Request
26
+	 * @throws ApplicationLogicException
27
+	 */
28
+	protected function getRequest(PdoDatabase $database)
29
+	{
30
+		$requestId = WebRequest::postInt('request');
31
+		if ($requestId === null) {
32
+			throw new ApplicationLogicException('Request ID not found');
33
+		}
34 34
 
35
-        /** @var Request $request */
36
-        $request = Request::getById($requestId, $database);
35
+		/** @var Request $request */
36
+		$request = Request::getById($requestId, $database);
37 37
 
38
-        if ($request === false) {
39
-            throw new ApplicationLogicException('Request not found');
40
-        }
38
+		if ($request === false) {
39
+			throw new ApplicationLogicException('Request not found');
40
+		}
41 41
 
42
-        return $request;
43
-    }
42
+		return $request;
43
+	}
44 44
 
45
-    final protected function checkPosted()
46
-    {
47
-        // if the request was not posted, send the user away.
48
-        if (!WebRequest::wasPosted()) {
49
-            throw new ApplicationLogicException('This page does not support GET methods.');
50
-        }
45
+	final protected function checkPosted()
46
+	{
47
+		// if the request was not posted, send the user away.
48
+		if (!WebRequest::wasPosted()) {
49
+			throw new ApplicationLogicException('This page does not support GET methods.');
50
+		}
51 51
 
52
-        // validate the CSRF token
53
-        $this->validateCSRFToken();
54
-    }
52
+		// validate the CSRF token
53
+		$this->validateCSRFToken();
54
+	}
55 55
 
56
-    /**
57
-     * @param Request     $request
58
-     * @param             $parentTaskId
59
-     * @param User        $user
60
-     * @param PdoDatabase $database
61
-     */
62
-    protected function enqueueWelcomeTask(Request $request, $parentTaskId, User $user, PdoDatabase $database)
63
-    {
64
-        $welcomeTask = new JobQueue();
65
-        $welcomeTask->setTask(WelcomeUserTask::class);
66
-        $welcomeTask->setRequest($request->getId());
67
-        $welcomeTask->setParent($parentTaskId);
68
-        $welcomeTask->setTriggerUserId($user->getId());
69
-        $welcomeTask->setDatabase($database);
70
-        $welcomeTask->save();
71
-    }
56
+	/**
57
+	 * @param Request     $request
58
+	 * @param             $parentTaskId
59
+	 * @param User        $user
60
+	 * @param PdoDatabase $database
61
+	 */
62
+	protected function enqueueWelcomeTask(Request $request, $parentTaskId, User $user, PdoDatabase $database)
63
+	{
64
+		$welcomeTask = new JobQueue();
65
+		$welcomeTask->setTask(WelcomeUserTask::class);
66
+		$welcomeTask->setRequest($request->getId());
67
+		$welcomeTask->setParent($parentTaskId);
68
+		$welcomeTask->setTriggerUserId($user->getId());
69
+		$welcomeTask->setDatabase($database);
70
+		$welcomeTask->save();
71
+	}
72 72
 }
73 73
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Pages/RequestAction/PageDropRequest.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@
 block discarded – undo
15 15
 
16 16
 class PageDropRequest extends PageCloseRequest
17 17
 {
18
-    protected function getTemplate(PdoDatabase $database)
19
-    {
20
-        return EmailTemplate::getDroppedTemplate();
21
-    }
18
+	protected function getTemplate(PdoDatabase $database)
19
+	{
20
+		return EmailTemplate::getDroppedTemplate();
21
+	}
22 22
 
23
-    protected function confirmEmailAlreadySent(Request $request, EmailTemplate $template)
24
-    {
25
-        return false;
26
-    }
23
+	protected function confirmEmailAlreadySent(Request $request, EmailTemplate $template)
24
+	{
25
+		return false;
26
+	}
27 27
 
28
-    protected function confirmAccountCreated(Request $request, EmailTemplate $template)
29
-    {
30
-        return false;
31
-    }
28
+	protected function confirmAccountCreated(Request $request, EmailTemplate $template)
29
+	{
30
+		return false;
31
+	}
32 32
 
33
-    protected function sendMail(Request $request, $mailText, User $currentUser, $ccMailingList)
34
-    {
35
-    }
33
+	protected function sendMail(Request $request, $mailText, User $currentUser, $ccMailingList)
34
+	{
35
+	}
36 36
 }
37 37
\ No newline at end of file
Please login to merge, or discard this patch.