public function createText()
 {
     $present_working_directory = getcwd();
     chdir(BOOKS_PATH);
     if (is_dir(BOOKS_PATH)) {
         if ($directory = opendir(BOOKS_PATH)) {
             while (($file = readdir($directory)) !== false) {
                 if (filetype(BOOKS_PATH . $file) == 'file' && $this->getFileType($file) == 'pdf') {
                     $new_file_name = $this->getFileName($this->sanitize($file));
                     if ($new_file_name != $file) {
                         rename(BOOKS_PATH . $file, BOOKS_PATH . $new_file_name . '.pdf');
                         $db_file = new files($this->getDb());
                         $db_file->update(array('name' => $new_file_name . '.pdf'), 'WHERE name="' . $file . '"');
                     }
                     if (!file_exists($new_file_name . '.txt')) {
                         exec(escapeshellcmd('pdftotext -nopgbrk ' . $new_file_name . '.pdf ' . $new_file_name . '.txt'));
                     }
                 }
             }
         }
     } else {
         display_error('Directory ' . BOOKS_PATH . ' does not exist');
     }
     chdir($present_working_directory);
 }