This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'option_active_plugins', 'activate_local_plugins' ); | |
/** | |
* Add our local plugins to the list of active plugins. | |
*/ | |
function activate_local_plugins( $plugins ) { | |
if ( '127.0.0.1' == $_SERVER['SERVER_ADDR'] ) { | |
$local_plugins = array( | |
'wordpress-beta-tester/wp-beta-tester.php', | |
'wordpress-importer/wordpress-importer.php', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Load different configuration files for different stages. | |
*/ | |
if ( file_exists( $local_config = dirname( __FILE__ ) . '/local-config.php' ) ) { | |
require $local_config; // Configurations for your local stage only. | |
define( 'WP_STAGE', 'local' ); | |
} elseif ( file_exists( $staging_config = dirname( __FILE__ ) . '/staging-config.php' ) ) { | |
require $staging_config; // Configurations for your testing stage only. | |
define( 'WP_STAGE', 'staging' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'option_active_plugins', 'activate_local_plugins' ); | |
/** | |
* Add our local plugins to the list of active plugins. | |
*/ | |
function activate_local_plugins( $plugins ) { | |
if ( defined( 'WP_STAGE' ) && 'local' == WP_STAGE ) { | |
$local_plugins = array( | |
'wordpress-beta-tester/wp-beta-tester.php', | |
'wordpress-importer/wordpress-importer.php', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Remove users and meta data. | |
function fix_wpsc_clear_customer_meta() { | |
global $wpdb; | |
require_once( ABSPATH . 'wp-admin/includes/user.php' ); | |
$purge_count = 200; | |
$sql = " | |
SELECT user_id | |
FROM {$wpdb->usermeta} | |
WHERE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { | |
add_action( 'wp_ajax_wpsc_migrate_anonymous_user', '_wpsc_meta_migrate_anonymous_user_worker' ); | |
add_action( 'wp_ajax_nopriv_wpsc_migrate_anonymous_user', '_wpsc_meta_migrate_anonymous_user_worker' ); | |
function _wpsc_meta_migrate_anonymous_user_worker() { | |
global $wpdb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove query arguments from any enqueued scripts. | |
*/ | |
function remove_query_args( $src ) { | |
if ( strpos( $src, 'ver=' ) ) { | |
$src = remove_query_arg( 'ver', $src ); | |
} | |
return $src; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> SELECT @min_price:=MIN(price),@max_price:=MAX(price) FROM shop; | |
mysql> SELECT * FROM shop WHERE price=@min_price OR price=@max_price; | |
+---------+--------+-------+ | |
| article | dealer | price | | |
+---------+--------+-------+ | |
| 0003 | D | 1.25 | | |
| 0004 | D | 19.95 | | |
+---------+--------+-------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT @old_domain := 'http://www.old-domain.com' , @new_domain := 'http://www.new-domain.com'; | |
UPDATE wp_options SET option_value = replace(option_value, @old_domain, @new_domain) WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, @old_domain, @new_domain); | |
UPDATE wp_posts SET post_content = replace(post_content, @old_domain, @new_domain); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Customize according to your needed configuration | |
set :application, "Application Name" | |
set :repository, "git@github.com:user/repo.git" | |
set :db_repository, 'git@github.com:user/repo-db.git' | |
set :scm, :git | |
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` | |
# This assumes you're using Git. Needed to run tasks in db-tasks.rb | |
set :git_user_name, "user" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package myapp.mypackage | |
/** | |
* Just an example of a domain class. | |
* @author andrezrv | |
*/ | |
class MyObject { | |
String name |