User:Kelson/Memo

From Wikimedia UK
Jump to navigation Jump to search

Mediawiki

MySQL

# Get table list with prefix
mysql -N information_schema -ufoouser -pfoopass -e "SELECT table_name FROM tables where table_schema='foodb' AND table_name like 'prefix_%'" > tables.txt

# Dump only a subselection of table in a DB
mysqldump -ufoouser -pfoopass dbname `cat tables.txt` | xz > dbname.sql.xz

# Dump DB without triggers
mysqldump --skip-triggers -ufoouser -pfoopass foobar | xz > foobar.notriggers.sql.xz

# Dump only trigger
mysqldump --no-create-info --no-create-db --skip-opt --no-data -ufoouser -pfoopass foobar | xz > foobar.triggers.sql.xz

# Rewrite trigger SQL dump
cat db.triggers.sql.xz | xz -d -c | sed -e 's/`user`@/`newuser`@/g' | sed -e 's/`dbname`\./`newdbname`./g' | xz > newdb.triggers.sql.xz

# Drop specific tables
for TABLE in `cat foobar.tables` ; do echo "SET foreign_key_checks = 0;  DROP TABLE $TABLE" | mysql -ufoouser -pfoopas foobar ; echo $TABLE ; done

CiviCRM

Cleanup Caches and Update Paths
/civicrm/admin/setting/updateConfigBackend?reset=1
Configure Paths
/civicrm/admin/setting/path?reset=1
Upgrade
/civicrm/upgrade?reset=1
Cleanup data (for data integrity)
/civicrm/upgrade/cleanup425?reset=1
More debug information
// Log files are located in the files/civicrm/templates_c/en_US/ConfigAndLog/ directory by default.
define('CIVICRM_DAO_DEBUG', 1);
define('CIVICRM_DEBUG_LOG_QUERY', 1);
define('CIVICRM_DEBUG_LOG_QUERY', 'backtrace');
Create civicrm_setting table
 CREATE TABLE `civicrm_setting` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `group_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'group name for setting element, useful in caching setting elemen\
ts',
  `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Unique name for setting',
  `value` text COLLATE utf8_unicode_ci COMMENT 'data associated with this group / name combo',
  `domain_id` int(10) unsigned NOT NULL COMMENT 'Which Domain is this menu item for',
  `contact_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to Contact ID if the setting is localized to a contact',
  `is_domain` tinyint(4) DEFAULT NULL COMMENT 'Is this setting a contact specific or site wide setting?',
  `component_id` int(10) unsigned DEFAULT NULL COMMENT 'Component that this menu item belongs to',
  `created_date` datetime DEFAULT NULL COMMENT 'When was the setting created',
  `created_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_contact, who created this setting',
  PRIMARY KEY (`id`),
  KEY `index_group_name` (`group_name`,`name`),
  KEY `FK_civicrm_setting_domain_id` (`domain_id`),
  KEY `FK_civicrm_setting_contact_id` (`contact_id`),
  KEY `FK_civicrm_setting_component_id` (`component_id`),
  KEY `FK_civicrm_setting_created_id` (`created_id`),
  CONSTRAINT `FK_civicrm_setting_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`) ON DELETE CASCADE,
  CONSTRAINT `FK_civicrm_setting_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE,
  CONSTRAINT `FK_civicrm_setting_component_id` FOREIGN KEY (`component_id`) REFERENCES `civicrm_component` (`id`),
  CONSTRAINT `FK_civicrm_setting_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
Sync table bewtween Drupal and Civicrm
civicrm_uf_match