Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adjustments so tools works with traditionally organized projects

  • Loading branch information...
commit e9cb0da5915839ade55ae55301fbb8e246408f0b 1 parent 3394875
@ryanmark ryanmark authored
Showing with 40 additions and 7 deletions.
  1. +6 −2 cli-load.php
  2. +15 −1 fablib.py
  3. +19 −4 wp-scripts/setup_wp-config.php
View
8 cli-load.php
@@ -26,8 +26,12 @@
if ( empty( $_SERVER["REQUEST_URI"] ) )
$_SERVER["REQUEST_URI"] = "/cli";
-# Set the ABSPATH so WordPress can find its files
-define( 'ABSPATH', PROJECT_PATH . '/wordpress/' );
+# Set the ABSPATH so WordPress can find its files. Check if we're a
+# traditionally organized project, or a fancy project.
+if ( is_dir( PROJECT_PATH . '/wordpress' ) )
+ define( 'ABSPATH', PROJECT_PATH . '/wordpress/' );
+else
+ define( 'ABSPATH', PROJECT_PATH . '/' );
if ( ! defined('WP_SITEURL') )
define( 'WP_SITEURL', "http://".$settings['install']['hostname'] );
View
16 fablib.py
@@ -192,7 +192,21 @@ def dump_db(dump_slug='dump'):
if not env.db_root_pass:
env.db_root_pass = getpass("Database password: ")
with cd(env.path):
- env.run("mysqldump --host=%(db_host)s --user=%(db_root_user)s --password=%(db_root_pass)s --max_allowed_packet=2M --extended-insert=FALSE --lock-all-tables %(project_name)s |sed s/%(wpdomain)s/WPDEPLOYDOMAN/g |bzip2 > data/%(dump_slug)s.sql.bz2" % env)
+ env.run("mysqldump --host=%(db_host)s --user=%(db_root_user)s --password=%(db_root_pass)s --max_allowed_packet=2M --extended-insert=FALSE %(project_name)s |sed s/%(wpdomain)s/WPDEPLOYDOMAN/g |bzip2 > data/%(dump_slug)s.sql.bz2" % env)
+
+
+def put_dump(dump_slug='dump'):
+ check_env()
+ env.dump_slug = dump_slug
+ put('data/%(dump_slug)s.sql.bz2' % env,'%(path)s/data/%(dump_slug)s.sql.bz2' % env)
+ print('Put %(dump_slug)s.sql.bz2 on server.\n' % env)
+
+
+def get_dump(dump_slug='dump'):
+ check_env()
+ env.dump_slug = dump_slug
+ get('%(path)s/data/%(dump_slug)s.sql.bz2' % env, 'data/%(dump_slug)s.sql.bz2' % env)
+ print('Got %(dump_slug)s.sql.bz2 from the server.\n' % env)
def destroy_db():
View
23 wp-scripts/setup_wp-config.php
@@ -8,6 +8,11 @@
* the .htaccess and complete network installation config file.
*****/
+if ( file_exists( 'wp-config.php' ) ) {
+ rename( 'wp-config.php', 'wp-config.old.php' );
+ print( "Moved old wp-config.php out of the way\n" );
+}
+
require_once( 'tools/cli-load.php' );
$options = getopt("", array("finish"));
@@ -72,8 +77,9 @@
\n";
}
-$newConfig .= "
-define( 'DISABLE_WP_CRON', true);
+# Check if this is a traditionally orgainzed project, or if it's fancy
+if ( is_dir( PROJECT_PATH . '/wordpress' ) )
+ $newConfig .= "
define( 'WP_CONTENT_DIR', dirname(__FILE__) );
define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/plugins' );
define( 'WPMU_PLUGIN_DIR', dirname(__FILE__) . '/mu-plugins' );
@@ -81,7 +87,16 @@
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
- define('ABSPATH', dirname(__FILE__) . '/wordpress/');
+ define('ABSPATH', dirname(__FILE__) . '/wordpress/');\n";
+else
+ $newConfig .= "
+/** Absolute path to the WordPress directory. */
+if ( !defined('ABSPATH') )
+ define('ABSPATH', dirname(__FILE__) );\n";
+
+
+$newConfig .= "
+define( 'DISABLE_WP_CRON', true);
/** Extra configuration settings that won't change **/
if ( file_exists( 'wp-config.global.php' ) )
@@ -93,6 +108,6 @@
fwrite(fopen("wp-config.php", 'w'), $newConfig);
if ( array_key_exists('finish', $options) )
- print("Wrote finalized wp-config.php and .htaccess\n");
+ print("Wrote finalized wp-config.php and (maybe) .htaccess\n");
else
print("Wrote starter wp-config.php\n");
Please sign in to comment.
Something went wrong with that request. Please try again.