diff options
| author | lsces <lester@lsces.co.uk> | 2026-04-02 10:10:51 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2026-04-02 10:10:51 +0100 |
| commit | 191836423fde25e7afaffbdedd62df72120443df (patch) | |
| tree | 87a4bb38ba15af92d53ad878500b45197a08fdc1 | |
| parent | bab8904cd90d6884686755c00ab9f2e62b9d55b9 (diff) | |
| download | protector-191836423fde25e7afaffbdedd62df72120443df.tar.gz protector-191836423fde25e7afaffbdedd62df72120443df.tar.bz2 protector-191836423fde25e7afaffbdedd62df72120443df.zip | |
mime pdf plugin now uploads text layer to populate the liberty object data field to allow search of pdf documents
| -rwxr-xr-x | liberty_plugins/mime.flatdefault.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/liberty_plugins/mime.flatdefault.php b/liberty_plugins/mime.flatdefault.php index 431a495..dad3feb 100755 --- a/liberty_plugins/mime.flatdefault.php +++ b/liberty_plugins/mime.flatdefault.php @@ -175,6 +175,12 @@ if( !function_exists( '\Bitweaver\Liberty\mime_default_update' )) { $gBitSystem->mDb->query( $sql, [ $pStoreRow['upload']['name'], $pStoreRow['upload']['type'], $pStoreRow['upload']['size'], $pStoreRow['user_id'], $pStoreRow['file_id'] ] ); } + // store pdf text layer in main content + if ( !empty( $pStoreRow['data'] ) ) { + $sql = "UPDATE `".BIT_DB_PREFIX."liberty_content` SET `data` = ? WHERE `content_id` = ?"; + $gBitSystem->mDb->query( $sql, [ $pStoreRow['data'], $pStoreRow['content_id'] ] ); + } + // ensure we have the correct guid in the db if( empty( $pStoreRow['attachment_plugin_guid'] )) { $pStoreRow['attachment_plugin_guid'] = LIBERTY_DEFAULT_MIME_HANDLER; @@ -226,6 +232,12 @@ if( !function_exists( '\Bitweaver\Liberty\mime_default_store' )) { ]; $gBitSystem->mDb->associateInsert( BIT_DB_PREFIX."liberty_attachments", $storeHash ); + // add text layer from attachment pdf and the like + if ( !empty( $pStoreRow['data'] ) ) { + $sql = "UPDATE `".BIT_DB_PREFIX."liberty_content` SET `data` = ? WHERE `content_id` = ?"; + $gBitSystem->mDb->query( $sql, [ $pStoreRow['data'], $pStoreRow['content_id'] ] ); + } + $ret = true; } else { $pStoreRow['errors']['liberty_process'] = "There was a problem processing the file."; |
