From f79dff88619f7a7122c17fdb4488962e220c0ee9 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 17 Jan 2022 18:42:46 +1300 Subject: [PATCH] Remove some old scripts --- tools/bin/scripts/NormalizePhone.php | 136 ------------------ tools/bin/scripts/soapClient.php.txt | 16 --- tools/bin/scripts/testProcess.php | 43 ------ tools/bin/scripts/test_sandbox.sh | 208 --------------------------- 4 files changed, 403 deletions(-) delete mode 100644 tools/bin/scripts/NormalizePhone.php delete mode 100644 tools/bin/scripts/soapClient.php.txt delete mode 100644 tools/bin/scripts/testProcess.php delete mode 100755 tools/bin/scripts/test_sandbox.sh diff --git a/tools/bin/scripts/NormalizePhone.php b/tools/bin/scripts/NormalizePhone.php deleted file mode 100644 index 18e4e9d872..0000000000 --- a/tools/bin/scripts/NormalizePhone.php +++ /dev/null @@ -1,136 +0,0 @@ - 0))) { - header("HTTP/1.0 404 Not Found"); - return; -} -define('THROTTLE_REQUESTS', 0); -function run() { - session_start(); - - require_once '../civicrm.config.php'; - require_once 'CRM/Core/Config.php'; - - $config = CRM_Core_Config::singleton(); - - require_once 'Console/Getopt.php'; - $shortOptions = "n:p:k:pre"; - $longOptions = ['name=', 'pass=', 'key=', 'prefix=']; - - $getopt = new Console_Getopt(); - $args = $getopt->readPHPArgv(); - - array_shift($args); - list($valid, $dontCare) = $getopt->getopt2($args, $shortOptions, $longOptions); - - $vars = [ - 'name' => 'n', - 'pass' => 'p', - 'key' => 'k', - 'prefix' => 'pre', - ]; - - foreach ($vars as $var => $short) { - $$var = NULL; - foreach ($valid as $v) { - if ($v[0] == $short || $v[0] == "--$var") { - $$var = $v[1]; - break; - } - } - if (!$$var) { - $$var = $_REQUEST[$var] ?? NULL; - } - $_REQUEST[$var] = $$var; - } - - // this does not return on failure - // require_once 'CRM/Utils/System.php'; - CRM_Utils_System::authenticateScript(TRUE, $name, $pass); - - //log the execution of script - CRM_Core_Error::debug_log_message('NormalizePhone.php'); - - // process all phones - processPhones($config, $prefix); -} - -/** - * @param $config - * @param null $prefix - */ -function processPhones(&$config, $prefix = NULL) { - // ignore null phones and phones that already match what we are doing - $query = " -SELECT id, phone -FROM civicrm_phone -WHERE phone IS NOT NULL -AND phone NOT REGEXP '^[[:digit:]]{3}-[[:digit:]]{3}-[[:digit:]]{4}$' -"; - - $dao = &CRM_Core_DAO::executeQuery($query); - - $updateQuery = "UPDATE civicrm_phone SET phone = %1 where id = %2"; - $params = [ - 1 => ['', 'String'], - 2 => [0, 'Integer'], - ]; - $totalPhone = $validPhone = $nonPrefixedPhone = 0; - while ($dao->fetch()) { - $newPhone = processPhone($dao->phone, $prefix); - echo "$newPhone, {$dao->phone}\n"; - if ($newPhone !== FALSE) { - $params[1][0] = $newPhone; - $params[2][0] = $dao->id; - CRM_Core_DAO::executeQuery($updateQuery, $params); - echo "{$dao->phone}, $newPhone\n"; - } - $totalPhone++; - } -} - -/** - * @param $phone - * @param null $prefix - * - * @return bool|string - */ -function processPhone($phone, $prefix = NULL) { - // eliminate all white space and non numeric charaters - $cleanPhone = preg_replace('/[^\d]+/s', '', $phone); - - $len = strlen($cleanPhone); - if ($prefix && - $len == 7 - ) { - $cleanPhone = $prefix . $cleanPhone; - } - elseif ($len != 10) { - return FALSE; - } - - // now we have a 10 character string, lets return it as - // ABC-DEF-GHIJ - $cleanPhone = substr($cleanPhone, 0, 3) . "-" . substr($cleanPhone, 3, 3) . "-" . substr($cleanPhone, 6, 4); - - return ($cleanPhone == $phone) ? FALSE : $cleanPhone; -} - -run(); - diff --git a/tools/bin/scripts/soapClient.php.txt b/tools/bin/scripts/soapClient.php.txt deleted file mode 100644 index 34a8fb76c0..0000000000 --- a/tools/bin/scripts/soapClient.php.txt +++ /dev/null @@ -1,16 +0,0 @@ - 'http://civicrm1.electricembers.net/~lobo/drupal/modules/civicrm/extern/soap.php', - 'uri' => 'urn:civicrm', 'trace' => 1 ) - ); - -$key = $client->authenticate( USER_NAME, USER_PASSWORD ); -$params = array('contact_id' => 101, - 'return.display_name' => 1 ); - -$result =& $client->get_contact( $key, $params ); - -print_r($result); - - diff --git a/tools/bin/scripts/testProcess.php b/tools/bin/scripts/testProcess.php deleted file mode 100644 index a9238fc9a8..0000000000 --- a/tools/bin/scripts/testProcess.php +++ /dev/null @@ -1,43 +0,0 @@ - 0))) { - header("HTTP/1.0 404 Not Found"); - return; -} -require_once '../civicrm.config.php'; -require_once 'CRM/Core/Config.php'; -require_once 'CRM/Core/Error.php'; -$config = CRM_Core_Config::singleton(); - -require_once 'CRM/Case/XMLProcessor/Report.php'; -$xmlProcessor = new CRM_Case_XMLProcessor_Report(); -$report = $xmlProcessor->getActivityInfo(102, 552); -CRM_Core_Error::debug($report); -exit(); - -$xmlProcessor->run(104, 1, 'Substance Abuse', '15 Day Review'); -$params = [ - 'clientID' => 104, - 'creatorID' => 108, - 'standardTimeline' => 1, - // activityTypeName means name here not label, and that is correct here (dev/core#1116-ok-name) - 'activityTypeName' => 'Open Case', - 'dueDateTime' => time(), - 'caseID' => 1, -]; -require_once 'CRM/Case/XMLProcessor/Process.php'; -$xmlProcessor = new CRM_Case_XMLProcessor_Process(); - -$result = $xmlProcessor->get('Substance Abuse', 'CaseRoles'); -CRM_Core_Error::debug('Case Roles', $result); -$result = $xmlProcessor->get('Substance Abuse', 'ActivityTypes'); -CRM_Core_Error::debug('Activity Types', $result); -$result = $xmlProcessor->get('Substance Abuse', 'ActivitySets'); -CRM_Core_Error::debug('Activity Sets', $result); - -$xmlProcessor->run('Substance Abuse', - $params -); - - -exit(); - diff --git a/tools/bin/scripts/test_sandbox.sh b/tools/bin/scripts/test_sandbox.sh deleted file mode 100755 index 4a91b2fc23..0000000000 --- a/tools/bin/scripts/test_sandbox.sh +++ /dev/null @@ -1,208 +0,0 @@ -#!/usr/bin/env bash -v - -./setup.sh - -cd ../test/maxq - -# This script is used to run maxq generated test scripts. -# Before running these scripts please see Common.py -# In Common.py comment and uncomment the constants as per the need -# Below commands use someof the modes of maxq. The modes used are : -# The -r mode is for running maxq generated test scripts. -# The -q mode is for quite mode while testing. -# Instead of -q (quite mode), -d(debug mode) can be used. -# For all other options, fire $ maxq --help - - -############################ -# Test for Adding Contacts # -############################ - -maxq -q -r testAddContactIndividual.py -maxq -q -r testAddContactHousehold.py -maxq -q -r testAddContactOrganization.py - -############################# -# Test for Editing Contacts # -############################# - -maxq -q -r testEditContactIndividual.py -maxq -q -r testEditContactHousehold.py -maxq -q -r testEditContactOrganization.py - -############################# -# Test for Viewing Contacts # -############################# - -maxq -q -r testViewContactIndividual.py -maxq -q -r testViewContactHousehold.py -maxq -q -r testViewContactOrganization.py - -############################################# -# Test for Relationship By Relationship Tab # -############################################# - -maxq -q -r testAddRelByRelTab.py -maxq -q -r testEditRelByRelTab.py -maxq -q -r testViewRelByRelTab.py -maxq -q -r testDisableEnableRelByRelTab.py -maxq -q -r testDeleteRelByRelTab.py - -######################################## -# Test for Relationship By Contact Tab # -######################################### - -maxq -q -r testAddRelByContactTab.py -maxq -q -r testEditRelByContactTab.py - -############################### -# Test for Group By Group Tab # -############################### - -maxq -q -r testGroupAllByGroupTab.py -maxq -q -r testGroupAllByContactTab.py - -############################# -# Test for Tags By Tags Tab # -############################# - -maxq -q -r testTagsAllByTagsTab.py - -############################## -# Test for Notes By Note Tab # -############################## - -maxq -q -r testAddNoteByNoteTab.py -maxq -q -r testEditNoteByNoteTab.py -maxq -q -r testViewNoteByNoteTab.py -maxq -q -r testDeleteNoteByNoteTab.py - -################################# -# Test for Notes By Contact Tab # -################################# - -maxq -q -r testAddNoteByContactTab.py -maxq -q -r testEditNoteByContactTab.py -maxq -q -r testDeleteNoteByNoteTab.py - -####################### -# Test for Admin Tags # -####################### - -maxq -q -r testAdminAddTags.py -maxq -q -r testAdminEditTags.py -maxq -q -r testAdminDeleteTag.py - -################################ -# Test for Admin Location Type # -################################ - -maxq -q -r testAdminAddLocationType.py -maxq -q -r testAdminEditLocationType.py -maxq -q -r testAdminEnableDisableLocationType.py -maxq -q -r testAdminDeleteLocationType.py - -################################## -# Test for Admin Mobile Provider # -################################## - -maxq -q -r testAdminAddMobileProvider.py -maxq -q -r testAdminEditMobileProvider.py -maxq -q -r testAdminEnableDisableMobileProvider.py -maxq -q -r testAdminDeleteMobileProvider.py - -############################## -# Test for Admin IM Provider # -############################## - -maxq -q -r testAdminAddIMProvider.py -maxq -q -r testAdminEditIMProvider.py -maxq -q -r testAdminEnableDisableIMProvider.py -maxq -q -r testAdminDeleteIMProvider.py - -##################################### -# Test for Admin Relationship Types # -##################################### - -maxq -q -r testAdminAddRel.py -maxq -q -r testAdminEditRel.py -maxq -q -r testAdminViewRel.py -maxq -q -r testAdminEnableDisableRel.py -maxq -q -r testAdminDeleteRel.py - -#################################### -# Test for Admin Custom Data Group # -#################################### - -maxq -q -r testAdminAddCustomDataGroup.py -maxq -q -r testAdminEditCustomDataGroup.py -maxq -q -r testAdminEnableDisableCustomDataGroup.py -maxq -q -r testAdminPreviewCustomDataGroup.py - -#################################### -# Test for Admin Custom Data Field # -#################################### - -maxq -q -r testAdminAddCustomDataField.py -maxq -q -r testAdminEditCustomDataField.py -maxq -q -r testAdminEnableDisableCustomDataField.py -maxq -q -r testAdminPreviewCustomDataField.py - -######################## -# Test for Custom Data # -######################## - -maxq -r -q testEditCustomDataInline.py - -#maxq -q -r adminDeleteCustomDataField.py -#maxq -q -r adminDeleteCustomDataGroup.py - -############################## -# Test for Admin CiviDonate # -############################## - -################### -# Contribute Mode # -################### - -maxq -r testAdminAddCiviDonateContributeMode.py -maxq -r testAdminEditCiviDonateContributeMode.py -maxq -r testAdminDisableEnableCiviDonateContributeMode.py -maxq -r testAdminDeleteCiviDonateContributeMode.py - -################### -# Contribute Type # -################### - -maxq -r testAdminAddCiviDonateContributeType.py -maxq -r testAdminEditCiviDonateContributeType.py -maxq -r testAdminDisableEnableCiviDonateContributeType.py -maxq -r testAdminDeleteCiviDonateContributeType.py - -###################### -# Payment Instrument # -###################### - -maxq -r testAdminAddCiviDonatePaymentInstrument.py -maxq -r testAdminEditCiviDonatePaymentInstrument.py -maxq -r testAdminDisableEnableCiviDonatePaymentInstrument.py -maxq -r testAdminDeleteCiviDonatePaymentInstrument.py - -########################## -# Test for Basic Search # -########################## - -maxq -q -r testSearchByLNameIndividual.py -maxq -q -r testSearchByHNameHousehold.py -maxq -q -r testSearchByONameOraganization.py -maxq -q -r testSearchByNoCriteria.py -maxq -q -r testSearchByGroup.py -maxq -q -r testSearchByContactTagGroupName.py - -############################# -# Test for Advanced Search # -############################# - -maxq -q -r testAdvSearchByAllCriteria.py -maxq -q -r testAdvSearchByContactName.py -maxq -q -r testAdvSearchByContactGroupCategory.py -- 2.25.1