Permalink
Browse files

Fix vBulletin version detection for blob extraction, 1.6.9

  • Loading branch information...
1 parent 683a06a commit efe4ac5bc26a057c4d96081d3c83060b26fe95a3 @linc linc committed Oct 17, 2012
Showing with 22 additions and 8 deletions.
  1. +10 −3 class.vbulletin.php
  2. +1 −1 index.php
  3. +11 −4 vanilla2export.php
View
@@ -544,9 +544,16 @@ function ExportBlobs($Attachments = TRUE, $CustomAvatars = TRUE) {
if ($Attachments) {
$Identity = ($Ex->Exists('attachment', array('contenttypeid', 'contentid')) === TRUE) ? 'f.filedataid' : 'f.attachmentid';
$Sql = "select
- f.filedata,
- concat('attachments/', f.userid, '/', $Identity, '.attach') as Path
- from :_filedata f"; // :_filedata OR :_attachment depending on version; needs detection & fix.
+ f.filedata,
+ concat('attachments/', f.userid, '/', $Identity, '.attach') as Path
+ from ";
+
+ // Table is dependent on vBulletin version (v4+ is filedata, v3 is attachment)
+ if ($Ex->Exists('attachment', array('contenttypeid', 'contentid')) === TRUE)
+ $Sql .= ":_filedata f";
+ else
+ $Sql .= ":_attachment f";
+
$Ex->ExportBlobs($Sql, 'filedata', 'Path');
}
View
@@ -11,7 +11,7 @@
* @package VanillaPorter
*/
define('APPLICATION', 'Porter');
-define('APPLICATION_VERSION', '1.6.8');
+define('APPLICATION_VERSION', '1.6.9');
if(defined('DEBUG'))
error_reporting(E_ALL);
View
@@ -13,7 +13,7 @@
* @package VanillaPorter
*/
define('APPLICATION', 'Porter');
-define('APPLICATION_VERSION', '1.6.8');
+define('APPLICATION_VERSION', '1.6.9');
if(defined('DEBUG'))
error_reporting(E_ALL);
@@ -3007,9 +3007,16 @@ function ExportBlobs($Attachments = TRUE, $CustomAvatars = TRUE) {
if ($Attachments) {
$Identity = ($Ex->Exists('attachment', array('contenttypeid', 'contentid')) === TRUE) ? 'f.filedataid' : 'f.attachmentid';
$Sql = "select
- f.filedata,
- concat('attachments/', f.userid, '/', $Identity, '.attach') as Path
- from :_filedata f"; // :_filedata OR :_attachment depending on version; needs detection & fix.
+ f.filedata,
+ concat('attachments/', f.userid, '/', $Identity, '.attach') as Path
+ from ";
+
+ // Table is dependent on vBulletin version (v4+ is filedata, v3 is attachment)
+ if ($Ex->Exists('attachment', array('contenttypeid', 'contentid')) === TRUE)
+ $Sql .= ":_filedata f";
+ else
+ $Sql .= ":_attachment f";
+
$Ex->ExportBlobs($Sql, 'filedata', 'Path');
}

0 comments on commit efe4ac5

Please sign in to comment.