} catch (Exception) {
throw new Exception('Cant populate settings.', 500);
}
- (new Database())->assemblePDO();
+ Database::assemblePDO();
}
}
/**
* @throws Exception
*/
- public function dbCheckNameExists()
+ public static function dbCheckNameExists()
{
try {
$q = Settings::$DB->prepare('SELECT COUNT(filename) FROM files WHERE filename = (:name)');
/**
* @throws Exception
*/
- public function checkFileBlacklist()
+ public static function checkFileBlacklist()
{
try {
$q = Settings::$DB->prepare('SELECT hash, COUNT(*) AS count FROM blacklist WHERE hash = (:hash)');
/**
* @throws Exception
*/
- public function antiDupe()
+ public static function antiDupe()
{
try {
$q = Settings::$DB->prepare(
$result = $q->fetch();
if ($result['count'] > 0) {
Upload::$NEW_NAME_FULL = $result['filename'];
+ } else {
+ Upload::generateName();
}
} catch (Exception) {
throw new Exception('Cant check for dupes in DB.', 500);
/**
* @throws Exception
*/
- public function newIntoDB()
+ public static function newIntoDB()
{
try {
$q = Settings::$DB->prepare(
}
-