Archived
1
0

Delete duplicates on file upload

This commit is contained in:
Marcel 2018-11-01 16:09:22 +01:00
parent 3a4e14a96f
commit 5faffbf9fa

View File

@ -28,6 +28,8 @@ class FileModel extends CI_Model
$this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$name, $original_name, $type, $size, $target_file, $userContent]); $this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$name, $original_name, $type, $size, $target_file, $userContent]);
echo shell_exec(escapeshellcmd('python /var/www/codeigniter/duplicates.py'));
return "/f/" . $name; return "/f/" . $name;
} }
@ -55,6 +57,9 @@ class FileModel extends CI_Model
$this->image_lib->resize(); $this->image_lib->resize();
$this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$data['raw_name'], $originalname, $data['file_type'], $data['file_size'] * 1024, $this->getPath($data['file_name'], $userContent), $userContent]); $this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$data['raw_name'], $originalname, $data['file_type'], $data['file_size'] * 1024, $this->getPath($data['file_name'], $userContent), $userContent]);
echo shell_exec(escapeshellcmd('python /var/www/codeigniter/duplicates.py'));
return '/f/' . $data['raw_name']; return '/f/' . $data['raw_name'];
} }
} }
@ -107,6 +112,9 @@ class FileModel extends CI_Model
$this->image_lib->crop(); $this->image_lib->crop();
$this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$data['raw_name'], $originalname, $data['file_type'], $data['file_size'] * 1024, $this->getPath($data['file_name'], $userContent), $userContent]); $this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$data['raw_name'], $originalname, $data['file_type'], $data['file_size'] * 1024, $this->getPath($data['file_name'], $userContent), $userContent]);
echo shell_exec(escapeshellcmd('python /var/www/codeigniter/duplicates.py'));
return '/f/' . $data['raw_name']; return '/f/' . $data['raw_name'];
} }
} }
@ -123,6 +131,8 @@ class FileModel extends CI_Model
$this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$name, $original_name, $fullType, $fileSize, $target_file, $userContent]); $this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$name, $original_name, $fullType, $fileSize, $target_file, $userContent]);
echo shell_exec(escapeshellcmd('python /var/www/codeigniter/duplicates.py'));
return '/f/' . $name; return '/f/' . $name;
} }