Merge pull request #18084 from civicrm/5.28
[civicrm-core.git] / CRM / Contact / Import / Page / AJAX.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * This class contains all the function that are called using AJAX.
20 */
21 class CRM_Contact_Import_Page_AJAX {
22
23 /**
24 * Show import status.
25 */
26 public static function status() {
27 // make sure we get an id
28 if (!isset($_GET['id'])) {
29 return;
30 }
31
32 $config = CRM_Core_Config::singleton();
33 $file = "{$config->uploadDir}status_{$_GET['id']}.txt";
34 if (file_exists($file)) {
35 $str = file_get_contents($file);
36 echo $str;
37 }
38 else {
39 $status = "<div class='description'>&nbsp; " . ts('No processing status reported yet.') . "</div>";
40 echo json_encode([0, $status]);
41 }
42 CRM_Utils_System::civiExit();
43 }
44
45 }