本文整理汇总了PHP中Migration::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Migration::__construct方法的具体用法?PHP Migration::__construct怎么用?PHP Migration::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Migration
的用法示例。
在下文中一共展示了Migration::__construct方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($dbhost, $dbport = '1433', $dbuser, $dbpass, $dbname, $boost = false)
{
parent::__construct($dbhost, $dbport, $dbuser, $dbpass, $dbname, $boost);
ini_set('display_errors', 1);
ini_set('mssql.datetimeconvert', 0);
$this->odbtype = 'mssql';
}
示例2: __construct
public function __construct($arguments)
{
parent::__construct($arguments);
// Make sure we can use it for node and term only.
if (!in_array($this->entityType, array('node', 'taxonomy_term'))) {
throw new Exception('\\SkeletonMigration supports only nodes and terms.');
}
$this->description = t('Import @type - @bundle from SQL table', array('@type' => $this->entityType, '@bundle' => $this->bundle));
$this->fields = !empty($this->fields) ? $this->fields : array();
$sql_fields[] = '_unique_id';
if ($this->entityType == 'node') {
$this->addFieldMapping('title', '_title');
$class_name = 'MigrateDestinationNode';
$sql_fields[] = '_title';
} elseif ($this->entityType == 'taxonomy_term') {
$this->addFieldMapping('name', '_name');
$class_name = 'MigrateDestinationTerm';
$sql_fields[] = '_name';
}
// Rebuild the csv columns array.
$this->fields = array_merge($sql_fields, $this->fields);
// Create a map object for tracking the relationships between source rows
$key = array('_unique_id' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE));
$destination_handler = new MigrateDestinationEntityAPI($this->entityType, $this->bundle);
$this->map = new MigrateSQLMap($this->machineName, $key, $destination_handler->getKeySchema($this->entityType));
// Create a MigrateSource object.
$sql_table = isset($this->sqlTable) ? '_raw_' . $this->sqlTable : '_raw_' . $this->bundle;
$query = db_select($sql_table, 't')->fields('t')->orderBy('__id');
$this->source = new MigrateSourceSQL($query, $this->fields);
$this->destination = new $class_name($this->bundle, array('text_format' => 'filtered_html'));
}
示例3: __construct
public function __construct()
{
parent::__construct();
// Map fields that don't need extra definitions.
$field_names = array('id', 'weekday', 'hour_from', 'hour_to', 'cap');
$this->addSimpleMappings($field_names);
$this->addFieldMapping('meter_nid', 'meter_nid')->sourceMigration(array('NegawattIecMeterMigrate', 'NegawattModbusMeterMigrate'));
$this->description = t('Import @type - from CSV file.', array('@type' => $this->entityType));
// Create a map object for tracking the relationships between source rows
$key = array('id' => array('type' => 'int', 'not null' => TRUE));
$destination_handler = new MigrateDestinationEntityAPI($this->entityType, $this->bundle);
$this->map = new MigrateSQLMap($this->machineName, $key, $destination_handler->getKeySchema($this->entityType));
// Create a MigrateSource object.
$sql_migrate = variable_get('negawatt_migrate_sql', FALSE);
if ($sql_migrate) {
// SQL migration.
$query = db_select('_negawatt_power_cap_analyzer_info_migrate', $this->bundle)->fields($this->bundle, $field_names);
$this->source = new MigrateSourceSQL($query);
} else {
// CSV migration.
// Allow using variable to set path other than default.
$csv_path = variable_get('negawatt_migrate_csv_path', drupal_get_path('module', 'negawatt_migrate') . '/csv');
$this->source = new MigrateSourceCSV($csv_path . '/normalizer/' . $this->entityType . '.csv', $this->csvColumns, array('header_rows' => 1));
}
$this->destination = new MigrateDestinationEntityAPI($this->entityType, $this->bundle);
}
示例4: __construct
public function __construct($arguments)
{
parent::__construct($arguments);
// Source
$columns = array(0 => array('id', 'User ID'), 3 => array('fname', 'First Name'), 4 => array('lname', 'Last Name'));
$this->source = new MigrateSourceCSV('/path/to/myfile.csv', $columns);
// Destination
$this->destination = new MigrateDestinationNode('page');
// Key schema
$source_key_schema = array('nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE));
$this->map = new MigrateSQLMap($this->machineName, $source_key_schema, MigrateDestinationNode::getKeySchema());
// Mapping
$this->addFieldMapping('title', 'title');
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->description = t('Import @bundle terms from CSV file.', array('@bundle' => $this->bundle));
// Map fields that don't need extra definitions.
$field_names = array('id', 'name', 'weight', 'description', 'field_icon_categories');
$this->addSimpleMappings($field_names);
$this->addFieldMapping('account_id', 'account_id')->sourceMigration('NegawattAccountMigrate');
// Create a map object for tracking the relationships between source rows
$key = array('id' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE));
$destination_handler = new MigrateDestinationEntityAPI('taxonomy_term', $this->bundle);
$this->map = new MigrateSQLMap($this->machineName, $key, $destination_handler->getKeySchema('taxonomy_term'));
// Create a MigrateSource object.
$csv_file = 'taxonomy_term/' . $this->bundle . '.csv';
$this->source = new MigrateSourceCSV(drupal_get_path('module', 'negawatt_migrate') . '/csv/' . $csv_file, $this->csvColumns, array('header_rows' => 1));
$this->destination = new MigrateDestinationTerm($this->bundle);
}
示例6: __construct
public function __construct()
{
parent::__construct();
$this->description = t('Import users from a CSV file.');
$this->addFieldMapping('name', 'name');
$this->addFieldMapping('pass', 'pass');
$this->addFieldMapping('mail', 'mail');
$this->addFieldMapping('og_user_node', 'account')->sourceMigration('NegawattAccountMigrate')->separator('|');
$this->addFieldMapping('status')->defaultValue(TRUE);
// Create a map object for tracking the relationships between source rows
$key = array('name' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE));
$destination_handler = new MigrateDestinationUser();
$this->map = new MigrateSQLMap($this->machineName, $key, $destination_handler->getKeySchema());
// Create a MigrateSource object.
$this->source = new MigrateSourceCSV(drupal_get_path('module', 'negawatt_migrate') . '/csv/' . $this->entityType . '/user.csv', $this->csvColumns, array('header_rows' => 1));
$this->destination = new MigrateDestinationUser();
}
示例7: __construct
public function __construct($arguments = array())
{
parent::__construct($arguments);
// Make sure we can use it for node and term only.
if (!in_array($this->entityType, array('node', 'taxonomy_term'))) {
throw new Exception('\\NegawattMigration supports only nodes and terms.');
}
$this->description = t('Import @type - @bundle from CSV file.', array('@type' => $this->entityType, '@bundle' => $this->bundle));
$this->csvColumns = !empty($this->csvColumns) ? $this->csvColumns : array();
$csv_cols[] = array('Unique_ID', 'Unique_ID');
if ($this->entityType == 'node') {
$this->addFieldMapping('title', 'title');
$class_name = 'MigrateDestinationNode';
$csv_cols[] = array('title', 'Title');
} elseif ($this->entityType == 'taxonomy_term') {
$this->addFieldMapping('name', 'name');
$class_name = 'MigrateDestinationTerm';
$csv_cols[] = array('name', 'Name');
}
// Rebuild the csv columns array.
$this->csvColumns = array_merge($csv_cols, $this->csvColumns);
// Create a map object for tracking the relationships between source rows
$key = array('Unique_ID' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE));
$destination_handler = new MigrateDestinationEntityAPI($this->entityType, $this->bundle);
$this->map = new MigrateSQLMap($this->machineName, $key, $destination_handler->getKeySchema($this->entityType));
// Create a MigrateSource object.
$sql_migrate = variable_get('negawatt_migrate_sql', FALSE);
if ($sql_migrate) {
// SQL migration.
// Prepare sql column names from csvColumns
$sqlColumns = array();
foreach ($this->csvColumns as $col) {
$sqlColumns[] = $col[0];
}
$query = db_select('_negawatt_' . $this->bundle . '_migrate', $this->bundle)->fields($this->bundle, $sqlColumns);
$this->source = new MigrateSourceSQL($query);
} else {
// CSV migration.
// Allow using variable to set path other than default.
$csv_path = variable_get('negawatt_migrate_csv_path', drupal_get_path('module', 'negawatt_migrate') . '/csv');
$this->source = new MigrateSourceCSV($csv_path . '/' . $this->entityType . '/' . $this->bundle . '.csv', $this->csvColumns, array('header_rows' => 1));
}
$this->destination = new $class_name($this->bundle, array('text_format' => 'filtered_html'));
}
示例8: __construct
public function __construct($arguments)
{
parent::__construct($arguments);
$this->description = t('Import users from a CSV file.');
$this->addFieldMapping('og_user_node', '_company')->separator('|')->sourceMigration('SkeletonCompaniesMigrate');
$this->addFieldMapping('name', '_username');
$this->addFieldMapping('pass', '_password');
$this->addFieldMapping('mail', '_email');
$this->addFieldMapping('roles')->defaultValue(DRUPAL_AUTHENTICATED_RID);
$this->addFieldMapping('status')->defaultValue(TRUE);
// Create a map object for tracking the relationships between source rows
$key = array('_unique_id' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE));
$destination_handler = new MigrateDestinationUser();
$this->map = new MigrateSQLMap($this->machineName, $key, $destination_handler->getKeySchema());
$query = db_select('_raw_user', 't')->fields('t')->orderBy('__id');
$this->source = new MigrateSourceSQL($query, $this->fields);
// Create a MigrateSource object.
$this->destination = new MigrateDestinationUser();
}
示例9: array
function __construct()
{
parent::__construct();
$this->new_configs = array('calendar_user_control_data' => array('name' => 'CALENDAR_SETTINGS', 'range' => 'user', 'type' => 'array', 'description' => 'persönliche Einstellungen des Kalenders', 'value' => json_encode(array("view" => "showweek", "start" => 9, "end" => 20, "step_day" => 900, "step_week" => 3600, "type_week" => "LONG", "holidays" => TRUE, "sem_data" => TRUE, "delete" => 0))), 'my_messaging_settings' => array('name' => 'MESSAGING_SETTINGS', 'range' => 'user', 'type' => 'array', 'description' => 'persönliche Einstellungen Nachrichtenbereich', 'value' => json_encode(array("show_only_buddys" => FALSE, "delete_messages_after_logout" => FALSE, "timefilter" => '30d', "opennew" => 1, "logout_markreaded" => FALSE, "openall" => FALSE, "addsignature" => FALSE, "save_snd" => TRUE, "sms_sig" => '', "send_view" => FALSE, "confirm_reading" => 3, "send_as_email" => FALSE, "folder" => array('in' => array('dummy'), 'out' => array('dummy'))))), 'forum' => array('name' => 'FORUM_SETTINGS', 'range' => 'user', 'type' => 'array', 'description' => 'persönliche Einstellungen Forum', 'value' => json_encode(array('neuauf' => false, 'rateallopen' => true, 'showimages' => true, 'sortthemes' => 'last', 'themeview' => 'mixed', 'presetview' => 'mixed', 'shrink' => 7 * 24 * 60 * 60))), 'my_schedule_settings' => array('name' => 'SCHEDULE_SETTINGS', 'range' => 'user', 'type' => 'array', 'description' => 'persönliche Einstellungen Stundenplan', 'value' => json_encode(array("glb_start_time" => 8, "glb_end_time" => 19, "glb_days" => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 0 => 0), "glb_sem" => null, "converted" => true))), 'homepage_cache_own' => array('name' => 'PROFILE_LAST_VISIT', 'range' => 'user', 'type' => 'integer', 'description' => 'Zeitstempel des letzten Besuchs der Profilseite', 'value' => 0), 'CurrentLogin' => array('name' => 'CURRENT_LOGIN_TIMESTAMP', 'range' => 'user', 'type' => 'integer', 'description' => 'Zeitstempel des Logins', 'value' => 0), 'LastLogin' => array('name' => 'LAST_LOGIN_TIMESTAMP', 'range' => 'user', 'type' => 'integer', 'description' => 'Zeitstempel des vorherigen Logins', 'value' => 0), 'my_studip_settings' => array('name' => 'PERSONAL_STARTPAGE', 'range' => 'user', 'type' => 'integer', 'description' => 'Persönliche Startseite', 'value' => 0), '_my_sem_group_field' => array('name' => 'MY_COURSES_GROUPING', 'range' => 'user', 'type' => 'string', 'description' => 'Gruppierung der Veranstaltungsübersicht', 'value' => ''), '_my_sem_open' => array('name' => 'MY_COURSES_OPEN_GROUPS', 'range' => 'user', 'type' => 'array', 'description' => 'geöffnete Gruppen der Veranstaltungsübersicht', 'value' => '[]'), '_my_admin_inst_id' => array('name' => 'MY_INSTITUTES_DEFAULT', 'range' => 'user', 'type' => 'string', 'description' => 'Standard Einrichtung in der Veranstaltungsübersicht für Admins', 'value' => ''));
}
示例10: __construct
public function __construct()
{
parent::__construct('2.84', '2.85', "ThWboard Development Team", "This migration requires an unmodified database schema based on version 2.84");
}
示例11: __construct
public function __construct()
{
parent::__construct('', '2.8', "ThWboard Development Team", "This migration installs the database schema for version 2.8");
}