summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Green2007-07-07 13:45:32 (GMT)
committer Doug Green2007-07-07 13:45:32 (GMT)
commitc21bcdb9f1bca4089aa3ac30600fc38927816557 (patch)
treeaf39d4c3608cabc1dd803424f26400a52b8c85ba
parent99f2e9b6b4789547ea94e7a2b5992a964e00e1e7 (diff)
more 6x upgrade rules
-rw-r--r--includes/coder_6x.inc67
-rw-r--r--tests/coder_6x.inc20
2 files changed, 83 insertions, 4 deletions
diff --git a/includes/coder_6x.inc b/includes/coder_6x.inc
index 792bdd7..09dfd7b 100644
--- a/includes/coder_6x.inc
+++ b/includes/coder_6x.inc
@@ -137,6 +137,31 @@ function coder_6x_reviews() {
'#value' => '[\s\(]form_set_value\s*\([^,]+(,\s*[^,\)]+){0,1}\)',
'#warning_callback' => '_coder_6x_form_set_value_warning',
),
+ array(
+ '#type' => 'regex',
+ '#value' => '[\s\(]confirm_form\s*\([^,]+(,\s*[^,]+){4,}',
+ '#warning_callback' => '_coder_6x_confirm_form_warning',
+ ),
+ array(
+ '#type' => 'regex',
+ '#value' => '[\s\(]custom_url_rewrite\s*\(',
+ '#warning_callback' => '_coder_6x_custom_url_rewrite_warning',
+ ),
+ array(
+ '#type' => 'regex',
+ '#value' => '_(info)\s*\(\s*\$field',
+ '#warning_callback' => '_coder_6x_hook_info_auth_warning',
+ ),
+ array(
+ '#type' => 'regex',
+ '#value' => '_(auth)\s*\(\s*\$user',
+ '#warning_callback' => '_coder_6x_hook_info_auth_warning',
+ ),
+ array(
+ '#type' => 'regex',
+ '#value' => '_(help)\s*\(\s*[^,]+\)',
+ '#warning_callback' => '_coder_6x_hook_help_warning',
+ ),
);
$review = array(
'#title' => t('Converting 5.x modules to 6.x'),
@@ -316,6 +341,15 @@ function _coder_6x_file_check_upload_warning() {
);
}
+function _coder_6x_form_validate_and_submit_warning() {
+ return t('The number of parameters for form !hook_validate and !hook_submit have changed',
+ array(
+ '!hook_validate' => theme('drupalapi', 'hook_validate'),
+ '!hook_submit' => theme('drupalapi', 'hook_submit'),
+ )
+ );
+}
+
function _coder_6x_form_set_value_warning() {
return t('!form_set_value() parameters have changed',
array(
@@ -324,11 +358,36 @@ function _coder_6x_form_set_value_warning() {
);
}
-function _coder_6x_form_validate_and_submit_warning() {
- return t('The number of parameters for form !hook_validate and !hook_submit have changed',
+function _coder_6x_confirm_form_warning() {
+ return t('The arguments to !confirm_form() have changed',
array(
- '!hook_validate' => theme('drupalapi', 'hook_validate'),
- '!hook_submit' => theme('drupalapi', 'hook_submit'),
+ '!confirm_form' => theme('drupalapi', 'confirm_form'),
+ )
+ );
+}
+
+function _coder_6x_custom_url_rewrite_warning() {
+ return t('In place of !custom_url_rewrite, use !custom_url_rewrite_inbound() or !custom_url_rewrite_outbound()',
+ array(
+ '!custom_url_rewrite' => theme('drupalapi', 'custom_url_rewrite'),
+ '!custom_url_rewrite_inbound' => theme('drupalapi', 'custom_url_rewrite_inbound'),
+ '!custom_url_rewrite_outbound' => theme('drupalapi', 'custom_url_rewrite_outbound'),
+ )
+ );
+}
+
+function _coder_6x_hook_info_auth_warning() {
+ return t('hook no longer exists, use !hook_form_alter() to swap your own validation handler',
+ array(
+ '!hook_form_alter' => theme('drupalapi', 'hook_form_alter'),
+ )
+ );
+}
+
+function _coder_6x_hook_help_warning() {
+ return t('The arguments to !hook_help have changed',
+ array(
+ '!hook_help' => theme('drupalapi', 'hook_help'),
)
);
}
diff --git a/tests/coder_6x.inc b/tests/coder_6x.inc
index 5270fd3..3c78749 100644
--- a/tests/coder_6x.inc
+++ b/tests/coder_6x.inc
@@ -45,6 +45,14 @@ function _coder_6x_more_tests() {
form_set_value($element, 'value', $form_status); // This one is okay
form_set_value($element, 'value'); // error
+
+ confirm_form($form, t('Do you really want to delete this?'), "node/$nid", t("Don't do it unless you're really sure!"), t('Delete it'), t('Go back'), 'delete'); // should fail
+
+ confirm_form($form, t('Do you really want to delete this?'), "node/$nid", $options); // is ok
+ confirm_form($form, t('Do you really want to delete this?'), "node/$nid", array()); // also ok
+
+ custom_url_rewrite($url); // not ok
+ custom_url_rewrite_inbound($url); // ok
}
function _coder_6x_test_link_alter($node, &$links) { // an error
@@ -70,3 +78,15 @@ function myform_submit($form_id, $form) { //this willfail
$form['#submit']['newsubmit'] = array();
$form['#submit'][] = "newsubmit";
}
+
+function mymodule_info($field = 0) {
+}
+
+function mymodule_auth($username, $password, $server) {
+}
+
+function mymodule_help($section) {
+}
+
+function mymodule_help($section, $arg) { // ok
+}