|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the SVN-Buddy library. |
|
4
|
|
|
* For the full copyright and license information, please view |
|
5
|
|
|
* the LICENSE file that was distributed with this source code. |
|
6
|
|
|
* |
|
7
|
|
|
* @copyright Alexander Obuhovich <[email protected]> |
|
8
|
|
|
* @link https://github.com/console-helpers/svn-buddy |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace ConsoleHelpers\SVNBuddy\Repository\RevisionLog; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
use Aura\Sql\ExtendedPdoInterface; |
|
15
|
|
|
use ConsoleHelpers\SVNBuddy\Database\DatabaseCache; |
|
16
|
|
|
use ConsoleHelpers\SVNBuddy\Database\StatementProfiler; |
|
17
|
|
|
|
|
18
|
|
|
class RepositoryFiller |
|
19
|
|
|
{ |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Database. |
|
23
|
|
|
* |
|
24
|
|
|
* @var ExtendedPdoInterface |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $database; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Database cache. |
|
30
|
|
|
* |
|
31
|
|
|
* @var DatabaseCache |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $databaseCache; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* RepositoryFiller constructor. |
|
37
|
|
|
* |
|
38
|
|
|
* @param ExtendedPdoInterface $database Database. |
|
39
|
|
|
* @param DatabaseCache $database_cache Database cache. |
|
40
|
|
|
*/ |
|
41
|
161 |
|
public function __construct(ExtendedPdoInterface $database, DatabaseCache $database_cache) |
|
42
|
|
|
{ |
|
43
|
161 |
|
$this->database = $database; |
|
44
|
161 |
|
$this->databaseCache = $database_cache; |
|
45
|
|
|
|
|
46
|
161 |
|
$this->databaseCache->cacheTable('Paths'); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Creates a project. |
|
51
|
|
|
* |
|
52
|
|
|
* @param string $path Path. |
|
53
|
|
|
* @param integer $is_deleted Is Deleted. |
|
54
|
|
|
* @param string|null $bug_regexp Bug regexp. |
|
55
|
|
|
* |
|
56
|
|
|
* @return integer |
|
57
|
|
|
*/ |
|
58
|
73 |
|
public function addProject($path, $is_deleted = 0, $bug_regexp = null) |
|
59
|
|
|
{ |
|
60
|
73 |
|
$sql = 'INSERT INTO Projects (Path, IsDeleted, BugRegExp) |
|
61
|
73 |
|
VALUES (:path, :is_deleted, :bug_regexp)'; |
|
62
|
73 |
|
$this->database->perform($sql, array( |
|
63
|
73 |
|
'path' => $path, |
|
64
|
73 |
|
'is_deleted' => $is_deleted, |
|
65
|
73 |
|
'bug_regexp' => $bug_regexp, |
|
66
|
73 |
|
)); |
|
67
|
|
|
|
|
68
|
73 |
|
$project_id = $this->database->lastInsertId(); |
|
69
|
|
|
|
|
70
|
|
|
// There are no "0" revision in repository, but we need to bind project path to some revision. |
|
71
|
73 |
|
if ( $path === '/' ) { |
|
72
|
3 |
|
$this->addPath($path, '', $path, 0); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
73 |
|
return $project_id; |
|
|
|
|
|
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Changes project status. |
|
80
|
|
|
* |
|
81
|
|
|
* @param integer $project_id Project ID. |
|
82
|
|
|
* @param integer $is_deleted Is deleted flag. |
|
83
|
|
|
* |
|
84
|
|
|
* @return void |
|
85
|
|
|
*/ |
|
86
|
9 |
|
public function setProjectStatus($project_id, $is_deleted) |
|
87
|
|
|
{ |
|
88
|
9 |
|
$sql = 'UPDATE Projects |
|
89
|
|
|
SET IsDeleted = :is_deleted |
|
90
|
9 |
|
WHERE Id = :id'; |
|
91
|
9 |
|
$this->database->perform($sql, array( |
|
92
|
9 |
|
'is_deleted' => (int)$is_deleted, |
|
93
|
9 |
|
'id' => $project_id, |
|
94
|
9 |
|
)); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Changes project bug regexp. |
|
99
|
|
|
* |
|
100
|
|
|
* @param integer $project_id Project ID. |
|
101
|
|
|
* @param string|null $bug_regexp Bug regexp. |
|
102
|
|
|
* |
|
103
|
|
|
* @return void |
|
104
|
|
|
*/ |
|
105
|
13 |
|
public function setProjectBugRegexp($project_id, $bug_regexp) |
|
106
|
|
|
{ |
|
107
|
13 |
|
$sql = 'UPDATE Projects |
|
108
|
|
|
SET BugRegExp = :bug_regexp |
|
109
|
13 |
|
WHERE Id = :id'; |
|
110
|
13 |
|
$this->database->perform($sql, array( |
|
111
|
13 |
|
'bug_regexp' => $bug_regexp, |
|
112
|
13 |
|
'id' => $project_id, |
|
113
|
13 |
|
)); |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* Adds commit. |
|
118
|
|
|
* |
|
119
|
|
|
* @param integer $revision Revision. |
|
120
|
|
|
* @param string $author Author. |
|
121
|
|
|
* @param integer $date Date. |
|
122
|
|
|
* @param string $message Message. |
|
123
|
|
|
* |
|
124
|
|
|
* @return void |
|
125
|
|
|
*/ |
|
126
|
74 |
|
public function addCommit($revision, $author, $date, $message) |
|
127
|
|
|
{ |
|
128
|
74 |
|
$sql = 'INSERT INTO Commits (Revision, Author, Date, Message) |
|
129
|
74 |
|
VALUES (:revision, :author, :date, :message)'; |
|
130
|
74 |
|
$this->database->perform($sql, array( |
|
131
|
74 |
|
'revision' => $revision, |
|
132
|
74 |
|
'author' => $author, |
|
133
|
74 |
|
'date' => $date, |
|
134
|
74 |
|
'message' => $message, |
|
135
|
74 |
|
)); |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* Removes commit. |
|
140
|
|
|
* |
|
141
|
|
|
* @param integer $revision Revision. |
|
142
|
|
|
* |
|
143
|
|
|
* @return void |
|
144
|
|
|
*/ |
|
145
|
3 |
|
public function removeCommit($revision) |
|
146
|
|
|
{ |
|
147
|
3 |
|
$sql = 'DELETE FROM Commits |
|
148
|
3 |
|
WHERE Revision = :revision'; |
|
149
|
3 |
|
$this->database->perform($sql, array( |
|
150
|
3 |
|
'revision' => $revision, |
|
151
|
3 |
|
)); |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* Adds commit to project. |
|
156
|
|
|
* |
|
157
|
|
|
* @param integer $revision Revision. |
|
158
|
|
|
* @param integer $project_id Project ID. |
|
159
|
|
|
* |
|
160
|
|
|
* @return void |
|
161
|
|
|
*/ |
|
162
|
63 |
|
public function addCommitToProject($revision, $project_id) |
|
163
|
|
|
{ |
|
164
|
63 |
|
$sql = 'INSERT INTO CommitProjects (ProjectId, Revision) |
|
165
|
63 |
|
VALUES (:project_id, :revision)'; |
|
166
|
63 |
|
$this->database->perform($sql, array('project_id' => $project_id, 'revision' => $revision)); |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* Adds path. |
|
171
|
|
|
* |
|
172
|
|
|
* @param string $path Path. |
|
173
|
|
|
* @param string $ref Ref. |
|
174
|
|
|
* @param string $project_path Project path. |
|
175
|
|
|
* @param integer $revision Revision. |
|
176
|
|
|
* |
|
177
|
|
|
* @return integer |
|
178
|
|
|
*/ |
|
179
|
83 |
|
public function addPath($path, $ref, $project_path, $revision) |
|
180
|
|
|
{ |
|
181
|
83 |
|
$sql = 'INSERT INTO Paths ( |
|
182
|
|
|
Path, PathNestingLevel, PathHash, RefName, ProjectPath, RevisionAdded, RevisionLastSeen |
|
183
|
|
|
) |
|
184
|
83 |
|
VALUES (:path, :path_nesting_level, :path_hash, :ref, :project_path, :revision, :revision)'; |
|
185
|
83 |
|
$this->database->perform($sql, array( |
|
186
|
83 |
|
'path' => $path, |
|
187
|
83 |
|
'path_nesting_level' => substr_count($path, '/') - 1, |
|
188
|
83 |
|
'path_hash' => $this->getPathChecksum($path), |
|
189
|
83 |
|
'ref' => $ref, |
|
190
|
83 |
|
'project_path' => $project_path, |
|
191
|
83 |
|
'revision' => $revision, |
|
192
|
83 |
|
)); |
|
193
|
83 |
|
$path_id = $this->database->lastInsertId(); |
|
194
|
|
|
|
|
195
|
83 |
|
$this->propagateRevisionLastSeen($path, $revision); |
|
196
|
|
|
|
|
197
|
83 |
|
return $path_id; |
|
|
|
|
|
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
/** |
|
201
|
|
|
* Adds path to commit. |
|
202
|
|
|
* |
|
203
|
|
|
* @param integer $revision Revision. |
|
204
|
|
|
* @param string $action Action. |
|
205
|
|
|
* @param string $kind Kind. |
|
206
|
|
|
* @param integer $path_id Path ID. |
|
207
|
|
|
* @param integer|null $copy_revision Copy revision. |
|
208
|
|
|
* @param integer|null $copy_path_id Copy path ID. |
|
209
|
|
|
* |
|
210
|
|
|
* @return void |
|
211
|
|
|
*/ |
|
212
|
76 |
|
public function addPathToCommit($revision, $action, $kind, $path_id, $copy_revision = null, $copy_path_id = null) |
|
213
|
|
|
{ |
|
214
|
76 |
|
$sql = 'INSERT INTO CommitPaths (Revision, Action, Kind, PathId, CopyRevision, CopyPathId) |
|
215
|
76 |
|
VALUES (:revision, :action, :kind, :path_id, :copy_revision, :copy_path_id)'; |
|
216
|
76 |
|
$this->database->perform($sql, array( |
|
217
|
76 |
|
'revision' => $revision, |
|
218
|
76 |
|
'action' => $action, |
|
219
|
76 |
|
'kind' => $kind, |
|
220
|
76 |
|
'path_id' => $path_id, |
|
221
|
76 |
|
'copy_revision' => $copy_revision, |
|
222
|
76 |
|
'copy_path_id' => $copy_path_id, |
|
223
|
76 |
|
)); |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* Touches given path. |
|
228
|
|
|
* |
|
229
|
|
|
* @param string $path Path. |
|
230
|
|
|
* @param integer $revision Revision. |
|
231
|
|
|
* @param array $fields_hash Fields hash. |
|
232
|
|
|
* |
|
233
|
|
|
* @return array |
|
234
|
|
|
* @throws \InvalidArgumentException When "$fields_hash" is empty. |
|
235
|
|
|
*/ |
|
236
|
35 |
|
public function touchPath($path, $revision, array $fields_hash) |
|
237
|
|
|
{ |
|
238
|
35 |
|
if ( !$fields_hash ) { |
|
|
|
|
|
|
239
|
1 |
|
throw new \InvalidArgumentException('The "$fields_hash" variable can\'t be empty.'); |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
34 |
|
$path_hash = $this->getPathChecksum($path); |
|
243
|
34 |
|
$to_update = $this->propagateRevisionLastSeen($path, $revision); |
|
244
|
34 |
|
$to_update[$path_hash] = $fields_hash; |
|
245
|
|
|
|
|
246
|
34 |
|
$bind_params = array_values($fields_hash); |
|
247
|
34 |
|
$bind_params[] = $path_hash; |
|
248
|
|
|
|
|
249
|
34 |
|
$sql = 'UPDATE Paths |
|
250
|
34 |
|
SET ' . implode(' = ?, ', array_keys($fields_hash)) . ' = ? |
|
251
|
34 |
|
WHERE PathHash = ?'; |
|
252
|
34 |
|
$this->database->perform($sql, $bind_params); |
|
253
|
|
|
|
|
254
|
34 |
|
return $to_update; |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
/** |
|
258
|
|
|
* Propagates revision last seen. |
|
259
|
|
|
* |
|
260
|
|
|
* @param string $path Path. |
|
261
|
|
|
* @param string $revision Revision. |
|
262
|
|
|
* |
|
263
|
|
|
* @return array |
|
264
|
|
|
*/ |
|
265
|
83 |
|
protected function propagateRevisionLastSeen($path, $revision) |
|
266
|
|
|
{ |
|
267
|
83 |
|
$to_update = array(); |
|
268
|
83 |
|
$update_path = $path; |
|
269
|
|
|
|
|
270
|
83 |
|
$select_sql = 'SELECT RevisionLastSeen FROM Paths WHERE PathHash = :path_hash'; |
|
271
|
83 |
|
$update_sql = 'UPDATE Paths SET RevisionLastSeen = :revision WHERE PathHash = :path_hash'; |
|
272
|
|
|
|
|
273
|
83 |
|
while ( ($update_path = dirname($update_path) . '/') !== '//' ) { |
|
274
|
78 |
|
$update_path_hash = $this->getPathChecksum($update_path); |
|
275
|
|
|
|
|
276
|
78 |
|
$fields_hash = $this->databaseCache->getFromCache( |
|
277
|
78 |
|
'Paths', |
|
278
|
78 |
|
$update_path_hash . '/' . __METHOD__, |
|
279
|
78 |
|
$select_sql, |
|
280
|
78 |
|
array('path_hash' => $update_path_hash) |
|
281
|
78 |
|
); |
|
282
|
|
|
|
|
283
|
|
|
// Missing parent path. Can happen for example, when repository was created via "cvs2svn". |
|
284
|
78 |
|
if ( $fields_hash === false ) { |
|
285
|
54 |
|
$profiler = $this->database->getProfiler(); |
|
286
|
|
|
|
|
287
|
54 |
|
if ( $profiler instanceof StatementProfiler ) { |
|
288
|
12 |
|
$profiler->removeProfile($select_sql, array('path_hash' => $update_path_hash)); |
|
289
|
|
|
} |
|
290
|
54 |
|
break; |
|
291
|
|
|
} |
|
292
|
|
|
|
|
293
|
|
|
// TODO: Collect these paths and issue single update after cycle finishes. |
|
294
|
39 |
|
if ( (int)$fields_hash['RevisionLastSeen'] < $revision ) { |
|
295
|
30 |
|
$this->database->perform( |
|
296
|
30 |
|
$update_sql, |
|
297
|
30 |
|
array('revision' => $revision, 'path_hash' => $update_path_hash) |
|
298
|
30 |
|
); |
|
299
|
|
|
|
|
300
|
30 |
|
$fields_hash = array('RevisionLastSeen' => $revision); |
|
301
|
30 |
|
$this->databaseCache->setIntoCache('Paths', $update_path_hash . '/' . __METHOD__, $fields_hash); |
|
302
|
30 |
|
$to_update[$update_path_hash] = $fields_hash; |
|
303
|
|
|
} |
|
304
|
|
|
}; |
|
305
|
|
|
|
|
306
|
83 |
|
return $to_update; |
|
307
|
|
|
} |
|
308
|
|
|
|
|
309
|
|
|
/** |
|
310
|
|
|
* Returns fields, that needs to be changed for given path. |
|
311
|
|
|
* |
|
312
|
|
|
* @param string $action Action. |
|
313
|
|
|
* @param integer $revision Revision. |
|
314
|
|
|
* @param array $path_data Path data. |
|
315
|
|
|
* |
|
316
|
|
|
* @return array |
|
317
|
|
|
*/ |
|
318
|
40 |
|
public function getPathTouchFields($action, $revision, array $path_data) |
|
319
|
|
|
{ |
|
320
|
40 |
|
$fields_hash = array(); |
|
321
|
|
|
|
|
322
|
40 |
|
if ( $action === 'D' ) { |
|
323
|
6 |
|
$fields_hash['RevisionDeleted'] = $revision; |
|
324
|
|
|
} |
|
325
|
|
|
else { |
|
326
|
37 |
|
if ( $path_data['RevisionDeleted'] > 0 ) { |
|
327
|
4 |
|
$fields_hash['RevisionDeleted'] = null; |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
37 |
|
if ( $action === 'A' && $path_data['RevisionAdded'] > $revision ) { |
|
331
|
2 |
|
$fields_hash['RevisionAdded'] = $revision; |
|
332
|
|
|
} |
|
333
|
|
|
|
|
334
|
37 |
|
if ( $path_data['RevisionLastSeen'] < $revision ) { |
|
335
|
34 |
|
$fields_hash['RevisionLastSeen'] = $revision; |
|
336
|
|
|
} |
|
337
|
|
|
} |
|
338
|
|
|
|
|
339
|
40 |
|
return $fields_hash; |
|
340
|
|
|
} |
|
341
|
|
|
|
|
342
|
|
|
/** |
|
343
|
|
|
* Sets project path for given paths. |
|
344
|
|
|
* |
|
345
|
|
|
* @param array $path_ids Path IDs. |
|
346
|
|
|
* @param string $project_path Project path. |
|
347
|
|
|
* |
|
348
|
|
|
* @return void |
|
349
|
|
|
*/ |
|
350
|
4 |
|
public function movePathsIntoProject(array $path_ids, $project_path) |
|
351
|
|
|
{ |
|
352
|
4 |
|
$sql = 'UPDATE Paths |
|
353
|
|
|
SET ProjectPath = :path |
|
354
|
4 |
|
WHERE Id IN (:path_ids)'; |
|
355
|
4 |
|
$this->database->perform($sql, array( |
|
356
|
4 |
|
'path' => $project_path, |
|
357
|
4 |
|
'path_ids' => $path_ids, |
|
358
|
4 |
|
)); |
|
359
|
|
|
} |
|
360
|
|
|
|
|
361
|
|
|
/** |
|
362
|
|
|
* Adds commit with bugs. |
|
363
|
|
|
* |
|
364
|
|
|
* @param array $bugs Bugs. |
|
365
|
|
|
* @param integer $revision Revision. |
|
366
|
|
|
* |
|
367
|
|
|
* @return void |
|
368
|
|
|
*/ |
|
369
|
64 |
|
public function addBugsToCommit(array $bugs, $revision) |
|
370
|
|
|
{ |
|
371
|
64 |
|
foreach ( $bugs as $bug ) { |
|
372
|
11 |
|
$sql = 'INSERT INTO CommitBugs (Revision, Bug) |
|
373
|
11 |
|
VALUES (:revision, :bug)'; |
|
374
|
11 |
|
$this->database->perform($sql, array( |
|
375
|
11 |
|
'revision' => $revision, |
|
376
|
11 |
|
'bug' => $bug, |
|
377
|
11 |
|
)); |
|
378
|
|
|
} |
|
379
|
|
|
} |
|
380
|
|
|
|
|
381
|
|
|
/** |
|
382
|
|
|
* Removes commit with bugs. |
|
383
|
|
|
* |
|
384
|
|
|
* @param integer $revision Revision. |
|
385
|
|
|
* |
|
386
|
|
|
* @return integer |
|
387
|
|
|
*/ |
|
388
|
2 |
|
public function removeBugsFromCommit($revision) |
|
389
|
|
|
{ |
|
390
|
2 |
|
$sql = 'DELETE FROM CommitBugs |
|
391
|
2 |
|
WHERE Revision = :revision'; |
|
392
|
|
|
|
|
393
|
2 |
|
return $this->database->fetchAffected($sql, array('revision' => $revision)); |
|
394
|
|
|
} |
|
395
|
|
|
|
|
396
|
|
|
/** |
|
397
|
|
|
* Adds merge commit. |
|
398
|
|
|
* |
|
399
|
|
|
* @param integer $revision Revision. |
|
400
|
|
|
* @param array $merged_revisions Merged revisions. |
|
401
|
|
|
* |
|
402
|
|
|
* @return void |
|
403
|
|
|
*/ |
|
404
|
66 |
|
public function addMergeCommit($revision, array $merged_revisions) |
|
405
|
|
|
{ |
|
406
|
66 |
|
foreach ( $merged_revisions as $merged_revision ) { |
|
407
|
12 |
|
$sql = 'INSERT INTO Merges (MergeRevision, MergedRevision) |
|
408
|
12 |
|
VALUES (:merge_revision, :merged_revision)'; |
|
409
|
12 |
|
$this->database->perform($sql, array( |
|
410
|
12 |
|
'merge_revision' => $revision, |
|
411
|
12 |
|
'merged_revision' => $merged_revision, |
|
412
|
12 |
|
)); |
|
413
|
|
|
} |
|
414
|
|
|
} |
|
415
|
|
|
|
|
416
|
|
|
/** |
|
417
|
|
|
* Removes merge commit. |
|
418
|
|
|
* |
|
419
|
|
|
* @param integer $revision Revision. |
|
420
|
|
|
* |
|
421
|
|
|
* @return integer |
|
422
|
|
|
*/ |
|
423
|
3 |
|
public function removeMergeCommit($revision) |
|
424
|
|
|
{ |
|
425
|
3 |
|
$sql = 'DELETE FROM Merges |
|
426
|
3 |
|
WHERE MergeRevision = :merge_revision'; |
|
427
|
|
|
|
|
428
|
3 |
|
return $this->database->fetchAffected($sql, array( |
|
429
|
3 |
|
'merge_revision' => $revision, |
|
430
|
3 |
|
)); |
|
431
|
|
|
} |
|
432
|
|
|
|
|
433
|
|
|
/** |
|
434
|
|
|
* Adds ref to project. |
|
435
|
|
|
* |
|
436
|
|
|
* @param string $ref Ref. |
|
437
|
|
|
* @param integer $project_id Project ID. |
|
438
|
|
|
* |
|
439
|
|
|
* @return integer |
|
440
|
|
|
*/ |
|
441
|
41 |
|
public function addRefToProject($ref, $project_id) |
|
442
|
|
|
{ |
|
443
|
41 |
|
$sql = 'INSERT INTO ProjectRefs (ProjectId, Name) |
|
444
|
41 |
|
VALUES (:project_id, :name)'; |
|
445
|
41 |
|
$this->database->perform($sql, array('project_id' => $project_id, 'name' => $ref)); |
|
446
|
|
|
|
|
447
|
41 |
|
return $this->database->lastInsertId(); |
|
|
|
|
|
|
448
|
|
|
} |
|
449
|
|
|
|
|
450
|
|
|
/** |
|
451
|
|
|
* Adds ref to commit and commit to project. |
|
452
|
|
|
* |
|
453
|
|
|
* @param integer $revision Revision. |
|
454
|
|
|
* @param integer $ref_id Ref ID. |
|
455
|
|
|
* |
|
456
|
|
|
* @return void |
|
457
|
|
|
*/ |
|
458
|
40 |
|
public function addCommitToRef($revision, $ref_id) |
|
459
|
|
|
{ |
|
460
|
40 |
|
$sql = 'INSERT INTO CommitRefs (Revision, RefId) |
|
461
|
40 |
|
VALUES (:revision, :ref_id)'; |
|
462
|
40 |
|
$this->database->perform($sql, array('revision' => $revision, 'ref_id' => $ref_id)); |
|
463
|
|
|
} |
|
464
|
|
|
|
|
465
|
|
|
/** |
|
466
|
|
|
* Returns unsigned checksum of the path. |
|
467
|
|
|
* |
|
468
|
|
|
* @param string $path Path. |
|
469
|
|
|
* |
|
470
|
|
|
* @return integer |
|
471
|
|
|
*/ |
|
472
|
83 |
|
public function getPathChecksum($path) |
|
473
|
|
|
{ |
|
474
|
83 |
|
return sprintf('%u', crc32($path)); |
|
|
|
|
|
|
475
|
|
|
} |
|
476
|
|
|
|
|
477
|
|
|
} |
|
478
|
|
|
|