Added tags tables
Avoid long files name breaking the table
This commit is contained in:
parent
d8a5e28577
commit
6d573457dd
|
@ -219,7 +219,6 @@ class UserController extends Controller
|
||||||
return redirect($response, route('user.index'));
|
return redirect($response, route('user.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Response $response
|
* @param Response $response
|
||||||
|
|
|
@ -33,8 +33,8 @@ if (isset($argv[1]) && $argv[1] === '--install') {
|
||||||
$db->query("INSERT INTO `users` (`email`, `username`, `password`, `is_admin`, `user_code`) VALUES ('admin@example.com', 'admin', ?, 1, ?)", [password_hash('admin', PASSWORD_DEFAULT), humanRandomString(5)]);
|
$db->query("INSERT INTO `users` (`email`, `username`, `password`, `is_admin`, `user_code`) VALUES ('admin@example.com', 'admin', ?, 1, ?)", [password_hash('admin', PASSWORD_DEFAULT), humanRandomString(5)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists(__DIR__.'/../install')) {
|
if (file_exists(__DIR__.'/../install') && (!isset($config['debug']) || !$config['debug'])) {
|
||||||
removeDirectory(__DIR__.'/../install');
|
//removeDirectory(__DIR__.'/../install');
|
||||||
}
|
}
|
||||||
|
|
||||||
echo 'If you are upgrading from a previous version, please run a "php bin\clean".'.PHP_EOL;
|
echo 'If you are upgrading from a previous version, please run a "php bin\clean".'.PHP_EOL;
|
||||||
|
|
|
@ -230,7 +230,9 @@ $app->post('/', function (Request $request, Response $response, Filesystem $stor
|
||||||
cleanDirectory(__DIR__.'/../resources/cache');
|
cleanDirectory(__DIR__.'/../resources/cache');
|
||||||
cleanDirectory(__DIR__.'/../resources/sessions');
|
cleanDirectory(__DIR__.'/../resources/sessions');
|
||||||
|
|
||||||
removeDirectory(__DIR__.'/../install');
|
if (!isset($config['debug']) || !$config['debug']) {
|
||||||
|
removeDirectory(__DIR__.'/../install');
|
||||||
|
}
|
||||||
|
|
||||||
// Installed successfully, destroy the installer session
|
// Installed successfully, destroy the installer session
|
||||||
$session->destroy();
|
$session->destroy();
|
||||||
|
|
18
resources/schemas/mysql/mysql.6.sql
Normal file
18
resources/schemas/mysql/mysql.6.sql
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS `tags` (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
`name` VARCHAR(32) NOT NULL,
|
||||||
|
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
INDEX (`name`)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `uploads_tags` (
|
||||||
|
`upload_id` INTEGER,
|
||||||
|
`tag_id` INTEGER,
|
||||||
|
PRIMARY KEY (`upload_id`, `tag_id`),
|
||||||
|
FOREIGN KEY (`upload_id`) REFERENCES `uploads` (`id`)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE
|
||||||
|
);
|
20
resources/schemas/sqlite/sqlite.6.sql
Normal file
20
resources/schemas/sqlite/sqlite.6.sql
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS `tags` (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
`name` VARCHAR(32) NOT NULL,
|
||||||
|
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS `tag_name`
|
||||||
|
ON `tags` (`name`);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `uploads_tags` (
|
||||||
|
`upload_id` INTEGER,
|
||||||
|
`tag_id` INTEGER,
|
||||||
|
PRIMARY KEY (`upload_id`, `tag_id`),
|
||||||
|
FOREIGN KEY (`upload_id`) REFERENCES `uploads` (`id`)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE
|
||||||
|
);
|
|
@ -40,7 +40,7 @@
|
||||||
<i class="far {{ mime2font(media.mimetype) }} fa-2x"></i>
|
<i class="far {{ mime2font(media.mimetype) }} fa-2x"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ media.filename }}</td>
|
<td><span class="text-maxlen">{{ media.filename }}</span></td>
|
||||||
<td>{{ media.size }}</td>
|
<td>{{ media.size }}</td>
|
||||||
<td id="published_{{ media.id }}">
|
<td id="published_{{ media.id }}">
|
||||||
{% if media.published %}
|
{% if media.published %}
|
||||||
|
|
|
@ -130,3 +130,16 @@ body {
|
||||||
.grecaptcha-badge {
|
.grecaptcha-badge {
|
||||||
top: 5px !important;
|
top: 5px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-maxlen {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 330px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-maxlen:hover {
|
||||||
|
overflow: auto;
|
||||||
|
text-overflow: unset;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue