Changeset 4bd869f


Ignore:
Timestamp:
Feb 4, 2012 1:34:57 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
d93805e
Parents:
2c8f426e
Message:
  • WorkingDir?: Reset dates of eepsite files while migrating

to avoid exposing install time (thx Z6)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/startup/WorkingDir.java

    r2c8f426e r4bd869f  
    5656    private static final String PROP_WRAPPER_LOG = "wrapper.logfile";
    5757    private static final String DEFAULT_WRAPPER_LOG = "wrapper.log";
     58    /** Feb 16 2006 */
     59    private static final long EEPSITE_TIMESTAMP = 1140048000000l;
    5860
    5961    /**
     
    166168        // for later news.xml updates (we don't copy initialNews.xml over anymore)
    167169        success &= (new SecureDirectory(dirf, "docs")).mkdir();
     170        // prevent correlation of eepsite timestamps with router first-seen time
     171        touchRecursive(new File(dirf, "eepsite/docroot"), EEPSITE_TIMESTAMP);
    168172
    169173        // Report success or failure
     
    416420        return rv;
    417421    }
     422
     423    /**
     424     * Recursive touch all files in a dir to a given time
     425     *
     426     * @param target the directory or file to touch, must exist
     427     * @param time the timestamp
     428     * @since 0.8.13
     429     */
     430    private static void touchRecursive(File target, long time) {
     431        if (!target.exists())
     432            return;
     433        if (target.isFile()) {
     434            target.setLastModified(time);
     435            return;
     436        }
     437        if (!target.isDirectory())
     438            return;
     439        File children[] = target.listFiles();
     440        if (children == null)
     441            return;
     442        for (int i = 0; i < children.length; i++) {
     443            touchRecursive(children[i], time);
     444        }
     445    }
     446   
    418447}
Note: See TracChangeset for help on using the changeset viewer.