tdraier 2005/04/12 12:16:57 CEST
Modified files:
src/java/org/jahia/update/core PatchSlide2.java
Log:
move files to new location
Revision Changes Path
1.2 +19 -1
jahia_update/src/java/org/jahia/update/core/PatchSlide2.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia_update/src/java/org/jahia/update/core/PatchSlide2.java.diff?r1=1.1&r2=1.2&f=h
Index: PatchSlide2.java
===================================================================
RCS file:
/home/cvs/repository/jahia_update/src/java/org/jahia/update/core/PatchSlide2.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PatchSlide2.java 11 Apr 2005 10:23:53 -0000 1.1
+++ PatchSlide2.java 12 Apr 2005 10:16:57 -0000 1.2
@@ -10,6 +10,7 @@
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
+import java.io.File;
/**
* Created by IntelliJ IDEA.
@@ -19,6 +20,7 @@
* To change this template use File | Settings | File Templates.
*/
public class PatchSlide2 extends Patch {
+ private String path;
private DBManager dbManager;
private Map sites;
private Map objects;
@@ -28,6 +30,10 @@
public PatchSlide2(PropertiesManager jahiaProps) {
System.out.println("PatchSlide2 initialized.");
System.out.println(jahiaProps);
+ path = jahiaProps.getProperty("slideContentDiskPath");
+ if (path.startsWith("$context")) {
+ path = path.substring(path.indexOf("/")+1);
+ }
}
public boolean execute() {
@@ -265,7 +271,19 @@
dbManager.query("insert into jahia_autoids
values('JAHIA_SL2_URI',"+uriId+")");
dbManager.query("insert into jahia_autoids
values('JAHIA_SL2_VERSION_HISTORY',"+versionId+")");
dbManager.query("insert into jahia_autoids
values('JAHIA_SL2_BRANCH',"+branchId+")");
-
+ File slideRoot = new File(path);
+ File[] sites = slideRoot.listFiles();
+ for (int i = 0; i < sites.length; i++) {
+ File site = sites[i];
+ File[] files = site.listFiles();
+ File store = new File(site,"store");
+ store.mkdir();
+ new File(site,"work").mkdir();
+ for (int j = 0; j < files.length; j++) {
+ File file = files[j];
+ file.renameTo(new File(store, file.getName()));
+ }
+ }
} catch (Exception e) {
e.printStackTrace();
return false;