dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a3e692e
)
Cleanup to r69187: forgot to safeguard against ul_value or updatelog itself not existing.
author
Chad Horohoe
<demon@users.mediawiki.org>
Sun, 11 Jul 2010 12:31:44 +0000
(12:31 +0000)
committer
Chad Horohoe
<demon@users.mediawiki.org>
Sun, 11 Jul 2010 12:31:44 +0000
(12:31 +0000)
includes/installer/Update.php
patch
|
blob
|
history
diff --git
a/includes/installer/Update.php
b/includes/installer/Update.php
index
3192c9e
..
2fcaeb0
100644
(file)
--- a/
includes/installer/Update.php
+++ b/
includes/installer/Update.php
@@
-9,7
+9,7
@@
class Update {
// Array of updates to perform on the database
protected $updates = array();
// Array of updates to perform on the database
protected $updates = array();
- // Thing we'll need
+ // Thing
s
we'll need
protected $db, $updater;
public function __construct( $db ) {
protected $db, $updater;
public function __construct( $db ) {
@@
-41,6
+41,12
@@
class Update {
}
protected function loadUpdates() {
}
protected function loadUpdates() {
+ // If the updatelog table hasn't been upgraded, we can't use the new
+ // style of recording our steps. Run all to be safe
+ if( !$this->canUseNewUpdatelog() ) {
+ $this->updates = $this->updater->getUpdates();
+ return;
+ }
foreach( $this->updater->getUpdates() as $version => $updates ) {
$appliedUpdates = $this->getAppliedUpdates( $version );
if( !$appliedUpdates || $appliedUpdates != $updates ) {
foreach( $this->updater->getUpdates() as $version => $updates ) {
$appliedUpdates = $this->getAppliedUpdates( $version );
if( !$appliedUpdates || $appliedUpdates != $updates ) {
@@
-49,7
+55,7
@@
class Update {
}
}
}
}
- pr
ivate
function getAppliedUpdates( $version ) {
+ pr
otected
function getAppliedUpdates( $version ) {
$key = "updatelist-$version";
$val = $this->db->selectField( 'updatelog', 'ul_value',
array( 'ul_key' => $key ), __METHOD__ );
$key = "updatelist-$version";
$val = $this->db->selectField( 'updatelog', 'ul_value',
array( 'ul_key' => $key ), __METHOD__ );
@@
-61,10
+67,27
@@
class Update {
}
private function setAppliedUpdates( $version, $updates = array() ) {
}
private function setAppliedUpdates( $version, $updates = array() ) {
+ if( !$this->canUseNewUpdatelog() ) {
+ $this->updates = $this->updater->getUpdates();
+ return;
+ }
$key = "updatelist-$version";
$this->db->delete( 'updatelog', array( 'ul_key' => $key ), __METHOD__ );
$this->db->insert( 'updatelog',
array( 'ul_key' => $key, 'ul_value' => serialize( $updates ) ),
__METHOD__ );
}
$key = "updatelist-$version";
$this->db->delete( 'updatelog', array( 'ul_key' => $key ), __METHOD__ );
$this->db->insert( 'updatelog',
array( 'ul_key' => $key, 'ul_value' => serialize( $updates ) ),
__METHOD__ );
}
+
+ /**
+ * Updatelog was changed in 1.17 to have a ul_value column so we can record
+ * more information about what kind of updates we've done (that's what this
+ * class does). Pre-1.17 wikis won't have this column, and really old wikis
+ * might not even have updatelog at all
+ *
+ * @return boolean
+ */
+ protected function canUseNewUpdatelog() {
+ return $this->db->tableExists( 'updatelog' ) &&
+ $this->db->fieldExists( 'updatelog', 'ul_value' );
+ }
}
}