mirror of
https://github.com/typemill/typemill.git
synced 2025-07-25 00:02:28 +02:00
Merge branch 'docker' into v2.x
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -23,21 +23,22 @@ RUN chmod +x /var/www/html/docker-utils/install-composer && \
|
||||
./composer.phar update && \
|
||||
chmod +x /var/www/html/docker-utils/init-server
|
||||
|
||||
# Create a default copy of content and theme in case of empty directories binding
|
||||
RUN mkdir -p /var/www/html/content.default/ && \
|
||||
cp -R /var/www/html/content/* /var/www/html/content.default/ && \
|
||||
mkdir -p /var/www/html/themes.default/ && \
|
||||
cp -R /var/www/html/themes/* /var/www/html/themes.default/ && \
|
||||
mkdir -p /var/www/html/media.default/ && \
|
||||
cp -R /var/www/html/media/* /var/www/html/media.default/
|
||||
|
||||
# Expose useful volumes (see documentation)
|
||||
VOLUME /var/www/html/settings
|
||||
VOLUME /var/www/html/media
|
||||
VOLUME /var/www/html/cache
|
||||
VOLUME /var/www/html/plugins
|
||||
VOLUME /var/www/html/data
|
||||
|
||||
# Create a default copy of content and theme in case of empty directories binding
|
||||
RUN mkdir -p /var/www/html/content.default/ && \
|
||||
cp -R /var/www/html/content/* /var/www/html/content.default/ && \
|
||||
mkdir -p /var/www/html/themes.default/ && \
|
||||
cp -R /var/www/html/themes/* /var/www/html/themes.default/
|
||||
|
||||
VOLUME /var/www/html/content
|
||||
VOLUME /var/www/html/themes
|
||||
|
||||
# Inject default values if content and themes are mounted with empty directories, adjust rights and start the server
|
||||
# Inject default values for persistant data and start the server
|
||||
CMD ["/var/www/html/docker-utils/init-server"]
|
@@ -1,5 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# mount data from persistant storage if not empty
|
||||
find /var/www/html/content -type d -empty -exec cp -R /var/www/html/content.default/* /var/www/html/content \;
|
||||
find /var/www/html/themes -type d -empty -exec cp -R /var/www/html/themes.default/* /var/www/html/themes \;
|
||||
find /var/www/html/media -type d -empty -exec cp -R /var/www/html/media.default/* /var/www/html/media \;
|
||||
|
||||
# Fix ownership (in case of new folders)
|
||||
chown -R www-data:www-data /var/www/html/
|
||||
apache2-foreground
|
||||
|
||||
# Start Apache in foreground
|
||||
exec apache2-foreground
|
@@ -667,20 +667,24 @@ class Storage
|
||||
|
||||
public function getImageList()
|
||||
{
|
||||
$thumbs = array_diff(scandir($this->thumbsFolder), array('..', '.'));
|
||||
$imagelist = array();
|
||||
$imagelist = [];
|
||||
|
||||
foreach ($thumbs as $key => $name)
|
||||
if(is_dir($this->thumbsFolder))
|
||||
{
|
||||
$imagelist[] = [
|
||||
'name' => $name,
|
||||
'timestamp' => filemtime($this->thumbsFolder . $name),
|
||||
'src_thumb' => 'media/thumbs/' . $name,
|
||||
'src_live' => 'media/live/' . $name,
|
||||
];
|
||||
$thumbs = array_diff(scandir($this->thumbsFolder), array('..', '.'));
|
||||
|
||||
foreach ($thumbs as $key => $name)
|
||||
{
|
||||
$imagelist[] = [
|
||||
'name' => $name,
|
||||
'timestamp' => filemtime($this->thumbsFolder . $name),
|
||||
'src_thumb' => 'media/thumbs/' . $name,
|
||||
'src_live' => 'media/live/' . $name,
|
||||
];
|
||||
}
|
||||
|
||||
$imagelist = Helpers::array_sort($imagelist, 'timestamp', SORT_DESC);
|
||||
}
|
||||
|
||||
$imagelist = Helpers::array_sort($imagelist, 'timestamp', SORT_DESC);
|
||||
|
||||
return $imagelist;
|
||||
}
|
||||
@@ -895,24 +899,28 @@ class Storage
|
||||
|
||||
public function getFileList()
|
||||
{
|
||||
$files = scandir($this->fileFolder);
|
||||
$filelist = array();
|
||||
$filelist = [];
|
||||
|
||||
foreach ($files as $key => $name)
|
||||
if(is_dir($this->fileFolder))
|
||||
{
|
||||
if (!in_array($name, array(".","..","filerestrictions.yaml")) && file_exists($this->fileFolder . $name))
|
||||
{
|
||||
$filelist[] = [
|
||||
'name' => $name,
|
||||
'timestamp' => filemtime($this->fileFolder . $name),
|
||||
'bytes' => filesize($this->fileFolder . $name),
|
||||
'info' => pathinfo($this->fileFolder . $name),
|
||||
'url' => 'media/files/' . $name,
|
||||
];
|
||||
}
|
||||
}
|
||||
$files = scandir($this->fileFolder);
|
||||
|
||||
$filelist = Helpers::array_sort($filelist, 'timestamp', SORT_DESC);
|
||||
foreach ($files as $key => $name)
|
||||
{
|
||||
if (!in_array($name, array(".","..","filerestrictions.yaml")) && file_exists($this->fileFolder . $name))
|
||||
{
|
||||
$filelist[] = [
|
||||
'name' => $name,
|
||||
'timestamp' => filemtime($this->fileFolder . $name),
|
||||
'bytes' => filesize($this->fileFolder . $name),
|
||||
'info' => pathinfo($this->fileFolder . $name),
|
||||
'url' => 'media/files/' . $name,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$filelist = Helpers::array_sort($filelist, 'timestamp', SORT_DESC);
|
||||
}
|
||||
|
||||
return $filelist;
|
||||
}
|
||||
|
@@ -603,7 +603,7 @@ const medialib = {
|
||||
{
|
||||
this.deleteFile(media);
|
||||
}
|
||||
},
|
||||
},
|
||||
loadFiles(filetype)
|
||||
{
|
||||
var fileself = this;
|
||||
@@ -615,7 +615,12 @@ const medialib = {
|
||||
})
|
||||
.then(function (response)
|
||||
{
|
||||
fileself.filedata = response.data.files;
|
||||
fileself.filedata = [];
|
||||
const files = response.data.files;
|
||||
if(files && Array.isArray(files))
|
||||
{
|
||||
fileself.filedata = files;
|
||||
}
|
||||
fileself.showFiles(filetype);
|
||||
})
|
||||
.catch(function (error)
|
||||
@@ -704,8 +709,13 @@ const medialib = {
|
||||
})
|
||||
.then(function (response)
|
||||
{
|
||||
imageself.imagedata = response.data.images;
|
||||
imageself.showImages()
|
||||
imageself.imagedata = [];
|
||||
const images = response.data.images;
|
||||
if (images && Array.isArray(images))
|
||||
{
|
||||
imageself.imagedata = images;
|
||||
}
|
||||
imageself.showImages();
|
||||
})
|
||||
.catch(function (error)
|
||||
{
|
||||
|
Reference in New Issue
Block a user