From fd479d603856f895af43f85885a99db17c285d5f Mon Sep 17 00:00:00 2001 From: James Michael DuPont Date: Wed, 26 Sep 2012 14:26:46 +0200 Subject: [PATCH 1/6] hiphop --- Makefile | 18 ++++++++++++++++++ drush.php | 1 - drushcompile.php | 18 ++++++++++++++++++ includes/bootstrap.inc | 8 +------- includes/environment.inc | 1 - tests/compiler/constants.php | 13 +++++++++++++ tests/compiler/dollarnames.cpp | 4 ++++ tests/compiler/dt.php | 23 +++++++++++++++++++++++ 8 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 Makefile create mode 100644 drushcompile.php create mode 100644 tests/compiler/constants.php create mode 100644 tests/compiler/dollarnames.cpp create mode 100644 tests/compiler/dt.php diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..ccd42476ed --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +all : bootstrap + +drushcompile: + hphp -o hphpout -k 1 -t cpp drushcompile.php + +cdrush : + hphp -o hphpout -k 1 -t cpp drush.php + +bootstrap: + hphp -o hphpout -k 1 -t cpp includes/bootstrap.inc + + +constants : + hphp -o hphpout -k 1 -t cpp tests/compiler/constants.php +# phc -c tests/compiler/constants.php + +dt : + hphp -o hphpout -k 1 -t cpp tests/compiler/dt.php diff --git a/drush.php b/drush.php index 1386c9979f..2b975ba013 100755 --- a/drush.php +++ b/drush.php @@ -8,7 +8,6 @@ * @requires PHP CLI 5.3.2, or newer. */ -require(dirname(__FILE__) . '/includes/bootstrap.inc'); drush_bootstrap_prepare(); exit(drush_main()); diff --git a/drushcompile.php b/drushcompile.php new file mode 100644 index 0000000000..f07e205722 --- /dev/null +++ b/drushcompile.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 795c468dc9..fe6c0c932d 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -378,12 +378,6 @@ function drush_bootstrap_max_to_sitealias($site_record, $max_phase_index = NULL) * Helper function to collect any errors that occur during the bootstrap process. * Always returns FALSE, for convenience. */ -function drush_bootstrap_error($code, $message = null) { - $errors = drush_get_context('DRUSH_BOOTSTRAP_ERRORS'); - $errors[$code] = $message; - drush_set_context('DRUSH_BOOTSTRAP_ERRORS', $errors); - return FALSE; -} /** * Validate that Drush is running in a suitable environment. @@ -651,7 +645,7 @@ function _drush_bootstrap_drupal_root_validate() { return drush_bootstrap_error('DRUSH_NO_DRUPAL_ROOT', dt("A Drupal installation directory could not be found")); } if (!$signature = drush_valid_drupal_root($drupal_root)) { - return drush_bootstrap_error('DRUSH_INVALID_DRUPAL_ROOT', dt("The directory !drupal_root does not contain a valid Drupal installation", array('!drupal_root' => $drupal_root))); + } drush_bootstrap_value('drupal_root', $drupal_root); diff --git a/includes/environment.inc b/includes/environment.inc index 4f2ae738ba..0bb738ad4a 100644 --- a/includes/environment.inc +++ b/includes/environment.inc @@ -456,7 +456,6 @@ function drush_valid_db_credentials() { drush_log(dt("Unknown error connecting to pgsql database via !constr", array('!constr' => $conn_string)), 'bootstrap'); } else { - require_once './includes/unicode.inc'; drush_log(decode_entities($php_errormsg), 'bootstrap'); } return FALSE; diff --git a/tests/compiler/constants.php b/tests/compiler/constants.php new file mode 100644 index 0000000000..6824b080e3 --- /dev/null +++ b/tests/compiler/constants.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/tests/compiler/dollarnames.cpp b/tests/compiler/dollarnames.cpp new file mode 100644 index 0000000000..d758b3e114 --- /dev/null +++ b/tests/compiler/dollarnames.cpp @@ -0,0 +1,4 @@ +int pm_php$includes$bootstrap_inc(bool incOnce, int* variables, int *globals) +{ + +} diff --git a/tests/compiler/dt.php b/tests/compiler/dt.php new file mode 100644 index 0000000000..5240a28168 --- /dev/null +++ b/tests/compiler/dt.php @@ -0,0 +1,23 @@ + $drupal_root))); + +print dt("The directory !drupal_root does not contain a valid Drupal installation"); +print dt("The directory !drupal_root does not contain a valid Drupal installation", array('!drupal_root' => $drupal_root)); +?> \ No newline at end of file From a59c6d355bd74e54aaa6cfc3dad2ba03168fee2a Mon Sep 17 00:00:00 2001 From: James Michael DuPont Date: Wed, 26 Sep 2012 14:36:05 +0200 Subject: [PATCH 2/6] undeclared variables fix --- Makefile | 2 +- includes/cache.inc | 2 +- includes/filesystem.inc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ccd42476ed..982799616d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all : bootstrap +all : drushcompile drushcompile: hphp -o hphpout -k 1 -t cpp drushcompile.php diff --git a/includes/cache.inc b/includes/cache.inc index edf162e90f..bf62dbaba3 100644 --- a/includes/cache.inc +++ b/includes/cache.inc @@ -400,7 +400,7 @@ class DrushFileCache implements DrushCacheInterface { } } - function isEmpty() { + function isEmpty($dir) { $files = drush_scan_directory($dir, "//", array('.', '..')); return empty($files); } diff --git a/includes/filesystem.inc b/includes/filesystem.inc index 275cb02b6f..67cfe5a7f1 100644 --- a/includes/filesystem.inc +++ b/includes/filesystem.inc @@ -499,7 +499,7 @@ function _drush_delete_registered_files() { drush_delete_dir($file, TRUE); } else { - @chmod($dir, 0777); // Make file writeable + @chmod($file, 0777); // Make file writeable unlink($file); } } From fc9f003e36063d332c60122f2dc600258a8fddfd Mon Sep 17 00:00:00 2001 From: James Michael DuPont Date: Wed, 26 Sep 2012 14:54:55 +0200 Subject: [PATCH 3/6] uupps reverting removal --- includes/bootstrap.inc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index fe6c0c932d..06181f25d6 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -379,6 +379,13 @@ function drush_bootstrap_max_to_sitealias($site_record, $max_phase_index = NULL) * Always returns FALSE, for convenience. */ +function drush_bootstrap_error($code, $message = null) { + $errors = drush_get_context('DRUSH_BOOTSTRAP_ERRORS'); + $errors[$code] = $message; + drush_set_context('DRUSH_BOOTSTRAP_ERRORS', $errors); + return FALSE; +} + /** * Validate that Drush is running in a suitable environment. */ @@ -645,6 +652,7 @@ function _drush_bootstrap_drupal_root_validate() { return drush_bootstrap_error('DRUSH_NO_DRUPAL_ROOT', dt("A Drupal installation directory could not be found")); } if (!$signature = drush_valid_drupal_root($drupal_root)) { + return drush_bootstrap_error('DRUSH_INVALID_DRUPAL_ROOT', dt("The directory !drupal_root does not contain a valid Drupal installation", array('!drupal_root' => $drupal_root))); } From bae1653df1a280243baeaebc7f012fefa0a25ad9 Mon Sep 17 00:00:00 2001 From: James Michael DuPont Date: Wed, 26 Sep 2012 14:59:14 +0200 Subject: [PATCH 4/6] uupps reverting removal --- drush.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drush.php b/drush.php index 2b975ba013..eb1abf25dc 100755 --- a/drush.php +++ b/drush.php @@ -8,7 +8,7 @@ * @requires PHP CLI 5.3.2, or newer. */ - +require(dirname(__FILE__) . '/includes/bootstrap.inc'); drush_bootstrap_prepare(); exit(drush_main()); From c56fa731e630de38207c9e61eff5abc2c4e2637d Mon Sep 17 00:00:00 2001 From: James Michael DuPont Date: Wed, 26 Sep 2012 15:00:38 +0200 Subject: [PATCH 5/6] more unicodes --- commands/core/drupal/update.inc | 2 +- commands/core/drupal/update_7.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/core/drupal/update.inc b/commands/core/drupal/update.inc index 2a7f9e5fa6..f8588c541a 100644 --- a/commands/core/drupal/update.inc +++ b/commands/core/drupal/update.inc @@ -147,7 +147,7 @@ function update_main_prepare() { require_once $core . '/includes/bootstrap.inc'; require_once $core . '/includes/common.inc'; require_once $core . '/includes/file.inc'; - include_once $core . '/includes/unicode.inc'; + update_prepare_d8_bootstrap(); drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION); diff --git a/commands/core/drupal/update_7.inc b/commands/core/drupal/update_7.inc index 2bd256a6ed..8797076cea 100644 --- a/commands/core/drupal/update_7.inc +++ b/commands/core/drupal/update_7.inc @@ -148,7 +148,7 @@ function update_main_prepare() { require_once $core . '/includes/common.inc'; require_once $core . '/includes/file.inc'; require_once $core . '/includes/entity.inc'; - include_once $core . '/includes/unicode.inc'; + update_prepare_d7_bootstrap(); drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION); From 8050cd8d57ae818b3d861941b7c7ba3fe8ab1e1b Mon Sep 17 00:00:00 2001 From: James Michael DuPont Date: Wed, 26 Sep 2012 16:51:20 +0200 Subject: [PATCH 6/6] work in progress --- drushcompile.php | 19 +++++++++++++++++++ includes/output.inc | 2 ++ 2 files changed, 21 insertions(+) diff --git a/drushcompile.php b/drushcompile.php index f07e205722..a3fb6594f3 100644 --- a/drushcompile.php +++ b/drushcompile.php @@ -1,4 +1,23 @@ getTable() to get the output from the return value. */ + function drush_print_table($rows, $header = FALSE, $widths = array(), $handle = NULL) { $tbl = new Console_Table(CONSOLE_TABLE_ALIGN_LEFT , '');