|
|
|
@ -37,29 +37,11 @@ public class robots {
|
|
|
|
|
if (rbc.isProfileDisallowed()) prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.PROFILE, "1");
|
|
|
|
|
|
|
|
|
|
if (rbc.isLockedDisallowed() || rbc.isDirsDisallowed()) {
|
|
|
|
|
final List<String>[] p = getFiles(env.getConfig(SwitchboardConstants.HTROOT_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT));
|
|
|
|
|
if (rbc.isLockedDisallowed()) {
|
|
|
|
|
prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.LOCKED, p[0].size());
|
|
|
|
|
for (int i=0; i<p[0].size(); i++)
|
|
|
|
|
prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.LOCKED + "_" + i + "_page", p[0].get(i));
|
|
|
|
|
}
|
|
|
|
|
if (rbc.isDirsDisallowed()) {
|
|
|
|
|
prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.DIRS, p[1].size());
|
|
|
|
|
for (int i=0; i<p[1].size(); i++)
|
|
|
|
|
prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.DIRS + "_" + i + "_dir", p[1].get(i));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return prop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
private static List<String>[] getFiles(final String htrootPath) {
|
|
|
|
|
final File htroot = new File(htrootPath);
|
|
|
|
|
if (!htroot.exists()) return null;
|
|
|
|
|
final String htrootPath = env.getConfig(SwitchboardConstants.HTROOT_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT);
|
|
|
|
|
final List<String> htrootFiles = new ArrayList<String>();
|
|
|
|
|
final List<String> htrootDirs = new ArrayList<String>();
|
|
|
|
|
final File htroot = new File(htrootPath);
|
|
|
|
|
if (htroot.exists()) {
|
|
|
|
|
final String[] htroots = htroot.list();
|
|
|
|
|
File file;
|
|
|
|
|
for (int i=0, dot; i < htroots.length; i++) {
|
|
|
|
@ -75,6 +57,23 @@ public class robots {
|
|
|
|
|
htrootFiles.add(htroots[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return (List<String>[]) new Object[] { htrootFiles, htrootDirs };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (rbc.isLockedDisallowed()) {
|
|
|
|
|
prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.LOCKED, htrootFiles.size());
|
|
|
|
|
for (int i = 0; i < htrootFiles.size(); i++) {
|
|
|
|
|
prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.LOCKED + "_" + i + "_page", htrootFiles.get(i));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (rbc.isDirsDisallowed()) {
|
|
|
|
|
prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.DIRS, htrootDirs.size());
|
|
|
|
|
for (int i = 0; i < htrootDirs.size(); i++) {
|
|
|
|
|
prop.put(RobotsTxtConfig.ALL + "_" + RobotsTxtConfig.DIRS + "_" + i + "_dir", htrootDirs.get(i));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return prop;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|