Updated version, updated deps and added skip duplicates #367
This commit is contained in:
parent
380127516c
commit
feefa9c5a0
BIN
dist/main.css
vendored
Normal file → Executable file
BIN
dist/main.css
vendored
Normal file → Executable file
Binary file not shown.
BIN
dist/main.js
vendored
Normal file → Executable file
BIN
dist/main.js
vendored
Normal file → Executable file
Binary file not shown.
25
php/database/update_030003.php
Normal file
25
php/database/update_030003.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
###
|
||||
# @name Update to version 3.0.3
|
||||
# @copyright 2015 by Tobias Reich
|
||||
###
|
||||
|
||||
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
||||
|
||||
# Add skipDuplicates to settings
|
||||
$query = Database::prepare($database, "SELECT `key` FROM `?` WHERE `key` = 'skipDuplicates' LIMIT 1", array(LYCHEE_TABLE_SETTINGS));
|
||||
$result = $database->query($query);
|
||||
if ($result->num_rows===0) {
|
||||
$query = Database::prepare($database, "INSERT INTO `?` (`key`, `value`) VALUES ('skipDuplicates', '0')", array(LYCHEE_TABLE_SETTINGS));
|
||||
$result = $database->query($query);
|
||||
if (!$result) {
|
||||
Log::error($database, 'update_030003', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
# Set version
|
||||
if (Database::setVersion($database, '030003')===false) return false;
|
||||
|
||||
?>
|
@ -56,7 +56,8 @@ class Database extends Module {
|
||||
'020602', #2.6.2
|
||||
'020700', #2.7.0
|
||||
'030000', #3.0.0
|
||||
'030001' #3.0.1
|
||||
'030001', #3.0.1
|
||||
'030003' #3.0.3
|
||||
);
|
||||
|
||||
# For each update
|
||||
|
@ -40,7 +40,7 @@ class Photo extends Module {
|
||||
public function add($files, $albumID, $description = '', $tags = '') {
|
||||
|
||||
# Check dependencies
|
||||
self::dependencies(isset($this->database));
|
||||
self::dependencies(isset($this->database, $this->settings, $files));
|
||||
|
||||
# Check permissions
|
||||
if (hasPermissions(LYCHEE_UPLOADS)===false||
|
||||
@ -150,6 +150,15 @@ class Photo extends Module {
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
# Photo already exists
|
||||
# Check if the user wants to skip duplicates
|
||||
if ($this->settings['skipDuplicates']==='1') {
|
||||
Log::notice($this->database, __METHOD__, __LINE__, 'Skipped upload of existing photo because skipDuplicates is activated');
|
||||
exit('Warning: This photo has been skipped because it\'s already in your library.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Read infos
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Lychee",
|
||||
"version": "3.0.2",
|
||||
"version": "3.0.3",
|
||||
"description": "Self-hosted photo-management done right.",
|
||||
"authors": "Tobias Reich <tobias@electerious.com>",
|
||||
"license": "MIT",
|
||||
@ -10,16 +10,16 @@
|
||||
"url": "https://github.com/electerious/Lychee.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"basiccontext": "^3.0.3",
|
||||
"basiccontext": "^3.1.0",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-autoprefixer": "2.3.1",
|
||||
"gulp-babel": "^5.1.0",
|
||||
"gulp-concat": "^2.5.2",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-inject": "^1.3.1",
|
||||
"gulp-load-plugins": "^1.0.0-rc",
|
||||
"gulp-minify-css": "^1.1.6",
|
||||
"gulp-minify-css": "^1.2.0",
|
||||
"gulp-rimraf": "^0.1.1",
|
||||
"gulp-sass": "^2.0.1",
|
||||
"gulp-sass": "^2.0.2",
|
||||
"gulp-uglify": "^1.2.0",
|
||||
"jquery": "^2.1.4",
|
||||
"mousetrap": "^1.5.2"
|
||||
|
@ -6,8 +6,8 @@
|
||||
lychee = {
|
||||
|
||||
title: document.title,
|
||||
version: '3.0.2',
|
||||
version_code: '030002',
|
||||
version: '3.0.3',
|
||||
version_code: '030003',
|
||||
|
||||
update_path: 'http://lychee.electerious.com/version/index.php',
|
||||
updateURL: 'https://github.com/electerious/Lychee',
|
||||
|
@ -44,6 +44,7 @@ upload.start = {
|
||||
|
||||
var albumID = album.getID(),
|
||||
error = false,
|
||||
warning = false,
|
||||
process = function(files, file) {
|
||||
|
||||
var formData = new FormData(),
|
||||
@ -56,12 +57,18 @@ upload.start = {
|
||||
|
||||
$('#upload_files').val('');
|
||||
|
||||
if (error===false) {
|
||||
if (error===false&&warning===false) {
|
||||
|
||||
// Success
|
||||
basicModal.close();
|
||||
upload.notify('Upload complete');
|
||||
|
||||
} else if (error===false&&warning===true) {
|
||||
|
||||
// Warning
|
||||
$('.basicModal #basicModal__action.hidden').show();
|
||||
upload.notify('Upload complete');
|
||||
|
||||
} else {
|
||||
|
||||
// Error
|
||||
@ -130,23 +137,44 @@ upload.start = {
|
||||
|
||||
} else {
|
||||
|
||||
// Error
|
||||
$('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status')
|
||||
.html('Error')
|
||||
.addClass('error');
|
||||
if (xhr.responseText.substr(0, 6)==='Error:') {
|
||||
|
||||
if (xhr.responseText.substr(0, 6)==='Error:') errorText = xhr.responseText.substr(6) + ' Please take a look at the console of your browser for further details.';
|
||||
else errorText = 'Server returned an unknown response. Please take a look at the console of your browser for further details.';
|
||||
errorText = xhr.responseText.substr(6) + ' Please take a look at the console of your browser for further details.';
|
||||
error = true;
|
||||
|
||||
// Error Status
|
||||
$('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status')
|
||||
.html('Failed')
|
||||
.addClass('error');
|
||||
|
||||
} else if (xhr.responseText.substr(0, 8)==='Warning:') {
|
||||
|
||||
errorText = xhr.responseText.substr(8);
|
||||
warning = true;
|
||||
|
||||
// Warning Status
|
||||
$('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status')
|
||||
.html('Skipped')
|
||||
.addClass('warning');
|
||||
|
||||
} else {
|
||||
|
||||
errorText = 'Server returned an unknown response. Please take a look at the console of your browser for further details.';
|
||||
error = true;
|
||||
|
||||
// Error Status
|
||||
$('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status')
|
||||
.html('Failed')
|
||||
.addClass('error');
|
||||
|
||||
}
|
||||
|
||||
$('.basicModal .rows .row:nth-child(' + (file.num+1) + ') p.notice')
|
||||
.html(errorText)
|
||||
.show();
|
||||
|
||||
// Set global error
|
||||
error = true;
|
||||
|
||||
// Throw error
|
||||
lychee.error('Upload failed. Server returned the status code ' + xhr.status + '!', xhr, xhr.responseText);
|
||||
if (error===true) lychee.error('Upload failed. Server returned the status code ' + xhr.status + '!', xhr, xhr.responseText);
|
||||
|
||||
}
|
||||
|
||||
|
@ -301,11 +301,14 @@
|
||||
animation-iteration-count: infinite;
|
||||
|
||||
&.error,
|
||||
&.warning,
|
||||
&.success { animation: none; }
|
||||
|
||||
&.error { color: rgb(213, 24, 24); }
|
||||
&.error { color: rgb(233, 42, 0); }
|
||||
|
||||
&.success { color: rgb(42, 213, 0); }
|
||||
&.warning { color: rgb(228, 233, 0); }
|
||||
|
||||
&.success { color: rgb(126, 233, 0); }
|
||||
}
|
||||
|
||||
p.notice {
|
||||
|
Loading…
Reference in New Issue
Block a user