Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CarnetApp/CarnetNextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhie <phie@phie.ovh>2019-10-05 18:07:37 +0300
committerPhie <phie@phie.ovh>2019-10-05 18:07:37 +0300
commit58f6b261b4fcc485c7578b5af51ac64eaaafb41b (patch)
tree337e148338e67918c50f43f71df90262773bee8a
parente553523e97c4657bc8bb8ee9a54cee6666190d7a (diff)
avoid exception + infinite loop
-rwxr-xr-xappinfo/info.xml2
-rwxr-xr-xlib/Controller/NoteController.php23
2 files changed, 20 insertions, 5 deletions
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 42b77e6..1183635 100755
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -19,7 +19,7 @@ Mac, with sync capabilities
- Statistics : words/sentences/characters
- Sync with ownCloud/NextCloud
- Online editor as a ownCloud/NextCloud App]]></description>
- <version>0.18.3</version>
+ <version>0.18.4</version>
<licence>agpl</licence>
<author mail="phie@phie.ovh" >Phie</author>
<namespace>Carnet</namespace>
diff --git a/lib/Controller/NoteController.php b/lib/Controller/NoteController.php
index ca354ac..93ba44f 100755
--- a/lib/Controller/NoteController.php
+++ b/lib/Controller/NoteController.php
@@ -873,11 +873,14 @@ public function getOpusEncoder(){
private function waitEndOfExtraction($id){
$cache = $this->getCacheFolder();
+ $i=0;
do{
if($cache->nodeExists("currentnote".$id."/.extraction_finished"))
return;
- sleep(1);
- }while(true);
+ sleep(1);
+ $i++;
+ }while($i < 30);
+ throw new Exception ("timeout");
}
@@ -923,10 +926,15 @@ public function getOpusEncoder(){
*/
foreach($cache->getDirectoryListing() as $in){
if(substr($in->getName(), 0, strlen("currentnote")) === "currentnote"){
- $in->delete();
+ try{
+ $in->delete();
+ } catch (\OCP\Lock\LockedException $e){
+
+ }
}
}
$folder = $cache->newFolder("currentnote".$editUniqueID);
+
try{
$tmppath = tempnam(sys_get_temp_dir(), uniqid().".zip");
file_put_contents($tmppath,$this->CarnetFolder->get($path)->fopen("r"));
@@ -949,7 +957,14 @@ public function getOpusEncoder(){
unlink($tmppath);
} catch(\OCP\Files\NotFoundException $e) {
}
- $folder->newFile(".extraction_finished");
+
+ try{
+ $folder->newFile(".extraction_finished");
+ } catch (\OCP\Lock\LockedException $e){
+ $folder->get(".extraction_finished")->unlock(\OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE);
+ $folder->newFile(".extraction_finished");
+
+ }
}
/**