Explorar el Código

Function to disable MySQL buffering for large exports

Alexandre Alapetite hace 9 años
padre
commit
568b737b6c
Se han modificado 2 ficheros con 8 adiciones y 0 borrados
  1. 2 0
      app/Controllers/importExportController.php
  2. 6 0
      lib/Minz/ModelPdo.php

+ 2 - 0
app/Controllers/importExportController.php

@@ -531,6 +531,8 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
 		$this->entryDAO = FreshRSS_Factory::createEntryDao($username);
 		$this->feedDAO = FreshRSS_Factory::createFeedDao($username);
 
+		$this->entryDAO->disableBuffering();
+
 		if ($export_feeds === true) {
 			//All feeds
 			$export_feeds = $this->feedDAO->listFeedsIds();

+ 6 - 0
lib/Minz/ModelPdo.php

@@ -116,6 +116,12 @@ class Minz_ModelPdo {
 		self::$sharedBd = null;
 		self::$sharedPrefix = '';
 	}
+
+	public function disableBuffering() {
+		if ((self::$sharedDbType === 'mysql') && defined('PDO::MYSQL_ATTR_USE_BUFFERED_QUERY')) {
+			$this->bd->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
+		}
+	}
 }
 
 class MinzPDO extends PDO {