Skip to content

Commit 63ec079

Browse files
committed
Merge branch 'development' into release
2 parents d485fcb + c17906c commit 63ec079

37 files changed

+294
-206
lines changed

.github/translators.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,5 @@ H.-H. Peng (Hsins) :: Chinese Traditional
327327
Mosi Wang (mosiwang) :: Chinese Traditional
328328
骆言 (LawssssCat) :: Chinese Simplified
329329
Stickers Gaming Shøw (StickerSGSHOW) :: French
330+
Le Van Chinh (Chino) (lvanchinh86) :: Vietnamese
331+
Rubens nagios (rubenix) :: Catalan

app/Console/Commands/UpdateUrl.php

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ class UpdateUrl extends Command
1414
*/
1515
protected $signature = 'bookstack:update-url
1616
{oldUrl : URL to replace}
17-
{newUrl : URL to use as the replacement}';
17+
{newUrl : URL to use as the replacement}
18+
{--force : Force the operation to run, ignoring confirmations}';
1819

1920
/**
2021
* The console command description.
@@ -23,25 +24,12 @@ class UpdateUrl extends Command
2324
*/
2425
protected $description = 'Find and replace the given URLs in your BookStack database';
2526

26-
protected $db;
27-
28-
/**
29-
* Create a new command instance.
30-
*
31-
* @return void
32-
*/
33-
public function __construct(Connection $db)
34-
{
35-
$this->db = $db;
36-
parent::__construct();
37-
}
38-
3927
/**
4028
* Execute the console command.
4129
*
4230
* @return mixed
4331
*/
44-
public function handle()
32+
public function handle(Connection $db)
4533
{
4634
$oldUrl = str_replace("'", '', $this->argument('oldUrl'));
4735
$newUrl = str_replace("'", '', $this->argument('newUrl'));
@@ -67,7 +55,7 @@ public function handle()
6755

6856
foreach ($columnsToUpdateByTable as $table => $columns) {
6957
foreach ($columns as $column) {
70-
$changeCount = $this->replaceValueInTable($table, $column, $oldUrl, $newUrl);
58+
$changeCount = $this->replaceValueInTable($db, $table, $column, $oldUrl, $newUrl);
7159
$this->info("Updated {$changeCount} rows in {$table}->{$column}");
7260
}
7361
}
@@ -80,7 +68,7 @@ public function handle()
8068
foreach ($columns as $column) {
8169
$oldJson = trim(json_encode($oldUrl), '"');
8270
$newJson = trim(json_encode($newUrl), '"');
83-
$changeCount = $this->replaceValueInTable($table, $column, $oldJson, $newJson);
71+
$changeCount = $this->replaceValueInTable($db, $table, $column, $oldJson, $newJson);
8472
$this->info("Updated {$changeCount} JSON encoded rows in {$table}->{$column}");
8573
}
8674
}
@@ -97,13 +85,18 @@ public function handle()
9785
* Perform a find+replace operations in the provided table and column.
9886
* Returns the count of rows changed.
9987
*/
100-
protected function replaceValueInTable(string $table, string $column, string $oldUrl, string $newUrl): int
101-
{
102-
$oldQuoted = $this->db->getPdo()->quote($oldUrl);
103-
$newQuoted = $this->db->getPdo()->quote($newUrl);
104-
105-
return $this->db->table($table)->update([
106-
$column => $this->db->raw("REPLACE({$column}, {$oldQuoted}, {$newQuoted})"),
88+
protected function replaceValueInTable(
89+
Connection $db,
90+
string $table,
91+
string $column,
92+
string $oldUrl,
93+
string $newUrl
94+
): int {
95+
$oldQuoted = $db->getPdo()->quote($oldUrl);
96+
$newQuoted = $db->getPdo()->quote($newUrl);
97+
98+
return $db->table($table)->update([
99+
$column => $db->raw("REPLACE({$column}, {$oldQuoted}, {$newQuoted})"),
107100
]);
108101
}
109102

@@ -113,6 +106,10 @@ protected function replaceValueInTable(string $table, string $column, string $ol
113106
*/
114107
protected function checkUserOkayToProceed(string $oldUrl, string $newUrl): bool
115108
{
109+
if ($this->option('force')) {
110+
return true;
111+
}
112+
116113
$dangerWarning = "This will search for \"{$oldUrl}\" in your database and replace it with \"{$newUrl}\".\n";
117114
$dangerWarning .= 'Are you sure you want to proceed?';
118115
$backupConfirmation = 'This operation could cause issues if used incorrectly. Have you made a backup of your existing database?';

bookstack-system-cli

1017 Bytes
Binary file not shown.

composer.lock

Lines changed: 85 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lang/ca/activities.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@
77

88
// Pages
99
'page_create' => 'ha creat la pàgina',
10-
'page_create_notification' => 'Page successfully created',
10+
'page_create_notification' => 'Pàgina creada correctament',
1111
'page_update' => 'ha actualitzat la pàgina',
12-
'page_update_notification' => 'Page successfully updated',
12+
'page_update_notification' => 'Pàgina actualitzada correctament',
1313
'page_delete' => 'ha suprimit una pàgina',
14-
'page_delete_notification' => 'Page successfully deleted',
14+
'page_delete_notification' => 'Imatge esborrada correctament',
1515
'page_restore' => 'ha restaurat la pàgina',
16-
'page_restore_notification' => 'Page successfully restored',
16+
'page_restore_notification' => 'Pàgina restaurada correctament',
1717
'page_move' => 'ha mogut la pàgina',
1818

1919
// Chapters
2020
'chapter_create' => 'ha creat el capítol',
21-
'chapter_create_notification' => 'Chapter successfully created',
21+
'chapter_create_notification' => 'Capítol creat correctament',
2222
'chapter_update' => 'ha actualitzat el capítol',
23-
'chapter_update_notification' => 'Chapter successfully updated',
23+
'chapter_update_notification' => 'Capítol actualitzat correctament',
2424
'chapter_delete' => 'ha suprimit un capítol',
25-
'chapter_delete_notification' => 'Chapter successfully deleted',
25+
'chapter_delete_notification' => 'Capítol esborrat correctament',
2626
'chapter_move' => 'ha mogut el capítol',
2727

2828
// Books
2929
'book_create' => 'ha creat el llibre',
30-
'book_create_notification' => 'Book successfully created',
30+
'book_create_notification' => 'Llibre creat correctament',
3131
'book_create_from_chapter' => 'converted chapter to book',
3232
'book_create_from_chapter_notification' => 'Chapter successfully converted to a book',
3333
'book_update' => 'ha actualitzat el llibre',

lang/fr/components.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
// Image Manager
88
'image_select' => 'Sélectionner une image',
9-
'image_upload' => 'Upload Image',
10-
'image_intro' => 'Here you can select and manage images that have been previously uploaded to the system.',
11-
'image_intro_upload' => 'Upload a new image by dragging an image file into this window, or by using the "Upload Image" button above.',
9+
'image_upload' => 'Téléverser une image',
10+
'image_intro' => 'Ici, vous pouvez sélectionner et gérer les images qui ont été précédemment téléversées sur le système.',
11+
'image_intro_upload' => 'Téléverser une nouvelle image en glissant un fichier image dans cette fenêtre, ou en utilisant le bouton "Téléverser une image" ci-dessus.',
1212
'image_all' => 'Toutes',
1313
'image_all_title' => 'Voir toutes les images',
1414
'image_book_title' => 'Voir les images ajoutées à ce livre',
@@ -21,7 +21,7 @@
2121
'image_delete_confirm_text' => 'Êtes-vous sûr de vouloir supprimer cette image ?',
2222
'image_select_image' => 'Sélectionner l\'image',
2323
'image_dropzone' => 'Glissez les images ici ou cliquez pour les ajouter',
24-
'image_dropzone_drop' => 'Drop images here to upload',
24+
'image_dropzone_drop' => 'Déposer des images ici pour les téléverser',
2525
'images_deleted' => 'Images supprimées',
2626
'image_preview' => 'Prévisualiser l\'image',
2727
'image_upload_success' => 'Image ajoutée avec succès',

lang/fr/entities.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,16 +309,16 @@
309309
'tags_view_existing_tags' => 'Voir les mots-clés existants',
310310
'tags_list_empty_hint' => 'Les mots-clés peuvent être assignés via la barre latérale de l\'éditeur de page ou lors de l\'édition des détails d\'un livre, d\'un chapitre ou d\'une étagère.',
311311
'attachments' => 'Fichiers joints',
312-
'attachments_explain' => 'Ajouter des fichiers ou des liens pour les afficher sur votre page. Ils seront affichés dans la barre latérale',
312+
'attachments_explain' => 'Ajouter des fichiers ou des liens pour les afficher sur votre page. Ils seront affichés dans la barre latérale.',
313313
'attachments_explain_instant_save' => 'Ces changements sont enregistrés immédiatement.',
314-
'attachments_upload' => 'Uploader un fichier',
314+
'attachments_upload' => 'Téléverser un fichier',
315315
'attachments_link' => 'Attacher un lien',
316-
'attachments_upload_drop' => 'Alternatively you can drag and drop a file here to upload it as an attachment.',
316+
'attachments_upload_drop' => 'Vous pouvez également glisser-déposer un fichier ici pour le téléverser en tant que pièce jointe.',
317317
'attachments_set_link' => 'Définir un lien',
318318
'attachments_delete' => 'Êtes-vous sûr de vouloir supprimer la pièce jointe ?',
319-
'attachments_dropzone' => 'Drop files here to upload',
319+
'attachments_dropzone' => 'Déposer des fichiers ici pour les téléverser',
320320
'attachments_no_files' => 'Aucun fichier ajouté',
321-
'attachments_explain_link' => 'Vous pouvez ajouter un lien si vous ne souhaitez pas uploader un fichier.',
321+
'attachments_explain_link' => 'Vous pouvez ajouter un lien si vous ne souhaitez pas téléverser un fichier.',
322322
'attachments_link_name' => 'Nom du lien',
323323
'attachment_link' => 'Lien de l\'attachement',
324324
'attachments_link_url' => 'Lien sur un fichier',

lang/fr/errors.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
// Attachments
5555
'attachment_not_found' => 'Fichier joint non trouvé',
56-
'attachment_upload_error' => 'An error occurred uploading the attachment file',
56+
'attachment_upload_error' => 'Une erreur s\'est produite avec le téléversement du fichier joint',
5757

5858
// Pages
5959
'page_draft_autosave_fail' => 'Le brouillon n\'a pas pu être enregistré. Vérifiez votre connexion internet',

0 commit comments

Comments
 (0)