*/
public static function _handleFiles($theme, $data)
{
- $oldRoot = '/home/extranet/www/fluidbook/themes/' . $theme->getAttribute('id') . '/';
+ // $oldRoot = '/home/extranet/www/fluidbook/themes/' . $theme->getAttribute('id') . '/';
foreach ($theme->getFields() as $field) {
if (!($field instanceof Files)) {
continue;
if (!$v) {
$theme->deleteMediaInField($k);
- continue;
- }
- $path = $oldRoot . $v;
- if (!file_exists($path)) {
- $opath = str_replace('.svg', '.o.svg', $path);
- if (file_exists($opath)) {
- copy($opath, $path);
- } else {
- continue;
- }
- }
-
- $media = $theme->getMediaInField($k);
- $upload = false;
-
- if ($media->count() === 0) {
- $upload = true;
- } else {
- /** @var Media $m */
- $m = $media->get(0);
-
- if ($m->getAttribute('file_name') !== $k) {
- $upload = true;
- } else {
- $mpath = $m->getPath();
- if (filesize($path) !== filesize($mpath)) {
- $upload = true;
- }
- }
- }
-
- if (!$upload) {
- continue;
- }
- $s = storage_path('themes/' . $theme->getAttribute('id'));
- if (!file_exists($s)) {
- mkdir($s);
+ //continue;
}
- $f = $s . '/' . $v;
- copy($path, $f);
- $theme->addMediaToField($k, $f);
+// $path = $oldRoot . $v;
+// if (!file_exists($path)) {
+// $opath = str_replace('.svg', '.o.svg', $path);
+// if (file_exists($opath)) {
+// copy($opath, $path);
+// } else {
+// continue;
+// }
+// }
+//
+// $media = $theme->getMediaInField($k);
+// $upload = false;
+//
+// if ($media->count() === 0) {
+// $upload = true;
+// } else {
+// /** @var Media $m */
+// $m = $media->get(0);
+//
+// if ($m->getAttribute('file_name') !== $k) {
+// $upload = true;
+// } else {
+// $mpath = $m->getPath();
+// if (filesize($path) !== filesize($mpath)) {
+// $upload = true;
+// }
+// }
+// }
+//
+// if (!$upload) {
+// continue;
+// }
+// $s = storage_path('themes/' . $theme->getAttribute('id'));
+// if (!file_exists($s)) {
+// mkdir($s);
+// }
+// $f = $s . '/' . $v;
+// copy($path, $f);
+// $theme->addMediaToField($k, $f);
}
}