Merge pull request #4708 from jitendrapurohit/CRM-15662
[civicrm-core.git] / CRM / Contact / Import / Form / DataSource.php
index 23c61afba068bd2bb49eb252bfd4186d91091024..ba0cc1d1f2f45bc6cb25c004c0b8cb4921ff746e 100644 (file)
@@ -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
    */