[ Index ] |
PHP Cross Reference of GlotPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Installs GlotPress for the purpose of the unit-tests. 4 * 5 * @package GlotPress 6 * @subpackage Tests 7 */ 8 9 error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT ); 10 11 $config_file_path = $argv[1]; 12 $tests_dir_path = $argv[2]; 13 $multisite = ! empty( $argv[3] ); 14 15 require_once $config_file_path; 16 require_once $tests_dir_path . '/includes/functions.php'; 17 require_once $tests_dir_path . '/includes/mock-mailer.php'; 18 19 /** 20 * Loads GlotPress. 21 */ 22 function _load_glotpress() { 23 require dirname( dirname( dirname( __DIR__ ) ) ) . '/glotpress.php'; 24 } 25 tests_add_filter( 'muplugins_loaded', '_load_glotpress' ); 26 27 /** 28 * Sets a permalink structure so GlotPress doesn't skip loading. 29 * 30 * @return string 31 */ 32 function _set_permalink_structure() { 33 return '/%postname%'; 34 } 35 tests_add_filter( 'pre_option_permalink_structure', '_set_permalink_structure' ); 36 37 $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN; 38 // @codingStandardsIgnoreStart 39 $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; 40 // @codingStandardsIgnoreEnd 41 42 require_once ABSPATH . '/wp-settings.php'; 43 44 echo "Installing GlotPress...\n"; 45 46 /* 47 * default_storage_engine and storage_engine are the same option, but storage_engine 48 * was deprecated in MySQL (and MariaDB) 5.5.3, and removed in 5.7. 49 */ 50 if ( version_compare( $wpdb->db_version(), '5.5.3', '>=' ) ) { 51 $wpdb->query( 'SET default_storage_engine = InnoDB' ); 52 } else { 53 $wpdb->query( 'SET storage_engine = InnoDB' ); 54 } 55 $wpdb->select( DB_NAME, $wpdb->dbh ); 56 57 // Drop GlotPress tables. 58 foreach ( $wpdb->get_col( "SHOW TABLES LIKE '" . $wpdb->prefix . "gp%'" ) as $gp_table ) { 59 $wpdb->query( "DROP TABLE {$gp_table}" ); // WPCS: unprepared SQL ok. 60 } 61 62 /** 63 * Installs GlotPress. 64 */ 65 function _install_glotpress() { 66 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 67 require_once dirname( dirname( dirname( __DIR__ ) ) ) . '/gp-includes/schema.php'; 68 require_once dirname( dirname( dirname( __DIR__ ) ) ) . '/gp-includes/install-upgrade.php'; 69 gp_upgrade_db(); 70 } 71 _install_glotpress();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Dec 22 01:01:04 2024 | Cross-referenced by PHPXref 0.7.1 |