summaryrefslogtreecommitdiff
path: root/includes/installer/DatabaseUpdater.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-06-04 07:31:04 +0200
committerPierre Schmitz <pierre@archlinux.de>2015-06-04 07:58:39 +0200
commitf6d65e533c62f6deb21342d4901ece24497b433e (patch)
treef28adf0362d14bcd448f7b65a7aaf38650f923aa /includes/installer/DatabaseUpdater.php
parentc27b2e832fe25651ef2410fae85b41072aae7519 (diff)
Update to MediaWiki 1.25.1
Diffstat (limited to 'includes/installer/DatabaseUpdater.php')
-rw-r--r--includes/installer/DatabaseUpdater.php60
1 files changed, 56 insertions, 4 deletions
diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php
index 193d5920..702f850c 100644
--- a/includes/installer/DatabaseUpdater.php
+++ b/includes/installer/DatabaseUpdater.php
@@ -31,6 +31,7 @@ require_once __DIR__ . '/../../maintenance/Maintenance.php';
* @since 1.17
*/
abstract class DatabaseUpdater {
+ protected static $updateCounter = 0;
/**
* Array of updates to perform on the database
@@ -114,7 +115,7 @@ abstract class DatabaseUpdater {
$this->maintenance->setDB( $db );
$this->initOldGlobals();
$this->loadExtensions();
- wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) );
+ Hooks::run( 'LoadExtensionSchemaUpdates', array( $this ) );
}
/**
@@ -460,7 +461,8 @@ abstract class DatabaseUpdater {
if ( !$this->canUseNewUpdatelog() ) {
return;
}
- $key = "updatelist-$version-" . time();
+ $key = "updatelist-$version-" . time() . self::$updateCounter;
+ self::$updateCounter++;
$this->db->insert( 'updatelog',
array( 'ul_key' => $key, 'ul_value' => serialize( $updates ) ),
__METHOD__ );
@@ -610,7 +612,7 @@ abstract class DatabaseUpdater {
* Append a line to the open filehandle. The line is assumed to
* be a complete SQL statement.
*
- * This is used as a callback for for sourceLine().
+ * This is used as a callback for sourceLine().
*
* @param string $line Text to append to the file
* @return bool False to skip actually executing the file
@@ -896,6 +898,29 @@ abstract class DatabaseUpdater {
}
/**
+ * Set any .htaccess files or equivilent for storage repos
+ *
+ * Some zones (e.g. "temp") used to be public and may have been initialized as such
+ */
+ public function setFileAccess() {
+ $repo = RepoGroup::singleton()->getLocalRepo();
+ $zonePath = $repo->getZonePath( 'temp' );
+ if ( $repo->getBackend()->directoryExists( array( 'dir' => $zonePath ) ) ) {
+ // If the directory was never made, then it will have the right ACLs when it is made
+ $status = $repo->getBackend()->secure( array(
+ 'dir' => $zonePath,
+ 'noAccess' => true,
+ 'noListing' => true
+ ) );
+ if ( $status->isOK() ) {
+ $this->output( "Set the local repo temp zone container to be private.\n" );
+ } else {
+ $this->output( "Failed to set the local repo temp zone container to be private.\n" );
+ }
+ }
+ }
+
+ /**
* Purge the objectcache table
*/
public function purgeCache() {
@@ -907,7 +932,9 @@ abstract class DatabaseUpdater {
if ( $wgLocalisationCacheConf['manualRecache'] ) {
$this->rebuildLocalisationCache();
}
- MessageBlobStore::getInstance()->clear();
+ $blobStore = new MessageBlobStore();
+ $blobStore->clear();
+ $this->db->delete( 'module_deps', '*', __METHOD__ );
$this->output( "done.\n" );
}
@@ -1034,6 +1061,31 @@ abstract class DatabaseUpdater {
}
/**
+ * Enable profiling table when it's turned on
+ */
+ protected function doEnableProfiling() {
+ global $wgProfiler;
+
+ if ( !$this->doTable( 'profiling' ) ) {
+ return true;
+ }
+
+ $profileToDb = false;
+ if ( isset( $wgProfiler['output'] ) ) {
+ $out = $wgProfiler['output'];
+ if ( $out === 'db' ) {
+ $profileToDb = true;
+ } elseif ( is_array( $out ) && in_array( 'db', $out ) ) {
+ $profileToDb = true;
+ }
+ }
+
+ if ( $profileToDb && !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
+ $this->applyPatch( 'patch-profiling.sql', false, 'Add profiling table' );
+ }
+ }
+
+ /**
* Rebuilds the localisation cache
*/
protected function rebuildLocalisationCache() {