diff --git a/lib/updater.php b/lib/updater.php
index 8e86c53..b6cebc6 100644
--- a/lib/updater.php
+++ b/lib/updater.php
@@ -14,6 +14,33 @@ define('PATH', '../tmp/oldVersion/');
$updateDone = false;
function startUpdate() {
+ // First, check old version is entirely moveable
+ $source = "../";
+ $cantMoveArray = array();
+ echo 'Checking we can entirely move old ICEcoder version...
';
+ foreach ($iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),RecursiveIteratorIterator::SELF_FIRST) as $item) {
+ if (strpos($source.DIRECTORY_SEPARATOR.$iterator->getSubPathName(),"oldVersion")==false) {
+ // Don't move plugins or .git away
+ $testPath = $source.DIRECTORY_SEPARATOR.$iterator->getSubPathName();
+ $testPath = str_replace("\\","/",$testPath);
+ if (strpos($testPath,"/plugins/")==false && strpos($testPath,"/.git/")==false) {
+ if (!is_writeable($item)) {
+ array_push($cantMoveArray,substr($item,count($source)+2));
+ }
+ }
+ }
+ }
+ if (count($cantMoveArray) > 0) {
+ echo '
Sorry, there are dirs/files that cannot be moved. Please set write permissions on them so ICEcoder may move the old version, to make way for the new.
You can reload this page after making perms changes to check the list again.
';
+ for ($i=0; $i";
+ }
+ die('
<< Back to ICEcoder');
+ }
+ renameOldVersion();
+}
+
+function renameOldVersion() {
if (is_dir(PATH)) {
echo 'Postfixing oldVersion dir with a timestamp...
';
rename(PATH,trim(PATH,"/")."-".time());
@@ -37,10 +64,10 @@ function copyOldVersion() {
echo 'Moving current ICEcoder files...
';
foreach ($iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),RecursiveIteratorIterator::SELF_FIRST) as $item) {
if (strpos($source.DIRECTORY_SEPARATOR.$iterator->getSubPathName(),"oldVersion")==false) {
- // Don't move plugins away
+ // Don't move plugins or .git away
$testPath = $source.DIRECTORY_SEPARATOR.$iterator->getSubPathName();
$testPath = str_replace("\\","/",$testPath);
- if (strpos($testPath,"/plugins/")==false) {
+ if (strpos($testPath,"/plugins/")==false && strpos($testPath,"/.git/")==false) {
if ($item->isDir()) {
mkdir($dest.DIRECTORY_SEPARATOR.$iterator->getSubPathName(), 0755);
} else {