Adds soft copy directory support, minor fix to loadindicator
This commit is contained in:
parent
66f0c683a8
commit
5648507e0c
|
|
@ -997,7 +997,7 @@ this.hide()
|
|||
var indicator=$('<div class="loading-indicator"></div>')
|
||||
indicator.append($('<div></div>').text(this.options.text))
|
||||
indicator.append($('<span></span>'))
|
||||
if(this.options.opaque!==undefined&&this.options.opaque){indicator.addClass('is-opaque')}
|
||||
if(this.options.opaque!==undefined){indicator.addClass('is-opaque')}
|
||||
this.$el.prepend(indicator)
|
||||
this.$el.addClass('in-progress')
|
||||
this.tally++}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
var indicator = $('<div class="loading-indicator"></div>')
|
||||
indicator.append($('<div></div>').text(this.options.text))
|
||||
indicator.append($('<span></span>'))
|
||||
if (this.options.opaque !== undefined && this.options.opaque) {
|
||||
if (this.options.opaque !== undefined) {
|
||||
indicator.addClass('is-opaque')
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use Model;
|
|||
use ApplicationException;
|
||||
use October\Rain\Filesystem\Zip;
|
||||
use Cms\Classes\Theme as CmsTheme;
|
||||
use FilesystemIterator;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
|
|
@ -110,12 +111,12 @@ class ThemeImport extends Model
|
|||
// }
|
||||
|
||||
if (File::isDirectory($tempPath.'/meta')) {
|
||||
File::copyDirectory($tempPath.'/meta', $themePath.'/meta');
|
||||
$this->copyDirectory($tempPath.'/meta', $themePath.'/meta');
|
||||
}
|
||||
|
||||
foreach ($this->folders as $folder) {
|
||||
if (!array_key_exists($folder, $this->getFoldersOptions())) continue;
|
||||
File::copyDirectory($tempPath.'/'.$folder, $themePath.'/'.$folder);
|
||||
$this->copyDirectory($tempPath.'/'.$folder, $themePath.'/'.$folder);
|
||||
}
|
||||
|
||||
File::deleteDirectory($tempPath);
|
||||
|
|
@ -136,4 +137,48 @@ class ThemeImport extends Model
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for copying directories that supports the ability
|
||||
* to not overwrite existing files. Inherited from File::copyDirectory
|
||||
*
|
||||
* @param string $directory
|
||||
* @param string $destination
|
||||
* @return bool
|
||||
*/
|
||||
protected function copyDirectory($directory, $destination)
|
||||
{
|
||||
// Preference is to overwrite existing files
|
||||
if ($this->overwrite) {
|
||||
return File::copyDirectory($directory, $destination);
|
||||
}
|
||||
|
||||
if (!File::isDirectory($directory)) return false;
|
||||
|
||||
$options = FilesystemIterator::SKIP_DOTS;
|
||||
|
||||
if (!File::isDirectory($destination)) {
|
||||
File::makeDirectory($destination, 0777, true);
|
||||
}
|
||||
|
||||
$items = new FilesystemIterator($directory, $options);
|
||||
|
||||
foreach ($items as $item) {
|
||||
$target = $destination.'/'.$item->getBasename();
|
||||
|
||||
if ($item->isDir()) {
|
||||
$path = $item->getPathname();
|
||||
|
||||
if (!$this->copyDirectory($path, $target)) return false;
|
||||
}
|
||||
else {
|
||||
// Do not overwrite existing files
|
||||
if (File::isFile($target)) continue;
|
||||
|
||||
if (!File::copy($item->getPathname(), $target)) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue