Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#2556 Rename extension org.civicrm.search -> org.civicrm.search_kit #20124

Merged
merged 2 commits into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/ext/greenwich/dist
/ext/greenwich/extern
!/ext/oauth-client
!/ext/search
!/ext/search_kit
!/ext/financialacls
!/ext/contributioncancelactions
!/ext/recaptcha
Expand Down
2 changes: 1 addition & 1 deletion CRM/Extension/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* You should obtain a singleton of this class via
*
* $manager = CRM_Extension_Manager::singleton()->getManager();
* $manager = CRM_Extension_System::singleton()->getManager();
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
Expand Down
2 changes: 2 additions & 0 deletions CRM/Upgrade/Incremental/php/FiveThirtyEight.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
public function upgrade_5_38_alpha1($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
$this->addTask('Enable Payflow Pro Payment Processor Extension', 'enablePayflowProExtension');
// Refresh extension cache due to renaming search_kit extension
CRM_Extension_System::singleton()->getManager()->refresh();
}

public static function enablePayflowProExtension(CRM_Queue_TaskContext $ctx) {
Expand Down
8 changes: 8 additions & 0 deletions CRM/Upgrade/Incremental/sql/5.38.alpha1.mysql.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{* file to handle db changes in 5.38.alpha1 during upgrade *}

ALTER TABLE civicrm_queue_item MODIFY data LONGTEXT;

UPDATE civicrm_extension
SET full_name = 'org.civicrm.search_kit', name = 'search_kit', file = 'search_kit'
WHERE full_name = 'org.civicrm.search';

UPDATE civicrm_managed
SET module = 'org.civicrm.search_kit'
WHERE module = 'org.civicrm.search';
2 changes: 1 addition & 1 deletion distmaker/dists/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function dm_install_coreext() {
## Get a list of default/core extension directories (space-delimited)
## reldirs=$(dm_core_exts)
function dm_core_exts() {
echo ext/search
echo ext/search_kit
echo ext/sequentialcreditnotes
echo ext/flexmailer
echo ext/eventcart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*
* Generated from org.civicrm.search/xml/schema/CRM/Search/SearchDisplay.xml
* Generated from org.civicrm.search_kit/xml/schema/CRM/Search/SearchDisplay.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:ac28cede0407e2e1bf2273b7ca6421d4)
* (GenCodeChecksum:6042d1e2bee9eaed4c3a7c59c34ad224)
*/
use CRM_Search_ExtensionUtil as E;

Expand Down Expand Up @@ -125,6 +125,7 @@ public static function &fields() {
'entity' => 'SearchDisplay',
'bao' => 'CRM_Search_DAO_SearchDisplay',
'localizable' => 0,
'readonly' => TRUE,
'add' => '1.0',
],
'name' => [
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions ext/search/info.xml → ext/search_kit/info.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<extension key="org.civicrm.search" type="module">
<file>search</file>
<extension key="org.civicrm.search_kit" type="module">
<file>search_kit</file>
<name>Search Kit</name>
<description>Create searches for a wide variety of CiviCRM entities</description>
<license>AGPL-3.0</license>
Expand Down
File renamed without changes.
88 changes: 44 additions & 44 deletions ext/search/search.civix.php → ext/search_kit/search_kit.civix.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* extension.
*/
class CRM_Search_ExtensionUtil {
const SHORT_NAME = 'search';
const LONG_NAME = 'org.civicrm.search';
const SHORT_NAME = 'search_kit';
const LONG_NAME = 'org.civicrm.search_kit';
const CLASS_PREFIX = 'CRM_Search';

/**
Expand Down Expand Up @@ -84,7 +84,7 @@ public static function findClass($suffix) {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config
*/
function _search_civix_civicrm_config(&$config = NULL) {
function _search_kit_civix_civicrm_config(&$config = NULL) {
static $configured = FALSE;
if ($configured) {
return;
Expand Down Expand Up @@ -114,8 +114,8 @@ function _search_civix_civicrm_config(&$config = NULL) {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_xmlMenu
*/
function _search_civix_civicrm_xmlMenu(&$files) {
foreach (_search_civix_glob(__DIR__ . '/xml/Menu/*.xml') as $file) {
function _search_kit_civix_civicrm_xmlMenu(&$files) {
foreach (_search_kit_civix_glob(__DIR__ . '/xml/Menu/*.xml') as $file) {
$files[] = $file;
}
}
Expand All @@ -125,9 +125,9 @@ function _search_civix_civicrm_xmlMenu(&$files) {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install
*/
function _search_civix_civicrm_install() {
_search_civix_civicrm_config();
if ($upgrader = _search_civix_upgrader()) {
function _search_kit_civix_civicrm_install() {
_search_kit_civix_civicrm_config();
if ($upgrader = _search_kit_civix_upgrader()) {
$upgrader->onInstall();
}
}
Expand All @@ -137,9 +137,9 @@ function _search_civix_civicrm_install() {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall
*/
function _search_civix_civicrm_postInstall() {
_search_civix_civicrm_config();
if ($upgrader = _search_civix_upgrader()) {
function _search_kit_civix_civicrm_postInstall() {
_search_kit_civix_civicrm_config();
if ($upgrader = _search_kit_civix_upgrader()) {
if (is_callable([$upgrader, 'onPostInstall'])) {
$upgrader->onPostInstall();
}
Expand All @@ -151,9 +151,9 @@ function _search_civix_civicrm_postInstall() {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_uninstall
*/
function _search_civix_civicrm_uninstall() {
_search_civix_civicrm_config();
if ($upgrader = _search_civix_upgrader()) {
function _search_kit_civix_civicrm_uninstall() {
_search_kit_civix_civicrm_config();
if ($upgrader = _search_kit_civix_upgrader()) {
$upgrader->onUninstall();
}
}
Expand All @@ -163,9 +163,9 @@ function _search_civix_civicrm_uninstall() {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable
*/
function _search_civix_civicrm_enable() {
_search_civix_civicrm_config();
if ($upgrader = _search_civix_upgrader()) {
function _search_kit_civix_civicrm_enable() {
_search_kit_civix_civicrm_config();
if ($upgrader = _search_kit_civix_upgrader()) {
if (is_callable([$upgrader, 'onEnable'])) {
$upgrader->onEnable();
}
Expand All @@ -178,9 +178,9 @@ function _search_civix_civicrm_enable() {
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable
* @return mixed
*/
function _search_civix_civicrm_disable() {
_search_civix_civicrm_config();
if ($upgrader = _search_civix_upgrader()) {
function _search_kit_civix_civicrm_disable() {
_search_kit_civix_civicrm_config();
if ($upgrader = _search_kit_civix_upgrader()) {
if (is_callable([$upgrader, 'onDisable'])) {
$upgrader->onDisable();
}
Expand All @@ -199,16 +199,16 @@ function _search_civix_civicrm_disable() {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade
*/
function _search_civix_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
if ($upgrader = _search_civix_upgrader()) {
function _search_kit_civix_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
if ($upgrader = _search_kit_civix_upgrader()) {
return $upgrader->onUpgrade($op, $queue);
}
}

/**
* @return CRM_Search_Upgrader
*/
function _search_civix_upgrader() {
function _search_kit_civix_upgrader() {
if (!file_exists(__DIR__ . '/CRM/Search/Upgrader.php')) {
return NULL;
}
Expand All @@ -228,7 +228,7 @@ function _search_civix_upgrader() {
*
* @return array
*/
function _search_civix_find_files($dir, $pattern) {
function _search_kit_civix_find_files($dir, $pattern) {
if (is_callable(['CRM_Utils_File', 'findFiles'])) {
return CRM_Utils_File::findFiles($dir, $pattern);
}
Expand All @@ -237,7 +237,7 @@ function _search_civix_find_files($dir, $pattern) {
$result = [];
while (!empty($todos)) {
$subdir = array_shift($todos);
foreach (_search_civix_glob("$subdir/$pattern") as $match) {
foreach (_search_kit_civix_glob("$subdir/$pattern") as $match) {
if (!is_dir($match)) {
$result[] = $match;
}
Expand All @@ -264,8 +264,8 @@ function _search_civix_find_files($dir, $pattern) {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_managed
*/
function _search_civix_civicrm_managed(&$entities) {
$mgdFiles = _search_civix_find_files(__DIR__, '*.mgd.php');
function _search_kit_civix_civicrm_managed(&$entities) {
$mgdFiles = _search_kit_civix_find_files(__DIR__, '*.mgd.php');
sort($mgdFiles);
foreach ($mgdFiles as $file) {
$es = include $file;
Expand All @@ -290,12 +290,12 @@ function _search_civix_civicrm_managed(&$entities) {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_caseTypes
*/
function _search_civix_civicrm_caseTypes(&$caseTypes) {
function _search_kit_civix_civicrm_caseTypes(&$caseTypes) {
if (!is_dir(__DIR__ . '/xml/case')) {
return;
}

foreach (_search_civix_glob(__DIR__ . '/xml/case/*.xml') as $file) {
foreach (_search_kit_civix_glob(__DIR__ . '/xml/case/*.xml') as $file) {
$name = preg_replace('/\.xml$/', '', basename($file));
if ($name != CRM_Case_XMLProcessor::mungeCaseType($name)) {
$errorMessage = sprintf("Case-type file name is malformed (%s vs %s)", $name, CRM_Case_XMLProcessor::mungeCaseType($name));
Expand All @@ -318,12 +318,12 @@ function _search_civix_civicrm_caseTypes(&$caseTypes) {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules
*/
function _search_civix_civicrm_angularModules(&$angularModules) {
function _search_kit_civix_civicrm_angularModules(&$angularModules) {
if (!is_dir(__DIR__ . '/ang')) {
return;
}

$files = _search_civix_glob(__DIR__ . '/ang/*.ang.php');
$files = _search_kit_civix_glob(__DIR__ . '/ang/*.ang.php');
foreach ($files as $file) {
$name = preg_replace(':\.ang\.php$:', '', basename($file));
$module = include $file;
Expand All @@ -339,8 +339,8 @@ function _search_civix_civicrm_angularModules(&$angularModules) {
*
* Find any and return any files matching "*.theme.php"
*/
function _search_civix_civicrm_themes(&$themes) {
$files = _search_civix_glob(__DIR__ . '/*.theme.php');
function _search_kit_civix_civicrm_themes(&$themes) {
$files = _search_kit_civix_glob(__DIR__ . '/*.theme.php');
foreach ($files as $file) {
$themeMeta = include $file;
if (empty($themeMeta['name'])) {
Expand All @@ -366,7 +366,7 @@ function _search_civix_civicrm_themes(&$themes) {
*
* @return array
*/
function _search_civix_glob($pattern) {
function _search_kit_civix_glob($pattern) {
$result = glob($pattern);
return is_array($result) ? $result : [];
}
Expand All @@ -382,7 +382,7 @@ function _search_civix_glob($pattern) {
*
* @return bool
*/
function _search_civix_insert_navigation_menu(&$menu, $path, $item) {
function _search_kit_civix_insert_navigation_menu(&$menu, $path, $item) {
// If we are done going down the path, insert menu
if (empty($path)) {
$menu[] = [
Expand All @@ -403,7 +403,7 @@ function _search_civix_insert_navigation_menu(&$menu, $path, $item) {
if (!isset($entry['child'])) {
$entry['child'] = [];
}
$found = _search_civix_insert_navigation_menu($entry['child'], implode('/', $path), $item);
$found = _search_kit_civix_insert_navigation_menu($entry['child'], implode('/', $path), $item);
}
}
return $found;
Expand All @@ -413,27 +413,27 @@ function _search_civix_insert_navigation_menu(&$menu, $path, $item) {
/**
* (Delegated) Implements hook_civicrm_navigationMenu().
*/
function _search_civix_navigationMenu(&$nodes) {
function _search_kit_civix_navigationMenu(&$nodes) {
if (!is_callable(['CRM_Core_BAO_Navigation', 'fixNavigationMenu'])) {
_search_civix_fixNavigationMenu($nodes);
_search_kit_civix_fixNavigationMenu($nodes);
}
}

/**
* Given a navigation menu, generate navIDs for any items which are
* missing them.
*/
function _search_civix_fixNavigationMenu(&$nodes) {
function _search_kit_civix_fixNavigationMenu(&$nodes) {
$maxNavID = 1;
array_walk_recursive($nodes, function($item, $key) use (&$maxNavID) {
if ($key === 'navID') {
$maxNavID = max($maxNavID, $item);
}
});
_search_civix_fixNavigationMenuItems($nodes, $maxNavID, NULL);
_search_kit_civix_fixNavigationMenuItems($nodes, $maxNavID, NULL);
}

function _search_civix_fixNavigationMenuItems(&$nodes, &$maxNavID, $parentID) {
function _search_kit_civix_fixNavigationMenuItems(&$nodes, &$maxNavID, $parentID) {
$origKeys = array_keys($nodes);
foreach ($origKeys as $origKey) {
if (!isset($nodes[$origKey]['attributes']['parentID']) && $parentID !== NULL) {
Expand All @@ -448,7 +448,7 @@ function _search_civix_fixNavigationMenuItems(&$nodes, &$maxNavID, $parentID) {
$origKey = $newKey;
}
if (isset($nodes[$origKey]['child']) && is_array($nodes[$origKey]['child'])) {
_search_civix_fixNavigationMenuItems($nodes[$origKey]['child'], $maxNavID, $nodes[$origKey]['attributes']['navID']);
_search_kit_civix_fixNavigationMenuItems($nodes[$origKey]['child'], $maxNavID, $nodes[$origKey]['attributes']['navID']);
}
}
}
Expand All @@ -458,7 +458,7 @@ function _search_civix_fixNavigationMenuItems(&$nodes, &$maxNavID, $parentID) {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterSettingsFolders
*/
function _search_civix_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
function _search_kit_civix_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
$settingsDir = __DIR__ . DIRECTORY_SEPARATOR . 'settings';
if (!in_array($settingsDir, $metaDataFolders) && is_dir($settingsDir)) {
$metaDataFolders[] = $settingsDir;
Expand All @@ -472,7 +472,7 @@ function _search_civix_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
*/
function _search_civix_civicrm_entityTypes(&$entityTypes) {
function _search_kit_civix_civicrm_entityTypes(&$entityTypes) {
$entityTypes = array_merge($entityTypes, [
'CRM_Search_DAO_SearchDisplay' => [
'name' => 'SearchDisplay',
Expand Down
Loading