summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Berry2009-08-17 16:59:00 (GMT)
committer Jim Berry2009-08-17 16:59:00 (GMT)
commitc2c37d94ba0d4194a25d005b0462dc63ce5492cc (patch)
treeb8c1c79fb3f431479df1900462aefe8af778ae81
parentfa08093d3d883e30e303e8b888e40967eadebc6d (diff)
Implement initial batch of conversion routines using the PGP API.
-rw-r--r--coder_upgrade/CHANGELOG.txt1
-rw-r--r--coder_upgrade/coder_upgrade.info2
-rw-r--r--coder_upgrade/conversions/coder_upgrade.end.inc2
-rw-r--r--coder_upgrade/conversions/coder_upgrade.list.inc7
-rw-r--r--coder_upgrade/conversions/coder_upgrade.other.inc53
5 files changed, 63 insertions, 2 deletions
diff --git a/coder_upgrade/CHANGELOG.txt b/coder_upgrade/CHANGELOG.txt
index ede7b12..74c7457 100644
--- a/coder_upgrade/CHANGELOG.txt
+++ b/coder_upgrade/CHANGELOG.txt
@@ -7,6 +7,7 @@ coder_upgrade 7.x-1.x, 2009-xx-xx (development version)
* Separate middle conversion routines into two groups (regex and parser) to utilize the PGP API.
* Add handler specification (regex or parser) for the middle changes applied at the file level.
* Revise API documentation.
+ * Implement initial batch of conversion routines using the PGP API.
- Changes (2009-08-04):
* Rename hook_perm and the permission.
diff --git a/coder_upgrade/coder_upgrade.info b/coder_upgrade/coder_upgrade.info
index 0366bf1..66f9b82 100644
--- a/coder_upgrade/coder_upgrade.info
+++ b/coder_upgrade/coder_upgrade.info
@@ -17,6 +17,6 @@ files[] = conversions/coder_upgrade.end.inc
; files[] = conversions/coder_upgrade.install.inc
files[] = conversions/coder_upgrade.list.inc
files[] = conversions/coder_upgrade.main.inc
-; files[] = conversions/coder_upgrade.other.inc
+files[] = conversions/coder_upgrade.other.inc
core = 7.x
diff --git a/coder_upgrade/conversions/coder_upgrade.end.inc b/coder_upgrade/conversions/coder_upgrade.end.inc
index cd0e05e..1e833ca 100644
--- a/coder_upgrade/conversions/coder_upgrade.end.inc
+++ b/coder_upgrade/conversions/coder_upgrade.end.inc
@@ -111,7 +111,7 @@ function coder_upgrade_add_file_entries($dirname = '', $files = array(), &$items
// Create list of files for registry.
// TODO Allow for custom extensions!!!
- $extensions = array('inc', 'install', 'module', 'php');
+ $extensions = array('inc', 'install', 'module', 'php', 'test');
$path = $path != '' ? $path . '/' : $path;
foreach ($files as $file) {
if (is_array($file)) {
diff --git a/coder_upgrade/conversions/coder_upgrade.list.inc b/coder_upgrade/conversions/coder_upgrade.list.inc
index 4bc56f5..e83139b 100644
--- a/coder_upgrade/conversions/coder_upgrade.list.inc
+++ b/coder_upgrade/conversions/coder_upgrade.list.inc
@@ -50,6 +50,13 @@ function coder_upgrade_conversions_list() {
'end' => array(),
);
+ $list['middle'] = array(
+ array(
+ 'name' => 'simple_changes',
+ 'type' => 'parser',
+ ),
+ );
+
$list['end'] = array('end');
return $list;
diff --git a/coder_upgrade/conversions/coder_upgrade.other.inc b/coder_upgrade/conversions/coder_upgrade.other.inc
new file mode 100644
index 0000000..fd4413e
--- /dev/null
+++ b/coder_upgrade/conversions/coder_upgrade.other.inc
@@ -0,0 +1,53 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Other conversion routine file for the coder_upgrade module.
+ *
+ * The functions in these conversion routine files correspond to the topics in
+ * the category roadmap at http://drupal.org/node/394070 that are marked with
+ * a "Yes" in the Upgrade column.
+ *
+ * Copyright 2008-9 by Jim Berry ("solotandem", http://drupal.org/user/240748)
+ */
+
+/**
+ * Miscellaneous routine for simple changes.
+ *
+ * http://drupal.org/node/224333#registry
+ * http://drupal.org/node/224333#drupal_set_session (REVERTED)
+ * http://drupal.org/node/224333#time
+ * http://drupal.org/node/224333#rebuild_functions
+ *
+ * @param PGPReader $reader
+ * The object containing the grammar statements of the file to convert.
+ */
+function coder_upgrade_convert_simple_changes(&$reader) {
+ $editor = new PGPEditor();
+ $types = array(T_STRING);
+ $editor->traverse_callback($reader->getFunctionCalls(), 'coder_upgrade_callback_simple_changes', $types);
+}
+
+function coder_upgrade_callback_simple_changes(&$item) {
+ $name = &$item['name'];
+ $value = &$name['value'];
+ switch ($name['value']) {
+ case 'drupal_rebuild_code_registry':
+ $name['value'] = 'registry_rebuild';
+ break;
+
+ case 'drupal_rebuild_theme_registry':
+ $name['value'] = 'drupal_theme_rebuild';
+ break;
+
+ case 'function_exists':
+ $name['value'] = 'drupal_function_exists';
+ break;
+
+ case 'time':
+ $temp = $editor->expressionToStatement('REQUEST_TIME');
+ $item = $temp['operand_1'];
+ break;
+ }
+}