use of lucee.loader.util.ExtensionFilter in project Lucee by lucee.
the class ConfigServerImpl method getInstalledPatchesOld.
private String[] getInstalledPatchesOld(CFMLEngineFactory factory) throws IOException {
File patchDir = new File(factory.getResourceRoot(), "patches");
if (!patchDir.exists())
patchDir.mkdirs();
File[] patches = patchDir.listFiles(new ExtensionFilter(new String[] { "." + getCoreExtension() }));
List<String> list = new ArrayList<String>();
String name;
int extLen = getCoreExtension().length() + 1;
for (int i = 0; i < patches.length; i++) {
name = patches[i].getName();
name = name.substring(0, name.length() - extLen);
list.add(name);
}
String[] arr = list.toArray(new String[list.size()]);
Arrays.sort(arr);
return arr;
}
use of lucee.loader.util.ExtensionFilter in project Lucee by lucee.
the class CFMLEngineFactory method getInstalledPatches.
public String[] getInstalledPatches() throws ServletException, IOException {
final File patchDir = getPatchDirectory();
final File[] patches = patchDir.listFiles(new ExtensionFilter(new String[] { ".lco" }));
final List<String> list = new ArrayList<String>();
String name;
final int extLen = "rc".length() + 1;
for (final File patche : patches) {
name = patche.getName();
name = name.substring(0, name.length() - extLen);
list.add(name);
}
final String[] arr = list.toArray(new String[list.size()]);
Arrays.sort(arr);
return arr;
}
use of lucee.loader.util.ExtensionFilter in project Lucee by lucee.
the class CFMLEngineFactory method removeLatestUpdate.
private boolean removeLatestUpdate() throws IOException, ServletException {
final File patchDir = getPatchDirectory();
final File[] patches = patchDir.listFiles(new ExtensionFilter(new String[] { ".lco" }));
File patch = null;
for (final File patche : patches) if (patch == null || Util.isNewerThan(toVersion(patche.getName(), VERSION_ZERO), toVersion(patch.getName(), VERSION_ZERO)))
patch = patche;
if (patch != null && !patch.delete())
patch.deleteOnExit();
_restart();
return true;
}
use of lucee.loader.util.ExtensionFilter in project Lucee by lucee.
the class XMLConfigAdmin method changeVersionTo.
public void changeVersionTo(Version version, Password password, IdentificationWeb id) throws PageException {
checkWriteAccess();
ConfigServerImpl cs = (ConfigServerImpl) ConfigImpl.getConfigServer(config, password);
try {
CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory();
cleanUp(factory);
// do we have the core file?
final File patchDir = factory.getPatchDirectory();
File localPath = new File(version.toString() + ".lco");
if (!localPath.isFile()) {
localPath = null;
Version v;
final File[] patches = patchDir.listFiles(new ExtensionFilter(new String[] { ".lco" }));
for (final File patch : patches) {
v = CFMLEngineFactory.toVersion(patch.getName(), null);
// not a valid file get deleted
if (v == null) {
patch.delete();
} else {
if (v.equals(version)) {
// match!
localPath = patch;
} else // delete newer files
if (OSGiUtil.isNewerThan(v, version)) {
patch.delete();
}
}
}
}
// download patch
if (localPath == null) {
downloadCore(factory, version, id);
}
factory.restart(password);
} catch (Exception e) {
throw Caster.toPageException(e);
}
}
use of lucee.loader.util.ExtensionFilter in project Lucee by lucee.
the class XMLConfigAdmin method cleanUp.
private void cleanUp(CFMLEngineFactory factory) throws IOException {
final File patchDir = factory.getPatchDirectory();
final File[] patches = patchDir.listFiles(new ExtensionFilter(new String[] { ".lco" }));
for (final File patch : patches) {
if (!IsZipFile.invoke(patch))
patch.delete();
}
}
Aggregations