aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-09-17 16:03:34 +0200
committerMorris Jobke <hey@morrisjobke.de>2020-09-17 16:03:34 +0200
commitfaab3e733b1ceb17ee469e82ba3082181e7c9465 (patch)
treee969275b1303858e35913467e9f230020f55de76 /core
parentec07ca2abbc88f395b8eeedc4b2e5b679018a673 (diff)
downloadnextcloud-server-faab3e733b1ceb17ee469e82ba3082181e7c9465.tar.gz
nextcloud-server-faab3e733b1ceb17ee469e82ba3082181e7c9465.zip
Allow to run occ preview:repair in parallel
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'core')
-rw-r--r--core/Command/Preview/Repair.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/core/Command/Preview/Repair.php b/core/Command/Preview/Repair.php
index 845b9dbda92..1d4bbec813c 100644
--- a/core/Command/Preview/Repair.php
+++ b/core/Command/Preview/Repair.php
@@ -33,6 +33,8 @@ use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IConfig;
use OCP\ILogger;
+use OCP\Lock\ILockingProvider;
+use OCP\Lock\LockedException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
@@ -54,11 +56,14 @@ class Repair extends Command {
private $memoryLimit;
/** @var int */
private $memoryTreshold;
+ /** @var ILockingProvider */
+ private $lockingProvider;
- public function __construct(IConfig $config, IRootFolder $rootFolder, ILogger $logger, IniGetWrapper $phpIni) {
+ public function __construct(IConfig $config, IRootFolder $rootFolder, ILogger $logger, IniGetWrapper $phpIni, ILockingProvider $lockingProvider) {
$this->config = $config;
$this->rootFolder = $rootFolder;
$this->logger = $logger;
+ $this->lockingProvider = $lockingProvider;
$this->memoryLimit = $phpIni->getBytes('memory_limit');
$this->memoryTreshold = $this->memoryLimit - 25 * 1024 * 1024;
@@ -218,6 +223,15 @@ class Repair extends Command {
return 1;
}
+ $lockName = 'occ preview:repair lock ' . $oldPreviewFolder->getId();
+ try {
+ $section1->writeln(" Locking \"$lockName\" …");
+ $this->lockingProvider->acquireLock($lockName, ILockingProvider::LOCK_EXCLUSIVE);
+ } catch (LockedException $e) {
+ $section1->writeln(" Skipping because it is locked - another process seems to work on this …");
+ continue;
+ }
+
$previews = $oldPreviewFolder->getDirectoryListing();
if ($previews !== []) {
try {
@@ -264,6 +278,10 @@ class Repair extends Command {
}
}
}
+
+ $this->lockingProvider->releaseLock($lockName, ILockingProvider::LOCK_EXCLUSIVE);
+ $section1->writeln(" Unlocked");
+
$section1->writeln(" Finished migrating previews of file with fileId $name …");
$progressBar->advance();
}
ght: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
OC.L10N.register(
    "files",
    {
    "Storage is temporarily not available" : "Shramba trenutno ni na voljo",
    "Storage invalid" : "Določen prostor ni veljaven",
    "Unknown error" : "Neznana napaka",
    "All files" : "Vse datoteke",
    "Recent" : "Nedavno",
    "File could not be found" : "Datoteke ne najdem",
    "Home" : "Domači naslov",
    "Close" : "Zapri",
    "Favorites" : "Priljubljene",
    "Could not create folder \"{dir}\"" : "Ni mogoče ustvariti mape \"{dir}\"",
    "Upload cancelled." : "Pošiljanje je preklicano.",
    "Unable to upload {filename} as it is a directory or has 0 bytes" : "Ni mogoče poslati datoteke {filename}, saj je to ali mapa ali pa je velikost datoteke 0 bajtov.",
    "Not enough free space, you are uploading {size1} but only {size2} is left" : "Na voljo ni dovolj prostora. Velikost poslane datoteke je {size1}, na voljo pa je je {size2}.",
    "Target folder \"{dir}\" does not exist any more" : "Ciljna mapa \"{dir}\" ne obstaja več",
    "Not enough free space" : "Ni dovolj prostora",
    "{loadedSize} of {totalSize} ({bitrate})" : "{loadedSize} od {totalSize} ({bitrate})",
    "Actions" : "Dejanja",
    "Download" : "Prejmi",
    "Rename" : "Preimenuj",
    "Target folder" : "Ciljna mapa",
    "Delete" : "Izbriši",
    "Disconnect storage" : "Odklopi shrambo",
    "Unshare" : "Prekini souporabo",
    "Could not load info for file \"{file}\"" : "Ni bilo mogoče naložiti podatke za datoteko \"{file}\"",
    "Files" : "Datoteke",
    "Details" : "Podrobnosti",
    "Select" : "Izberi",
    "Pending" : "V čakanju ...",
    "Unable to determine date" : "Ni mogoče določiti datuma",
    "This operation is forbidden" : "To dejanje ni dovoljeno!",
    "This directory is unavailable, please check the logs or contact the administrator" : "Mapa ni na voljo. Preverite dnevnik in stopite v stik s skrbnikom sistema.",
    "Could not move \"{file}\", target exists" : "Datoteke \"{file}\" ni mogoče premakniti, ker cilj že obstaja",
    "Could not move \"{file}\"" : "Ni mogoče premakniti \"{file}\"",
    "{newName} already exists" : "{newName} že obstaja",
    "Could not rename \"{fileName}\", it does not exist any more" : "Ni mogoče preimenovati \"{fileName}\", ker datoteka ne obstaja več",
    "The name \"{targetName}\" is already used in the folder \"{dir}\". Please choose a different name." : "Ime \"{targetName}\" je že v uporabi v mapi \"{dir}\". Izberite drugo ime ali drugo mapo.",
    "Could not rename \"{fileName}\"" : "Ni mogoče preimenovati \"{fileName}\"",
    "Could not create file \"{file}\"" : "Ni mogoče ustvariti datoteke \"{file}\"",
    "Could not create file \"{file}\" because it already exists" : "Ni mogoče ustvariti datoteke \"{file}\", ker že obstaja",
    "Could not create folder \"{dir}\" because it already exists" : "Ni mogoče ustvariti mape \"{dir}\", ker že obstaja",
    "Error deleting file \"{fileName}\"." : "Napaka brisanja datoteke \"{fileName}\".",
    "No search results in other folders for {tag}{filter}{endtag}" : "Ni rezultatov iskanja v drugih mapah {tag}{filter}{endtag}",
    "Name" : "Ime",
    "Size" : "Velikost",
    "Modified" : "Spremenjeno",
    "_%n folder_::_%n folders_" : ["%n mapa","%n mapi","%n mape","%n mape"],
    "_%n file_::_%n files_" : ["%n datoteka","%n datoteki","%n datoteke","%n datoteke"],
    "{dirs} and {files}" : "{dirs} in {files}",
    "_including %n hidden_::_including %n hidden_" : ["Vključujoč %n skrit","Vključujoč %n skrita","Vključujoč %n skritih","Vključujoč %n skritih"],
    "You don’t have permission to upload or create files here" : "Ni ustreznih dovoljenj za pošiljanje ali ustvarjanje datotek na tem mestu.",
    "_Uploading %n file_::_Uploading %n files_" : ["Posodabljanje %n datoteke","Posodabljanje %n datotek","Posodabljanje %n datotek","Posodabljanje %n datotek"],
    "New" : "Novo",
    "\"{name}\" is an invalid file name." : "\"{name}\" je neveljavno ime datoteke.",
    "File name cannot be empty." : "Ime datoteke ne sme biti prazno polje.",
    "\"{name}\" is not an allowed filetype" : "\"{name}\" ni dovoljena vrsta datoteke",
    "Storage of {owner} is full, files can not be updated or synced anymore!" : "Shramba uporabnika {owner} je polna, zato datotek ni več mogoče posodabljati in usklajevati!",
    "Your storage is full, files can not be updated or synced anymore!" : "Shramba je povsem napolnjena. Datotek ni več mogoče posodabljati in usklajevati!",
    "Storage of {owner} is almost full ({usedSpacePercent}%)" : "Shramba uporabnika {owner} je polna ({usedSpacePercent}%).",
    "Your storage is almost full ({usedSpacePercent}%)" : "Prostor za shranjevanje je skoraj do konca zaseden ({usedSpacePercent}%)",
    "_matches '{filter}'_::_match '{filter}'_" : ["se sklada s filtrom '{filter}'","se skladata s filtrom '{filter}'","se skladajo s filtrom '{filter}'","se skladajo s filtrom '{filter}'"],
    "View in folder" : "Prikaži v mapi",
    "Copied!" : "Kopirano!",
    "Copy direct link (only works for users who have access to this file/folder)" : "Kopiraj direktno povezavo (deluje sa mo za uporabnike, ki imajo dostop do datoteke ali mape)",
    "Path" : "Pot",
    "_%n byte_::_%n bytes_" : ["%n bajt","%n bajta","%n bajti","%n bajtov"],
    "Favorited" : "Označeno kot priljubljeno",
    "Favorite" : "Priljubljene",
    "New folder" : "Nova mapa",
    "Upload file" : "Naloži datoteko",
    "An error occurred while trying to update the tags" : "Prišlo je do napake med posodabljanjem oznak",
    "Added to favorites" : "Dodano med priljubljene",
    "Removed from favorites" : "Odstranjeno iz priljubljenih",
    "You added {file} to your favorites" : "Dodali ste {file} med priljubljene",
    "You removed {file} from your favorites" : "Odstranili ste {file} od priljubljenih",
    "File changes" : "Sprememba datoteke",
    "Created by {user}" : "Ustvarjeno od {user}",
    "Changed by {user}" : "Spremenjeno od {user}",
    "Deleted by {user}" : "Izbrisano od {user}",
    "Restored by {user}" : "Obnovljeno od {user}",
    "Renamed by {user}" : "Preimenovano od {user}",
    "Moved by {user}" : "Premaknjeno od {user}",
    "\"remote user\"" : "\"oddaljeni uporabnik\"",
    "You created {file}" : "Ustvaril(a) si {file}",
    "{user} created {file}" : "{user} ustvaril(a) {file}",
    "{file} was created in a public folder" : "{file} ustvarjena je bila v javni mapi",
    "You changed {file}" : "Spremenil(a) si {file}",
    "{user} changed {file}" : "{user} spremenil/a {file}",
    "You deleted {file}" : "Izbrisal(a) si {file}",
    "{user} deleted {file}" : "{user} izbrisal(a) {file}",
    "You restored {file}" : "Obnovil(a) si {file}",
    "{user} restored {file}" : "{user} obnovil(a) {file}",
    "You renamed {oldfile} to {newfile}" : "Preimenoval(a) si {oldfile} v {newfile}",
    "{user} renamed {oldfile} to {newfile}" : "{user} preimenoval(a) {oldfile} v {newfile}",
    "You moved {oldfile} to {newfile}" : "Premaknil(a) si {oldfile} v {newfile}",
    "{user} moved {oldfile} to {newfile}" : "{user} premaknil(a) {oldfile} v {newfile}",
    "A file has been added to or removed from your <strong>favorites</strong>" : "Datoteka je bila dodana ali umaknjena iz tvojih <strong>priljubljenih</strong>",
    "A file or folder has been <strong>changed</strong> or <strong>renamed</strong>" : "Datoteka ali mapa je bila <strong>spremenjena</strong> ali <strong>preimenovana</strong>",
    "A new file or folder has been <strong>created</strong>" : "Nova datoteka ali mapa je <strong>ustvarjena</strong>",
    "A file or folder has been <strong>deleted</strong>" : "Datoteka ali mapa je bila <strong>pobrisana</strong>",
    "Limit notifications about creation and changes to your <strong>favorite files</strong> <em>(Stream only)</em>" : "Omeji obvestila o ustvarjanju in spreminjanju <strong>najpogosteje uporabljenih </strong> datotek <em>(omogoči pretok)</em>",
    "A file or folder has been <strong>restored</strong>" : "A file or folder has been <strong>restored</strong>",
    "Unlimited" : "Neomejeno",
    "Upload (max. %s)" : "Pošiljanje (omejitev %s)",
    "File handling" : "Upravljanje z datotekami",
    "Maximum upload size" : "Največja velikost za pošiljanja",
    "max. possible: " : "največ mogoče:",
    "Save" : "Shrani",
    "With PHP-FPM it might take 5 minutes for changes to be applied." : "Uveljavljanje sprememb prek PHP-FPM lahko traja tudi 5  minut.",
    "Missing permissions to edit from here." : "Ni ustreznih dovoljenj za urejanje na tej ravni.",
    "%s of %s used" : "%s od %s uporabljeno",
    "%s used" : "%s uporabljeno",
    "Settings" : "Nastavitve",
    "Show hidden files" : "Pokaži skrite datoteke",
    "WebDAV" : "WebDAV",
    "Use this address to <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">access your Files via WebDAV</a>" : "Uporabite naslov <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\"> za dostop do datotek prek sistema WebDAV</a>.",
    "No files in here" : "V mapi ni datotek",
    "Upload some content or sync with your devices!" : "Uvozite vsebino ali pa omogočite usklajevanje z napravami!",
    "No entries found in this folder" : "V tej mapi ni najdenih predmetov.",
    "Select all" : "izberi vse",
    "Upload too large" : "Prekoračenje omejitve velikosti",
    "The files you are trying to upload exceed the maximum size for file uploads on this server." : "Datoteke, ki jih želite poslati, presegajo največjo dovoljeno velikost na strežniku.",
    "No favorites yet" : "Še ni priljubljena",
    "Files and folders you mark as favorite will show up here" : "Datoteke ali mape, ki so označene kot priljubljene, bodo zbrane na tem mestu.",
    "Shared with you" : "V skupni rabi z vami",
    "Shared with others" : "V skupni rabi z ostalimi",
    "Shared by link" : "Deljeno s povezavo",
    "Tags" : "Oznake",
    "Deleted files" : "Izbrisane datoteke",
    "Text file" : "Besedilna datoteka",
    "New text file.txt" : "Nova datoteka.txt",
    "Uploading..." : "Poteka pošiljanje ...",
    "..." : "...",
    "_{hours}:{minutes}:{seconds} hour left_::_{hours}:{minutes}:{seconds} hours left_" : ["{hours}:{minutes}:{seconds} ura še","{hours}:{minutes}:{seconds} uri še","{hours}:{minutes}:{seconds} ure še","{hours}:{minutes}:{seconds} ur še"],
    "{hours}:{minutes}h" : "{hours}:{minutes}h",
    "_{minutes}:{seconds} minute left_::_{minutes}:{seconds} minutes left_" : ["{minutes}:{seconds} minuta še","{minutes}:{seconds} minuti še","{minutes}:{seconds} minute še","{minutes}:{seconds} minut še"],
    "{minutes}:{seconds}m" : "{minutes}:{seconds}min",
    "_{seconds} second left_::_{seconds} seconds left_" : ["{seconds} sekund še","{seconds} sekundi še","{seconds} sekunde še","{seconds} sekund še"],
    "{seconds}s" : "{seconds}s",
    "Any moment now..." : "Vsak trenutek ...",
    "Soon..." : "Kmalu",
    "File upload is in progress. Leaving the page now will cancel the upload." : "V teku je pošiljanje datoteke. Če zapustite to stran zdaj, bo pošiljanje preklicano.",
    "Move" : "Premakni",
    "Copy local link" : "Kopiraj lokalno povezavo",
    "Folder" : "Mapa",
    "Upload" : "Pošlji",
    "A new file or folder has been <strong>deleted</strong>" : "Nova datoteka ali mapa je bila <strong>pobrisana</strong>",
    "A new file or folder has been <strong>restored</strong>" : "Nova datoteka ali mapa je bila <strong>obnovljena</strong>",
    "No favorites" : "Ni priljubljenih predmetov"
},
"nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);");