summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2026-04-02 10:09:23 +0100
committerlsces <lester@lsces.co.uk>2026-04-02 10:09:23 +0100
commit2e6172918ec330f1963f00b471896f96c288c0b0 (patch)
tree932c2ee7d94e1c9e1ac51ab3468d0603586996dd /plugins
parentba0cd3868f23ec846154aa5881f42a03c283a155 (diff)
downloadliberty-2e6172918ec330f1963f00b471896f96c288c0b0.tar.gz
liberty-2e6172918ec330f1963f00b471896f96c288c0b0.tar.bz2
liberty-2e6172918ec330f1963f00b471896f96c288c0b0.zip
pdf plugin now imports the text layer which is uploaded as liberty_content data so pdf's can be searched.
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/mime.default.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/mime.default.php b/plugins/mime.default.php
index 42af3a4..ffe13ab 100755
--- a/plugins/mime.default.php
+++ b/plugins/mime.default.php
@@ -170,6 +170,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;
@@ -177,8 +183,8 @@ if( !function_exists( '\Bitweaver\Liberty\mime_default_update' )) {
$gBitSystem->mDb->associateUpdate(
BIT_DB_PREFIX."liberty_attachments",
- array( 'attachment_plugin_guid' => $pStoreRow['attachment_plugin_guid'] ),
- array( 'attachment_id' => $pStoreRow['attachment_id'] )
+ [ 'attachment_plugin_guid' => $pStoreRow['attachment_plugin_guid'] ],
+ [ 'attachment_id' => $pStoreRow['attachment_id'] ]
);
}
}
@@ -220,6 +226,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.";