r77841 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77840‎ | r77841 | r77842 >
Date:22:59, 5 December 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Rename and move
Modified paths:
  • /trunk/extensions/DSMW/DSMW.php (modified) (history)
  • /trunk/extensions/DSMW/clockEngine/Clock.php (modified) (history)
  • /trunk/extensions/DSMW/clockEngine/persistentClock.php (deleted) (history)
  • /trunk/extensions/DSMW/files/utils.php (modified) (history)
  • /trunk/extensions/DSMW/includes/DSMW_PersistentClock.php (added) (history)

Diff [purge]

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 @@
22 <?php
33
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 @@
7272
7373 $wgAutoloadClasses['LogootIns'] = "$wgDSMWIP/logootComponent/LogootIns.php";
7474 $wgAutoloadClasses['LogootDel'] = "$wgDSMWIP/logootComponent/LogootDel.php";
75 -$wgAutoloadClasses['DSMWRevisionManager'] = dirname( __FILE__ ) . '/includes/DSMW_RevisionManager.php';
7675
 76+$wgAutoloadClasses['DSMWRevisionManager'] = dirname( __FILE__ ) . '/includes/DSMW_RevisionManager.php';
 77+$wgAutoloadClasses['DSMWPersistentClock'] = dirname( __FILE__ ) . '/includes/DSMW_PersistentClock.php';
 78+
7779 $wgAutoloadClasses['Patch'] = "$wgDSMWIP/patch/Patch.php";
78 -$wgAutoloadClasses['persistentClock'] = "$wgDSMWIP/clockEngine/persistentClock.php";
 80+
7981 $wgAutoloadClasses['ApiQueryPatch'] = "$wgDSMWIP/api/ApiQueryPatch.php";
8082 $wgAutoloadClasses['ApiQueryChangeSet'] = "$wgDSMWIP/api/ApiQueryChangeSet.php";
8183 $wgAutoloadClasses['ApiUpload'] = "$wgDSMWIP/api/upload/ApiUpload.php";
Index: trunk/extensions/DSMW/files/utils.php
@@ -16,7 +16,7 @@
1717 // global $serverId;
1818 $serverId = DSMWSiteId::getInstance();
1919
20 - $pc = new persistentClock();
 20+ $pc = new DSMWPersistentClock();
2121 $pc->load();
2222 $pc->incrementClock();
2323 $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
167 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r77842Follow up to r77841 - removed obsolete directoryjeroendedauw23:01, 5 December 2010

Status & tagging log