Index: trunk/extensions/DSMW/clockEngine/persistentClock.php |
— | — | @@ -1,74 +0,0 @@ |
2 | | -<?php |
3 | | -require_once 'Clock.php'; |
4 | | - |
5 | | -/** |
6 | | - * Persistent clock |
7 | | - * |
8 | | - * @copyright INRIA-LORIA-ECOO project |
9 | | - * @author muller jean-philippe |
10 | | - */ |
11 | | -class persistentClock implements Clock { |
12 | | - |
13 | | - public $mClock; |
14 | | - |
15 | | - |
16 | | - public function __construct() { |
17 | | - ; |
18 | | - |
19 | | - } |
20 | | - |
21 | | - public function __destruct() { |
22 | | - $this->mClock = 0; |
23 | | - } |
24 | | - |
25 | | - public function getValue() { |
26 | | - return $this->mClock; |
27 | | - } |
28 | | - |
29 | | - public function setValue( $i ) { |
30 | | - $this->mClock = $i; |
31 | | - } |
32 | | - |
33 | | - public function incrementClock() { |
34 | | - $this->mClock = $this->mClock + 1; |
35 | | - } |
36 | | - |
37 | | -// public function load() { |
38 | | -// try { |
39 | | -// $fp = fopen(dirname( __FILE__ )."/store.txt", "r"); |
40 | | -// $ck = fread($fp, filesize(dirname( __FILE__ )."/store.txt")); |
41 | | -// fclose($fp); |
42 | | -// $this->mClock = unserialize($ck); |
43 | | -// } catch (Exception $e) { |
44 | | -// throw new Exception ($e); |
45 | | -// } |
46 | | -// |
47 | | -// } |
48 | | -// |
49 | | -// public function store() { |
50 | | -// try { |
51 | | -// $ck = serialize($this->mClock); |
52 | | -// $fp = fopen(dirname( __FILE__ )."/store.txt", "w"); |
53 | | -// fwrite($fp, $ck); |
54 | | -// fclose($fp); |
55 | | -// } catch (Exception $e) { |
56 | | -// throw new Exception ($e); |
57 | | -// } |
58 | | -// |
59 | | -// } |
60 | | - |
61 | | - function load() { |
62 | | - $db = wfGetDB( DB_SLAVE ); |
63 | | - $this->mClock = $db->selectField( 'p2p_params', 'value' ); |
64 | | -} |
65 | | - |
66 | | -function store() { |
67 | | - |
68 | | - $dbw = wfGetDB( DB_MASTER ); |
69 | | - $dbw->update( 'p2p_params', array( |
70 | | - 'value' => $this->mClock, |
71 | | - ), '*', __METHOD__ ); |
72 | | - |
73 | | - } |
74 | | - |
75 | | -} |
Index: trunk/extensions/DSMW/clockEngine/Clock.php |
— | — | @@ -1,17 +1,2 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/** |
5 | | - * @copyright INRIA-LORIA-ECOO project |
6 | | - * @author muller jean-philippe |
7 | | - */ |
8 | | -interface Clock { |
9 | | - public function load(); |
10 | | - |
11 | | - public function store(); |
12 | | - |
13 | | - public function getValue(); |
14 | | - |
15 | | - public function setValue( $i ); |
16 | | - |
17 | | - public function incrementClock(); |
18 | | -} |
\ No newline at end of file |
Index: trunk/extensions/DSMW/DSMW.php |
— | — | @@ -71,10 +71,12 @@ |
72 | 72 | |
73 | 73 | $wgAutoloadClasses['LogootIns'] = "$wgDSMWIP/logootComponent/LogootIns.php"; |
74 | 74 | $wgAutoloadClasses['LogootDel'] = "$wgDSMWIP/logootComponent/LogootDel.php"; |
75 | | -$wgAutoloadClasses['DSMWRevisionManager'] = dirname( __FILE__ ) . '/includes/DSMW_RevisionManager.php'; |
76 | 75 | |
| 76 | +$wgAutoloadClasses['DSMWRevisionManager'] = dirname( __FILE__ ) . '/includes/DSMW_RevisionManager.php'; |
| 77 | +$wgAutoloadClasses['DSMWPersistentClock'] = dirname( __FILE__ ) . '/includes/DSMW_PersistentClock.php'; |
| 78 | + |
77 | 79 | $wgAutoloadClasses['Patch'] = "$wgDSMWIP/patch/Patch.php"; |
78 | | -$wgAutoloadClasses['persistentClock'] = "$wgDSMWIP/clockEngine/persistentClock.php"; |
| 80 | + |
79 | 81 | $wgAutoloadClasses['ApiQueryPatch'] = "$wgDSMWIP/api/ApiQueryPatch.php"; |
80 | 82 | $wgAutoloadClasses['ApiQueryChangeSet'] = "$wgDSMWIP/api/ApiQueryChangeSet.php"; |
81 | 83 | $wgAutoloadClasses['ApiUpload'] = "$wgDSMWIP/api/upload/ApiUpload.php"; |
Index: trunk/extensions/DSMW/files/utils.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | // global $serverId; |
18 | 18 | $serverId = DSMWSiteId::getInstance(); |
19 | 19 | |
20 | | - $pc = new persistentClock(); |
| 20 | + $pc = new DSMWPersistentClock(); |
21 | 21 | $pc->load(); |
22 | 22 | $pc->incrementClock(); |
23 | 23 | $id = /*$wgServerName.$wgScriptPath*/$serverId->getSiteId() . $pc->getValue(); |
Index: trunk/extensions/DSMW/includes/DSMW_PersistentClock.php |
— | — | @@ -0,0 +1,65 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * @copyright INRIA-LORIA-ECOO project |
| 6 | + * @author muller jean-philippe |
| 7 | + */ |
| 8 | +interface Clock { |
| 9 | + public function load(); |
| 10 | + |
| 11 | + public function store(); |
| 12 | + |
| 13 | + public function getValue(); |
| 14 | + |
| 15 | + public function setValue( $i ); |
| 16 | + |
| 17 | + public function incrementClock(); |
| 18 | +} |
| 19 | + |
| 20 | +/** |
| 21 | + * Persistent clock |
| 22 | + * |
| 23 | + * @copyright INRIA-LORIA-ECOO project |
| 24 | + * @author muller jean-philippe |
| 25 | + */ |
| 26 | +class DSMWPersistentClock implements Clock { |
| 27 | + |
| 28 | + public $mClock; |
| 29 | + |
| 30 | + |
| 31 | + public function __construct() { |
| 32 | + ; |
| 33 | + |
| 34 | + } |
| 35 | + |
| 36 | + public function __destruct() { |
| 37 | + $this->mClock = 0; |
| 38 | + } |
| 39 | + |
| 40 | + public function getValue() { |
| 41 | + return $this->mClock; |
| 42 | + } |
| 43 | + |
| 44 | + public function setValue( $i ) { |
| 45 | + $this->mClock = $i; |
| 46 | + } |
| 47 | + |
| 48 | + public function incrementClock() { |
| 49 | + $this->mClock = $this->mClock + 1; |
| 50 | + } |
| 51 | + |
| 52 | + function load() { |
| 53 | + $db = wfGetDB( DB_SLAVE ); |
| 54 | + $this->mClock = $db->selectField( 'p2p_params', 'value' ); |
| 55 | +} |
| 56 | + |
| 57 | +function store() { |
| 58 | + |
| 59 | + $dbw = wfGetDB( DB_MASTER ); |
| 60 | + $dbw->update( 'p2p_params', array( |
| 61 | + 'value' => $this->mClock, |
| 62 | + ), '*', __METHOD__ ); |
| 63 | + |
| 64 | + } |
| 65 | + |
| 66 | +} |
Property changes on: trunk/extensions/DSMW/includes/DSMW_PersistentClock.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 67 | + native |