r44116 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44115‎ | r44116 | r44117 >
Date:16:22, 1 December 2008
Author:aaron
Status:ok
Tags:
Comment:
*Short-circuit NFS check
*Use unique cv_id key, rather than cv_timestamp for "latest" update query
*Add comments
Modified paths:
  • /trunk/extensions/Configure/Configure.handler-db.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Configure/Configure.handler-db.php
@@ -89,6 +89,7 @@
9090 /**
9191 * Load the current configuration the database (i.e. cv_is_latest == 1)
9292 * directory
 93+ * FIXME: serious O(n) overhead
9394 */
9495 public function getCurrent( $useCache = true ) {
9596 static $ipCached = null;
@@ -97,7 +98,7 @@
9899 return $ipCached;
99100
100101 # Check filesystem cache
101 - if ( ( $cached = $this->getFSCached() ) && $useCache ) {
 102+ if ( $useCache && ( $cached = $this->getFSCached() ) ) {
102103 $this->cacheToFS( $cached );
103104 return $ipCached = $cached;
104105 }
@@ -134,6 +135,7 @@
135136 /**
136137 * Return the old configuration from $ts
137138 * Does *not* return site specific settings but *all* settings
 139+ * FIXME: serious O(n) overhead
138140 *
139141 * @param $ts timestamp
140142 * @return array
@@ -157,6 +159,7 @@
158160
159161 /**
160162 * Returns the wikis in $ts version
 163+ * FIXME: only returns the first match
161164 *
162165 * @param $ts timestamp
163166 * @return array
@@ -222,7 +225,7 @@
223226 $newId = $dbw->insertId();
224227 $dbw->update( 'config_version',
225228 array( 'cv_is_latest' => 0 ),
226 - array( 'cv_wiki' => $wiki, 'cv_timestamp <> ' . $dbw->addQuotes( $dbw->timestamp($ts) ) ),
 229+ array( 'cv_wiki' => $wiki, "cv_id != {$newId}" ),
227230 __METHOD__ );
228231 $insert = array();
229232 foreach ( $settings as $name => $val ) {
@@ -239,6 +242,8 @@
240243
241244 /**
242245 * List all archived versions
 246+ * FIXME: serious O(n) overhead
 247+ * FIXME: timestamp not unique
243248 * @return array of timestamps
244249 */
245250 public function getArchiveVersions() {

Status & tagging log