| 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 | function run() { |
| 18 | session_start(); |
| 19 | |
| 20 | require_once '../../civicrm.config.php'; |
| 21 | require_once 'CRM/Core/Config.php'; |
| 22 | $config = CRM_Core_Config::singleton(); |
| 23 | |
| 24 | // this does not return on failure |
| 25 | CRM_Utils_System::authenticateScript(TRUE); |
| 26 | if (!CRM_Core_Permission::check('administer CiviCRM')) { |
| 27 | CRM_Utils_System::authenticateAbort("User does not have required permission (administer CiviCRM).\n", TRUE); |
| 28 | } |
| 29 | |
| 30 | require_once 'CRM/Utils/Migrate/ImportJSON.php'; |
| 31 | $import = new CRM_Utils_Migrate_ImportJSON(); |
| 32 | |
| 33 | $import->run('/tmp/export.json'); |
| 34 | } |
| 35 | |
| 36 | run(); |