Use only the table "data" to detect books (no filesystem use)
This commit is contained in:
		
							parent
							
								
									06430d7563
								
							
						
					
					
						commit
						3c7d0f7308
					
				
					 1 changed files with 11 additions and 10 deletions
				
			
		
							
								
								
									
										17
									
								
								book.php
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								book.php
									
										
									
									
									
								
							|  | @ -191,15 +191,16 @@ class Book extends Base { | ||||||
|             array_push ($linkArray, new Link ("fetch.php?id=$this->id&height=" . $height, "image/jpeg", Link::OPDS_THUMBNAIL_TYPE)); |             array_push ($linkArray, new Link ("fetch.php?id=$this->id&height=" . $height, "image/jpeg", Link::OPDS_THUMBNAIL_TYPE)); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         if ($handle = opendir($this->path)) { |         $result = parent::getDb ()->prepare('select id, format, name | ||||||
|             while (false !== ($file = readdir($handle))) { | from data where book = ?'); | ||||||
|                 foreach (self::$mimetypes as $ext => $mime) |         $result->execute (array ($this->id)); | ||||||
|  |          | ||||||
|  |         while ($post = $result->fetchObject ()) | ||||||
|         { |         { | ||||||
|                     if (preg_match ('/'. $ext .'$/', $file)) { |             $ext = strtolower (str_replace ("ORIGINAL_", "", $post->format)); | ||||||
|                         $this->format [$ext] = $file; |             if (array_key_exists ($ext, self::$mimetypes)) | ||||||
|                         array_push ($linkArray, $this->getLink ($ext, $mime, Link::OPDS_ACQUISITION_TYPE, $file, "Download")); |             { | ||||||
|                     } |                 array_push ($linkArray, $this->getLink ($ext, self::$mimetypes [$ext], Link::OPDS_ACQUISITION_TYPE, $post->name . "." . strtolower ($post->format), "Download")); | ||||||
|                 } |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|                  |                  | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue