Author: vmassol
Date: 2007-11-28 09:06:22 +0100 (Wed, 28 Nov 2007)
New Revision: 6106

Modified:
   
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/migration/AbstractXWikiMigrationManager.java
Log:
XWIKI-1900: Allow database migrations also for multiwikis

Small refactorings

Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/migration/AbstractXWikiMigrationManager.java
===================================================================
--- 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/migration/AbstractXWikiMigrationManager.java
 2007-11-28 08:05:16 UTC (rev 6105)
+++ 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/store/migration/AbstractXWikiMigrationManager.java
 2007-11-28 08:06:22 UTC (rev 6106)
@@ -74,8 +74,6 @@
     {
         if (context.getWiki().isVirtual()) {
             // Save context values so that we can restore them as they were 
before the migration.
-            String currentWikiOwner = context.getWikiOwner();
-            XWikiDocument currentWikiServer = context.getWikiServer();
             boolean currentIsVirtual = context.isVirtual();
             String currentDatabase = context.getDatabase();
             String currentOriginalDatabase = context.getOriginalDatabase();
@@ -85,12 +83,12 @@
                     String database = (String) it.next();
                     LOG.info("Starting migration for database [" + database + 
"]...");
                     // Set up the context so that it points to the virtual 
wiki corresponding to the database.
-                    setContextForDatabase(database, context);
+                    context.setVirtual(true);
+                    context.setDatabase(database);
+                    context.setOriginalDatabase(database);
                     startMigrationsForDatabase(context);
                 }
             } finally {
-                context.setWikiOwner(currentWikiOwner);
-                context.setWikiServer(currentWikiServer);
                 context.setVirtual(currentIsVirtual);
                 context.setDatabase(currentDatabase);
                 context.setOriginalDatabase(currentOriginalDatabase);
@@ -102,19 +100,6 @@
     }
 
     /**
-     * Sets the XWiki Context so that it points to the passed databasse name
-     *
-     * @param databaseName the name of the database to point to. Example: 
"xwiki"
-     */
-    protected void setContextForDatabase(String databaseName, XWikiContext 
context) throws XWikiException
-    {
-        context.setVirtual(true);
-        context.setDatabase(databaseName);
-        context.setOriginalDatabase(databaseName);
-    }
-
-
-    /**
      * @return the names of all databases to migrate. This is controlled 
through the "xwiki.store.migration.databases"
      *         configuration property in xwiki.cfg. A value of "all" will add 
all databases. Note that the main database
      *         is automatically added even if not specified.

_______________________________________________
notifications mailing list
notifications@xwiki.org
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to