コード例 #1
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_strings, $current_user;
     global $sugar_config;
     if ($this->importSource === FALSE) {
         $GLOBALS['log']->fatal("Found invalid adapter");
         $this->handleImportError($mod_strings['LBL_EXTERNAL_ERROR_NO_SOURCE']);
     }
     $columncount = isset($_REQUEST['columncount']) ? $_REQUEST['columncount'] : '';
     $fieldKeyTranslator = $this->getSugarToExternalFieldMapping($columncount);
     try {
         $this->importSource->loadDataSet($this->recordsPerImport);
     } catch (Exception $e) {
         $GLOBALS['log']->fatal("Unable to import external feed, exception: " . $e->getMessage());
         $this->handleImportError($mod_strings['LBL_EXTERNAL_ERROR_FEED_CORRUPTED']);
     }
     if (!ImportCacheFiles::ensureWritable()) {
         $GLOBALS['log']->fatal($mod_strings['LBL_ERROR_IMPORT_CACHE_NOT_WRITABLE']);
         $this->handleImportError($mod_strings['LBL_ERROR_IMPORT_CACHE_NOT_WRITABLE']);
     }
     $importer = new Importer($this->importSource, $this->bean);
     $importer->setFieldKeyTranslator($fieldKeyTranslator);
     $importer->import();
     //Send back our results.
     $metaResult = array('done' => FALSE, 'totalRecordCount' => $this->importSource->getTotalRecordCount());
     echo json_encode($metaResult);
     sugar_cleanup(TRUE);
 }
コード例 #2
0
ファイル: ImportTest.php プロジェクト: metator/application
 function testShouldImportName()
 {
     $csv = "name\n";
     $csv .= 'foo';
     $importer = new Importer($this->db);
     $importer->importFromText($csv);
     $categoryMapper = new \Metator\Category\DataMapper($this->db);
     $categories = $categoryMapper->findAll();
     $this->assertEquals('foo', $categories[0]['name'], 'should add a new category by name');
 }
コード例 #3
0
ファイル: ImporterTest.php プロジェクト: apolev/fias
 public function testImport()
 {
     $results = [[['id' => 1, 'madeIn' => 'China', 'title' => 'Phone'], ['id' => 2, 'madeIn' => 'USA', 'title' => 'Chicken wings'], ['id' => 3, 'madeIn' => 'Russia', 'title' => 'Topol-M']], [['id' => 4, 'madeIn' => 'France', 'title' => 'Wine'], ['id' => 5, 'madeIn' => 'Germany', 'title' => 'Audi'], ['id' => 6, 'madeIn' => 'Denmark', 'title' => 'Tulip']]];
     $reader = $this->getReaderMock($this, $results);
     $fields = ['madeIn' => ['name' => 'two'], 'id' => ['name' => 'one'], 'title' => ['name' => 'three']];
     $importer = new Importer($this->db, $this->table, $fields);
     $tableName = $importer->import($reader);
     $this->assertEquals(6, $this->db->execute('SELECT COUNT(*) count FROM ?F', [$tableName])->fetchResult());
     $this->assertEquals('USA', $this->db->execute("SELECT two FROM ?F WHERE one = '2'", [$tableName])->fetchResult());
     $this->assertEquals('Tulip', $this->db->execute("SELECT three FROM ?F WHERE one = '6'", [$tableName])->fetchResult());
 }
コード例 #4
0
 public function testNoNewTweets()
 {
     // model with all current tweets
     $model = $this->getMockBuilder('AMWhalen\\ArchiveMyTweets\\Model')->disableOriginalConstructor()->getMock();
     // Calling $model->addTweets() will now return 0
     $model->expects($this->any())->method('addTweets')->will($this->returnValue(0));
     // expect model to not add any new tweets
     $importer = new Importer();
     $output = $importer->importJSON(dirname(__FILE__) . '/json', $model);
     $this->assertTrue($this->didFindString($output, 'No new tweets found.'));
 }
コード例 #5
0
ファイル: Bug45963Test.php プロジェクト: delkyd/sugarcrm_dev
 /**
  * @group bug45963
  */
 public function testGetImportableModules()
 {
     $modules = Importer::getImportableModules();
     $this->assertTrue(empty($modules['Groups']));
     $this->assertNotEmpty($modules['Contacts']);
     $this->assertNotEmpty($modules['Accounts']);
 }
コード例 #6
0
 /** 
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $sugar_config;
     // Check to be sure we are getting an import file that is in the right place
     if (realpath(dirname($_REQUEST['tmp_file']) . '/') != realpath($sugar_config['upload_dir'])) {
         trigger_error($mod_strings['LBL_CANNOT_OPEN'], E_USER_ERROR);
     }
     // Open the import file
     $importSource = new ImportFile($_REQUEST['tmp_file'], $_REQUEST['custom_delimiter'], html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES));
     //Ensure we have a valid file.
     if (!$importSource->fileExists()) {
         trigger_error($mod_strings['LBL_CANNOT_OPEN'], E_USER_ERROR);
     }
     $importer = new Importer($importSource, $this->bean);
     $importer->import();
 }
コード例 #7
0
ファイル: wp2phpboost.php プロジェクト: ppelisset/WP2PhpBoost
function getImporterList()
{
    static $availableImporter;
    global $io;
    if (is_null($availableImporter)) {
        $availableImporter = Importer::getAvailableImporter();
    }
    $io->writeln('Liste des importers existants :');
    foreach ($availableImporter as $importer) {
        $io->writeln('  - ' . $importer['name'] . ' (' . $importer['version'] . ') : ' . $importer['description']);
    }
    $io->writeln();
    $io->writeln('Lister les importateurs à utiliser (séparer les par une virgule) :');
    $importerListStr = $io->read('list-importer');
    $importerList = explode(',', $importerListStr);
    $importerList = array_map(function ($str) {
        return trim($str);
    }, $importerList);
    foreach ($importerList as $importer) {
        if (!array_key_exists($importer, $availableImporter)) {
            return false;
        }
    }
    define('IMPORTER_LIST', implode(',', $importerList));
    return true;
}
コード例 #8
0
ファイル: ShopImporter.php プロジェクト: jarold87/pingvin
 protected function initItemCollector()
 {
     parent::initItemCollector();
     $this->itemCollector->setRequestModel($this->requestModel);
     $this->itemCollector->setResponseDataConverter($this->responseDataConverter);
     $this->itemCollector->setAllowanceValidator($this->allowanceValidator);
     $this->itemCollector->setClient($this->clientAdapter);
 }
コード例 #9
0
ファイル: view.step4.php プロジェクト: thsonvt/sugarcrm_dev
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $sugar_config;
     // Check to be sure we are getting an import file that is in the right place
     $uploadFile = "upload://" . basename($_REQUEST['tmp_file']);
     if (!file_exists($uploadFile)) {
         trigger_error($mod_strings['LBL_CANNOT_OPEN'], E_USER_ERROR);
     }
     // Open the import file
     $importSource = new ImportFile($uploadFile, $_REQUEST['custom_delimiter'], html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES));
     //Ensure we have a valid file.
     if (!$importSource->fileExists()) {
         trigger_error($mod_strings['LBL_CANNOT_OPEN'], E_USER_ERROR);
     }
     if (!ImportCacheFiles::ensureWritable()) {
         trigger_error($mod_strings['LBL_ERROR_IMPORT_CACHE_NOT_WRITABLE'], E_USER_ERROR);
     }
     $importer = new Importer($importSource, $this->bean);
     $importer->import();
 }
コード例 #10
0
 /**
  * @todo: docs
  */
 public function __construct()
 {
     parent::__construct();
     if (!file_exists(dirname(__FILE__) . '/config.ini')) {
         // for now we bail out if there is no config.ini with login and password details
         throw new RuntimeException('Please create config.ini file with "apihost", "apiprotocol", "repohost", "repoprotocol", "login", "password", and optionally "wget" set to true if you want to use wget for HTTP operations');
     } else {
         $this->api = new com_meego_obsconnector_API($this->config['apiprotocol'], $this->config['apihost'], $this->config['login'], $this->config['password'], $this->config['wget'], $this->config['wget_options']);
         $this->download_repo_host = $this->config['repohost'];
         $this->download_repo_protocol = $this->config['repoprotocol'];
     }
 }
コード例 #11
0
 /**
  * Generate module
  */
 protected function compile()
 {
     // Create files
     if (\Input::post('FORM_SUBMIT') == 'tl_entity_import') {
         $objModel = EntityImportConfigModel::findByPk($this->objDc->id);
         if ($objModel === null) {
             return;
         }
         if (class_exists($objModel->importerClass)) {
             // use a particular importer (e.g. NewsImporter)
             \Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_entity_import_config']['importerInfo'], $objModel->importerClass));
             $importer = new $objModel->importerClass($objModel);
         } else {
             \Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_entity_import_config']['importerInfo'], 'Importer'));
             $importer = new Importer($objModel);
         }
         if ($importer->run(\Input::post('dry-run'))) {
             // Confirm and reload
             $strMessage = $GLOBALS['TL_LANG']['tl_entity_import_config']['confirm'];
             if (\Input::post('dry-run')) {
                 $strMessage = $GLOBALS['TL_LANG']['tl_entity_import_config']['confirmDry'];
             }
             \Message::addConfirmation($strMessage);
             \Controller::reload();
         }
     }
     $this->Template->base = \Environment::get('base');
     $this->Template->href = \Controller::getReferer(true);
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']);
     $this->Template->action = ampersand(\Environment::get('request'));
     $this->Template->selectAll = $GLOBALS['TL_LANG']['MSC']['selectAll'];
     $this->Template->button = $GLOBALS['TL_LANG']['MSC']['backBT'];
     $this->Template->message = \Message::generate();
     $this->Template->submit = specialchars($GLOBALS['TL_LANG']['tl_entity_import_config']['import'][0]);
     $this->Template->dryRun = specialchars($GLOBALS['TL_LANG']['tl_entity_import_config']['dryRun'][0]);
     $this->Template->headline = sprintf($GLOBALS['TL_LANG']['tl_entity_import_config']['headline'], \Input::get('id'));
     $this->Template->explain = $GLOBALS['TL_LANG']['tl_entity_import_config']['make'][1];
     $this->Template->label = $GLOBALS['TL_LANG']['tl_entity_import_config']['label'];
 }
コード例 #12
0
 public static function cbd_run()
 {
     $proc = new XSLTProcessor();
     $proc->importStyleSheet(DOMDocument::load('xsl/cbd.xsl'));
     global $registerPHPFunctions;
     if ($registerPHPFunctions) {
         $proc->registerPHPFunctions($registerPHPFunctions);
     }
     $cbd_xml = $proc->transformToDoc(DOMDocument::load('db://?all-data'));
     $xml = simplexml_import_dom($cbd_xml) or die('import failed');
     global $cbd_host, $cbd_db, $cbd_user, $cbd_pwd;
     $conn_pg = pg_connect("host='{$cbd_host}' dbname={$cbd_db} user={$cbd_user} password={$cbd_pwd}") or die("error on connection to {$cbd_db}");
     Importer::_run($xml, $conn_pg);
 }
コード例 #13
0
ファイル: view.step1.php プロジェクト: jglaine/sugar761-ent
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_strings, $current_user;
     global $sugar_config;
     $this->ss->assign("MODULE_TITLE", $this->getModuleTitle(false));
     $this->ss->assign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_DELETE']));
     $this->ss->assign("PUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('publish_inline', 'align="absmiddle" border="0"', null, null, '.gif', $mod_strings['LBL_PUBLISH']));
     $this->ss->assign("UNPUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('unpublish_inline', 'align="absmiddle" border="0"', null, null, '.gif', $mod_strings['LBL_UNPUBLISH']));
     $this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
     $showModuleSelection = $this->importModule == 'Administration';
     $importableModulesOptions = array();
     $importablePersonModules = array();
     //If we are coming from the admin link, get the module list.
     if ($showModuleSelection) {
         $tmpImportable = Importer::getImportableModules();
         $importableModulesOptions = get_select_options_with_id($tmpImportable, '');
         $importablePersonModules = $this->getImportablePersonModulesJS();
         $this->ss->assign("IMPORT_MODULE", key($tmpImportable));
     } else {
         $this->instruction = 'LBL_SELECT_DS_INSTRUCTION';
         $this->ss->assign('INSTRUCTION', $this->getInstruction());
     }
     $this->ss->assign("FROM_ADMIN", $showModuleSelection);
     $this->ss->assign("PERSON_MODULE_LIST", json_encode($importablePersonModules));
     $this->ss->assign("showModuleSelection", $showModuleSelection);
     $this->ss->assign("IMPORTABLE_MODULES_OPTIONS", $importableModulesOptions);
     $this->ss->assign("EXTERNAL_APIS", $this->getExternalApis());
     $this->ss->assign("EXTERNAL_SOURCES", $this->getAllImportableExternalEAPMs());
     $this->ss->assign("EXTERNAL_AUTHENTICATED_SOURCES", json_encode($this->getAuthenticatedImportableExternalEAPMs()));
     $selectExternal = !empty($_REQUEST['application']) ? $_REQUEST['application'] : '';
     $this->ss->assign("selectExternalSource", $selectExternal);
     $content = $this->ss->fetch('modules/Import/tpls/step1.tpl');
     $submitContent = "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td align=\"right\">";
     $submitContent .= "<input title=\"" . $mod_strings['LBL_IMPORT_COMPLETE'] . "\" onclick=\"SUGAR.importWizard.closeDialog();\" class=\"button\" type=\"submit\" name=\"finished\" value=\"  " . $mod_strings['LBL_IMPORT_COMPLETE'] . "  \" id=\"finished\">";
     $submitContent .= "<input title=\"" . $mod_strings['LBL_NEXT'] . "\" class=\"button primary\" type=\"submit\" name=\"button\" value=\"  " . $mod_strings['LBL_NEXT'] . "  \"  id=\"gonext\"></td></tr></table>";
     $this->ss->assign("JAVASCRIPT", $this->_getJS());
     $this->ss->assign("CONTENT", $content);
     $this->ss->display('modules/Import/tpls/wizardWrapper.tpl');
 }
コード例 #14
0
ファイル: NagiosImportEngine.php プロジェクト: Evolix/lilac
 public function __construct($engine, $fileSegment)
 {
     $this->fileSegment = $fileSegment;
     parent::__construct($engine);
 }
コード例 #15
0
ファイル: init.php プロジェクト: aliasio/geoip
        $sth->bindParam('is_satellite_provider', $values['is_satellite_provider'], \PDO::PARAM_INT);
        $sth->execute();
    });
    Importer::csvRead($files['GeoLite2-Country-Locations-en.csv'], function ($values) use($dbh) {
        $sth = $dbh->prepare('
			INSERT INTO country_locations (
				geoname_id,
				locale_code,
				continent_code,
				continent_name,
				country_iso_code,
				country_name
			) VALUES (
				:geoname_id,
				:locale_code,
				:continent_code,
				:continent_name,
				:country_iso_code,
				:country_name
			)
			');
        $sth->bindParam('geoname_id', $values['geoname_id'], \PDO::PARAM_INT);
        $sth->bindParam('locale_code', $values['locale_code'], \PDO::PARAM_STR);
        $sth->bindParam('continent_code', $values['continent_code'], \PDO::PARAM_STR);
        $sth->bindParam('continent_name', $values['continent_name'], \PDO::PARAM_STR);
        $sth->bindParam('country_iso_code', $values['country_iso_code'], \PDO::PARAM_STR);
        $sth->bindParam('country_name', $values['country_name'], \PDO::PARAM_STR);
        $sth->execute();
    });
} catch (\Exception $e) {
    echo $e->getMessage() . "\n";
    exit(1);
コード例 #16
0
ファイル: AddressObjectsUpdater.php プロジェクト: apolev/fias
 public function __construct(ConnectionInterface $db, $table, array $fields)
 {
     parent::__construct($db, $table, $fields, true);
 }
コード例 #17
0
ファイル: HousesUpdater.php プロジェクト: apolev/fias
 public function __construct(ConnectionInterface $db, $table, array $fields)
 {
     $fields['full_number'] = ['name' => 'full_number'];
     parent::__construct($db, $table, $fields, true);
 }
コード例 #18
0
ファイル: Bug46411Test.php プロジェクト: delkyd/sugarcrm_dev
 public function saveImportBean($focus, $newRecord)
 {
     return parent::saveImportBean($focus, $newRecord);
 }
コード例 #19
0
ファイル: Comments.php プロジェクト: hosszukalman/wp2drupal
 public function __construct()
 {
     parent::__construct();
     $this->getDrupalCommentIdByWpIdStatement = $this->dbhImport->prepare("SELECT cid FROM comments WHERE wp_comment_id = :wp_comment_id");
     $this->getDruaplNodeIdByWpPostIdStatement = $this->dbhImport->prepare("SELECT nid FROM posts WHERE post_id = :wp_post_id");
 }
コード例 #20
0
 /**
  * @dataProvider providerCsvData
  */
 public function testDateTimeImport($content_idx, $expected_datetime, $date_format, $time_format)
 {
     $file = $GLOBALS['sugar_config']['upload_dir'] . 'test.csv';
     $ret = file_put_contents($file, self::$CsvContent[$content_idx]);
     $this->assertGreaterThan(0, $ret, 'Failed to write to ' . $file . ' for content ' . $content_idx);
     $importSource = new ImportFile($file, ',', '"');
     $bean = loadBean($this->_importModule);
     $_REQUEST['columncount'] = 2;
     $_REQUEST['colnum_0'] = 'date_entered';
     $_REQUEST['colnum_1'] = 'last_name';
     $_REQUEST['import_module'] = 'Contacts';
     $_REQUEST['importlocale_charset'] = 'UTF-8';
     $_REQUEST['importlocale_dateformat'] = $date_format;
     $_REQUEST['importlocale_timeformat'] = $time_format;
     $_REQUEST['importlocale_timezone'] = 'GMT';
     $_REQUEST['importlocale_default_currency_significant_digits'] = '2';
     $_REQUEST['importlocale_currency'] = '-99';
     $_REQUEST['importlocale_dec_sep'] = '.';
     $_REQUEST['importlocale_currency'] = '-99';
     $_REQUEST['importlocale_default_locale_name_format'] = 's f l';
     $_REQUEST['importlocale_num_grp_sep'] = ',';
     $importer = new Importer($importSource, $bean);
     $importer->import();
     $query = "SELECT date_entered from contacts where created_by='{$GLOBALS['current_user']->id}'";
     $result = $GLOBALS['db']->query($query);
     $row = $GLOBALS['db']->fetchByAssoc($result);
     $this->assertEquals($expected_datetime, $GLOBALS['db']->fromConvert($row['date_entered'], 'datetime'), 'Got incorrect date_entered.');
 }
コード例 #21
0
 public function __construct(&$parent)
 {
     parent::__construct($parent);
 }
コード例 #22
0
ファイル: Import.php プロジェクト: remarco-mif/ppos
<?php

session_start();
include "../../Includes.php";
function redirect()
{
    header("location: ../../index.php?info=admin/vartotojai");
}
$login = new Session(1);
if (!$login->isLogedin()) {
    die("You must loged in!");
}
$file = $_FILES['file'];
if ($file['error'] != 0) {
    die("<p style='color:red;'>Ivyko klaida ikeliant faila! Error nr: " . $file['error'] . "</p>");
}
if ($file['type'] != "application/vnd.ms-excel") {
    die("<p style='color:red;'>Blogas failo formatas!</p>");
}
$importer = new Importer($file['tmp_name']);
$importer->import();
echo "<p style='color:green;'>Importuota.</p>";
コード例 #23
0
ファイル: script.php プロジェクト: ls-wang/data-import-script
            $this->commitData($sheet);
        }
    }
    public function commitData($sheet = null)
    {
        if (is_null($sheet)) {
            foreach (array_keys($this->_pending_data) as $sheet) {
                $this->commitData($sheet);
            }
            return;
        }
        error_log("commiting {$sheet} {$this->_pending_data[$sheet][0][0]}");
        $curl = curl_init("https://sheethub.com{$sheet}/insert?access_token=" . getenv('access_token'));
        $params = array();
        $params[] = 'data=' . urlencode(json_encode($this->_pending_data[$sheet], JSON_UNESCAPED_UNICODE));
        $params[] = 'unique_columns[]=' . $this->_unique_column_id[$sheet];
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, implode('&', $params));
        $content = curl_exec($curl);
        $obj = json_decode($content);
        error_log($content);
        if (is_null($obj->data->count)) {
            error_log('count null, retry');
            $this->commitData($sheet);
            return;
        }
        $this->_pending_data[$sheet] = array();
    }
}
$i = new Importer();
$i->main();
コード例 #24
0
 /**
  * Check if semi-colon separated non-primary mails
  * are being imported properly
  *
  * @dataProvider providerEmailImport
  */
 public function testEmailImport($module, $lastName, $expected, $test)
 {
     $fileCreated = sugar_file_put_contents($this->_file, $test);
     $this->assertGreaterThan(0, $fileCreated, 'Failed to write to ' . $this->_file);
     // Create the ImportFile the Importer uses from our CSV
     $importSource = new ImportFile($this->_file, ',', '"');
     // Create the bean type we're importing
     $this->_importObject = $bean = new $module();
     // Setup needed $_REQUEST data
     $_REQUEST['columncount'] = 2;
     $_REQUEST['colnum_0'] = 'email_addresses_non_primary';
     $_REQUEST['colnum_1'] = 'last_name';
     // A few changed for Accounts module
     if ($module == "Account") {
         $_REQUEST['columncount'] = 3;
         $_REQUEST['colnum_1'] = 'name';
         $_REQUEST['colnum_2'] = 'team_id';
     }
     $_REQUEST['import_module'] = $bean->module_dir;
     $_REQUEST['importlocale_charset'] = 'UTF-8';
     $_REQUEST['importlocale_dateformat'] = "m/d/Y";
     $_REQUEST['importlocale_timeformat'] = "h:i a";
     $_REQUEST['importlocale_timezone'] = 'GMT';
     $_REQUEST['importlocale_default_currency_significant_digits'] = '2';
     $_REQUEST['importlocale_currency'] = '-99';
     $_REQUEST['importlocale_dec_sep'] = '.';
     $_REQUEST['importlocale_currency'] = '-99';
     $_REQUEST['importlocale_default_locale_name_format'] = 's f l';
     $_REQUEST['importlocale_num_grp_sep'] = ',';
     // Create the Importer and try importing
     $importer = new Importer($importSource, $bean);
     $importer->import();
     // Check if the Lead is created
     $query = "SELECT id FROM {$bean->table_name} WHERE {$_REQUEST['colnum_1']} = '{$lastName}'";
     $result = $GLOBALS['db']->query($query);
     $row = $GLOBALS['db']->fetchByAssoc($result);
     $this->assertNotEmpty($row['id'], $module . ' not created');
     // Save Lead id for easier cleanup after test
     $this->_cleanId = $row['id'];
     // Check if all of the mails got created and linked properly
     foreach ($expected as $mail) {
         // Check if the mail got created
         $query = "SELECT id FROM email_addresses WHERE email_address = '{$mail}'";
         $result = $GLOBALS['db']->query($query);
         $row = $GLOBALS['db']->fetchByAssoc($result);
         $this->assertNotEmpty($row['id'], 'Mail not created');
         $mailId = $row['id'];
         // Check if the mail is linked
         $query = "SELECT id FROM email_addr_bean_rel WHERE email_address_id = '{$mailId}' AND bean_module = '{$bean->module_dir}' AND deleted = 0 AND primary_address = 0";
         $result = $GLOBALS['db']->query($query);
         $row = $GLOBALS['db']->fetchByAssoc($result);
         $this->assertNotEmpty($row['id'], 'Mail not linked');
     }
 }
コード例 #25
0
ファイル: tiki-forum_import.php プロジェクト: rjsmelo/tiki
 ** STATE OF THE CODE
 ** -----------------
 ** - Currently only works when importing Tiki forums from an SQL file.
 ** - SQL file dump must be set to escape single quotes with \' instead of ''
 ** - If you get timeout problems, you may need to increase your php.ini
 **   'max_execution_time' to something like 120 or more, depending on the
 **   size of your SQL file.  120 is good for a file around 20Mb.
 **
 ****************************************************************************/
// Initialization
$inputConfiguration = array(array('staticKeyFilters' => array('step1' => 'word', 'step2' => 'word', 'step3' => 'word', 'import' => 'word', 'fForumid' => 'digits', 'tForumid' => 'digits', 'ftype' => 'word', 'prefix' => 'word', 'server' => 'striptags')));
require_once 'tiki-setup.php';
$access->check_feature('feature_forums');
$access->check_permission('tiki_p_admin_forum');
include_once 'lib/importerlib.php';
$import = new Importer($dbTiki);
global $prefs;
// Which iteration of the process are we in?
// Step 0 - Select Import Method
// Step 1 - Test Import Method Succeeded
// Step 2 - Select Forum to Import From/To
// Step 3 - Migration Complete - Do Again?
if (isset($_POST["step4"])) {
} else {
    if (isset($_POST["step3"])) {
        if ($_POST["import"] == 'same') {
            // Same db and server
        } else {
            if ($_POST["import"] == 'other') {
                // Different db & server
            } else {
コード例 #26
0
 /**
  * @dataProvider errorSet
  */
 public function testHandleImportErrors($errno, $errstr, $errfile, $errline)
 {
     $old_error_reporting = error_reporting(E_ALL);
     Importer::handleImportErrors($errno, $errstr, $errfile, $errline);
     switch ($errno) {
         case E_USER_WARNING:
         case E_WARNING:
             //$this->assertEquals("WARNING: [$errno] $errstr on line $errline in file $errfile<br />",$output);
             break;
         case E_USER_NOTICE:
         case E_NOTICE:
             //$this->assertEquals("NOTICE: [$errno] $errstr on line $errline in file $errfile<br />",$output);
             break;
         case E_STRICT:
             //$this->assertEquals('',$output);
             break;
         default:
             $this->expectOutputString("Unknown error type: [{$errno}] {$errstr} on line {$errline} in file {$errfile}<br />\n");
             break;
     }
     error_reporting($old_error_reporting);
 }
コード例 #27
0
ファイル: Bug61172Test.php プロジェクト: delkyd/sugarcrm_dev
 public function saveMappingFile()
 {
     parent::saveMappingFile();
 }
コード例 #28
0
ファイル: api.php プロジェクト: radixvinni/xml-data-resource
function error($code)
{
    header("Location: index.php?error={$code}");
    Importer::log("error", $code);
}
コード例 #29
0
ファイル: Bug50438Test.php プロジェクト: jgera/sugarcrm_dev
 public function testParentsAreRelatedDuringImport()
 {
     $file = 'upload://test50438.csv';
     $ret = file_put_contents($file, $this->fileArr);
     $this->assertGreaterThan(0, $ret, 'Failed to write to ' . $file . ' for content ' . var_export($this->fileArr, true));
     $importSource = new ImportFile($file, ',', '"');
     $bean = loadBean('Calls');
     $_REQUEST['columncount'] = 5;
     $_REQUEST['colnum_0'] = 'id';
     $_REQUEST['colnum_1'] = 'subject';
     $_REQUEST['colnum_2'] = 'status';
     $_REQUEST['colnum_3'] = 'parent_type';
     $_REQUEST['colnum_4'] = 'parent_id';
     $_REQUEST['import_module'] = 'Contacts';
     $_REQUEST['importlocale_charset'] = 'UTF-8';
     $_REQUEST['importlocale_timezone'] = 'GMT';
     $_REQUEST['importlocale_default_currency_significant_digits'] = '2';
     $_REQUEST['importlocale_currency'] = '-99';
     $_REQUEST['importlocale_dec_sep'] = '.';
     $_REQUEST['importlocale_currency'] = '-99';
     $_REQUEST['importlocale_default_locale_name_format'] = 's f l';
     $_REQUEST['importlocale_num_grp_sep'] = ',';
     $_REQUEST['importlocale_dateformat'] = 'm/d/y';
     $_REQUEST['importlocale_timeformat'] = 'h:i:s';
     $importer = new Importer($importSource, $bean);
     $importer->import();
     //fetch the bean using the passed in id and get related contacts
     require_once 'modules/Calls/Call.php';
     $call = new Call();
     $call->retrieve($this->call_id);
     $call->load_relationship('contacts');
     $related_contacts = $call->contacts->get();
     //test that the contact id is in the array of related contacts.
     $this->assertContains($this->contact->id, $related_contacts, ' Contact was not related during simulated import despite being set in related parent id');
     unset($call);
     /*
     if (is_file($file)) {
         unlink($file);
     }
     */
 }
コード例 #30
0
ファイル: lib.php プロジェクト: Br3nda/mahara
 public function __construct(Importer $importer)
 {
     $this->importer = $importer;
     $this->token = $importer->get('token');
     $this->host = get_record('host', 'wwwroot', $importer->get('host'));
 }