Merge pull request #4708 from jitendrapurohit/CRM-15662
[civicrm-core.git] / CRM / Contact / Import / Form / DataSource.php
index a1e2ed32348967417328cccf9745fd1fb9b810cd..ba0cc1d1f2f45bc6cb25c004c0b8cb4921ff746e 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -72,6 +72,12 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Core_Form {
     $handler    = opendir($config->uploadDir);
     $errorFiles = array('sqlImport.errors', 'sqlImport.conflicts', 'sqlImport.duplicates', 'sqlImport.mismatch');
 
+    // check for post max size avoid when called twice
+    $snippet = CRM_Utils_Array::value('snippet', $_GET, 0);
+    if (empty($snippet)) {
+      CRM_Core_Config_Defaults::formatUnitSize(ini_get('post_max_size'), TRUE);
+    }
+
     while ($file = readdir($handler)) {
       if ($file != '.' && $file != '..' &&
         in_array($file, $errorFiles) && !is_writable($config->uploadDir . $file)
@@ -227,6 +233,18 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Core_Form {
     );
   }
 
+  /**
+   * This virtual function is used to set the default values of
+   * various form elements
+   *
+   * access        public
+   *
+   * @return array reference to the array of default values
+   *
+   */
+  /**
+   * @return array
+   */
   function setDefaultValues() {
     $config = CRM_Core_Config::singleton();
     $defaults = array(
@@ -244,6 +262,10 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Core_Form {
     return $defaults;
   }
 
+  /**
+   * @return array
+   * @throws Exception
+   */
   private function _getDataSources() {
     // Open the data source dir and scan it for class files
     $config        = CRM_Core_Config::singleton();
@@ -351,6 +373,9 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Core_Form {
    * Add a PK and status column to the import table so we can track our progress
    * Returns the name of the primary key and status columns
    *
+   * @param $db
+   * @param $importTableName
+   *
    * @return array
    * @access private
    */