mirror of
https://github.com/Yetangitu/owncloud-apps.git
synced 2025-10-02 14:49:17 +02:00
files_opds: fix #23, XML error after deleting an epub file from Library
This commit is contained in:
parent
1106d835f7
commit
129b600f69
3 changed files with 34 additions and 2 deletions
|
@ -11,7 +11,7 @@
|
||||||
The feed is in compliance with the OPDS 1.1 specification according to the online OPDS validator (http://opds-validator.appspot.com/).
|
The feed is in compliance with the OPDS 1.1 specification according to the online OPDS validator (http://opds-validator.appspot.com/).
|
||||||
</description>
|
</description>
|
||||||
<licence>AGPL</licence>
|
<licence>AGPL</licence>
|
||||||
<version>0.7.2</version>
|
<version>0.7.3</version>
|
||||||
<author>Frank de Lange</author>
|
<author>Frank de Lange</author>
|
||||||
<category>tools</category>
|
<category>tools</category>
|
||||||
<category>files</category>
|
<category>files</category>
|
||||||
|
|
|
@ -33,6 +33,19 @@ class Bookshelf
|
||||||
Config::set('bookshelf', json_encode($bookshelf));
|
Config::set('bookshelf', json_encode($bookshelf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief remove book from personal bookshelf
|
||||||
|
*
|
||||||
|
* @param int $id book to remove from bookshelf
|
||||||
|
*/
|
||||||
|
public static function remove($id) {
|
||||||
|
$bookshelf = json_decode(Config::get('bookshelf', ''), true);
|
||||||
|
if(isset($bookshelf[$id])) {
|
||||||
|
unset($bookshelf[$id]);
|
||||||
|
Config::set('bookshelf', json_encode($bookshelf));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief clear personal bookshelf
|
* @brief clear personal bookshelf
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +71,12 @@ class Bookshelf
|
||||||
if($bookshelf = json_decode(Config::get('bookshelf', ''), true)) {
|
if($bookshelf = json_decode(Config::get('bookshelf', ''), true)) {
|
||||||
arsort($bookshelf);
|
arsort($bookshelf);
|
||||||
while (list($id, $time) = each($bookshelf)) {
|
while (list($id, $time) = each($bookshelf)) {
|
||||||
|
try {
|
||||||
array_push($files, \OC\Files\Filesystem::getFileInfo(\OC\Files\Filesystem::normalizePath(\OC\Files\Filesystem::getPath($id))));
|
array_push($files, \OC\Files\Filesystem::getFileInfo(\OC\Files\Filesystem::normalizePath(\OC\Files\Filesystem::getPath($id))));
|
||||||
|
} catch(\OCP\Files\NotFoundException $e) {
|
||||||
|
self::remove($id);
|
||||||
|
Meta::remove($id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,20 @@ class Meta
|
||||||
return $meta;
|
return $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief remove metadata for fileid
|
||||||
|
*
|
||||||
|
* @param int $id fileif
|
||||||
|
* @return OC_DB_StatementWrapper
|
||||||
|
*/
|
||||||
|
public static function remove($id) {
|
||||||
|
$sql = "DELETE FROM *PREFIX*opds_metadata WHERE `id`=?";
|
||||||
|
$args = array($id);
|
||||||
|
$query = \OCP\DB::prepare($sql);
|
||||||
|
|
||||||
|
return $query->execute($args);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief schedule rescan of metadata
|
* @brief schedule rescan of metadata
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue