private static function removeTemp() { // make sure update directory exists before trying to clear it if (!file_exists(UpdateHelper::getTempPath())) { mkdir(UpdateHelper::getTempPath(), 0777, true); } // recursively delete everything in update folder foreach (UpdateHelper::getUpdateIterator(true) as $item) { if ($item->isDir()) { //if ($debug) ErrorHelper::logDebug('rmdir ' . $item->getRealPath()); rmdir($item->getRealPath()); } else { //if ($debug) ErrorHelper::logDebug('unlink ' . $item->getRealPath()); unlink($item->getRealPath()); } } }