Commit 85970347 authored by Rich's avatar Rich Committed by VangelisP
Browse files

Upgrade civix (to avoid notice error in php7.4); update readme to add memory use

parent f1e37dc4
# benchmarktools
# Benchmark tools
An APIv3 tool that run synthetic benchmarks using various CiviCRM and non-CiviCRM components so that it can simulate a heavy workload and introduce stress-test on to the server that it's being used. The output of the benchmark results displays in the console and to comma delimited CSV file(s).
......@@ -26,7 +26,7 @@ The extension is licensed under [AGPL-3.0](LICENSE.txt).
## Requirements
* PHP v7.2+
* PHP v7.2+ with max memory at least 512MB
* CiviCRM 5.35+
## Installation (CLI, Git)
......@@ -82,4 +82,4 @@ It is safe to assume that those specific tests can be executed as individual ser
This extension is supported and maintained by
[![iXiam Global Solutions](https://www.ixiam.com/sites/www.ixiam.com/files/logo-ixiam.jpg)](https://www.ixiam.com)
\ No newline at end of file
[![iXiam Global Solutions](https://www.ixiam.com/sites/www.ixiam.com/files/logo-ixiam.jpg)](https://www.ixiam.com)
......@@ -7,9 +7,9 @@
* extension.
*/
class CRM_Benchmarktools_ExtensionUtil {
const SHORT_NAME = "benchmarktools";
const LONG_NAME = "benchmarktools";
const CLASS_PREFIX = "CRM_Benchmarktools";
const SHORT_NAME = 'benchmarktools';
const LONG_NAME = 'benchmarktools';
const CLASS_PREFIX = 'CRM_Benchmarktools';
/**
* Translate a string using the extension's domain.
......@@ -91,9 +91,9 @@ function _benchmarktools_civix_civicrm_config(&$config = NULL) {
}
$configured = TRUE;
$template =& CRM_Core_Smarty::singleton();
$template = CRM_Core_Smarty::singleton();
$extRoot = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$extRoot = __DIR__ . DIRECTORY_SEPARATOR;
$extDir = $extRoot . 'templates';
if (is_array($template->template_dir)) {
......@@ -193,8 +193,9 @@ function _benchmarktools_civix_civicrm_disable() {
* @param $op string, the type of operation being performed; 'check' or 'enqueue'
* @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks
*
* @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending)
* for 'enqueue', returns void
* @return mixed
* based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending)
* for 'enqueue', returns void
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade
*/
......@@ -220,41 +221,18 @@ function _benchmarktools_civix_upgrader() {
* Search directory tree for files which match a glob pattern.
*
* Note: Dot-directories (like "..", ".git", or ".svn") will be ignored.
* Note: In Civi 4.3+, delegate to CRM_Utils_File::findFiles()
* Note: Delegate to CRM_Utils_File::findFiles(), this function kept only
* for backward compatibility of extension code that uses it.
*
* @param string $dir base dir
* @param string $pattern , glob pattern, eg "*.txt"
*
* @return array(string)
* @return array
*/
function _benchmarktools_civix_find_files($dir, $pattern) {
if (is_callable(['CRM_Utils_File', 'findFiles'])) {
return CRM_Utils_File::findFiles($dir, $pattern);
}
$todos = [$dir];
$result = [];
while (!empty($todos)) {
$subdir = array_shift($todos);
foreach (_benchmarktools_civix_glob("$subdir/$pattern") as $match) {
if (!is_dir($match)) {
$result[] = $match;
}
}
if ($dh = opendir($subdir)) {
while (FALSE !== ($entry = readdir($dh))) {
$path = $subdir . DIRECTORY_SEPARATOR . $entry;
if ($entry{0} == '.') {
}
elseif (is_dir($path)) {
$todos[] = $path;
}
}
closedir($dh);
}
}
return $result;
return CRM_Utils_File::findFiles($dir, $pattern);
}
/**
* (Delegated) Implements hook_civicrm_managed().
*
......@@ -362,7 +340,7 @@ function _benchmarktools_civix_civicrm_themes(&$themes) {
* @link http://php.net/glob
* @param string $pattern
*
* @return array, possibly empty
* @return array
*/
function _benchmarktools_civix_glob($pattern) {
$result = glob($pattern);
......@@ -470,8 +448,6 @@ function _benchmarktools_civix_civicrm_alterSettingsFolders(&$metaDataFolders =
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
*/
function _benchmarktools_civix_civicrm_entityTypes(&$entityTypes) {
$entityTypes = array_merge($entityTypes, array (
));
$entityTypes = array_merge($entityTypes, []);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment