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

APIv3 - Delete api examples #27174

Merged
merged 1 commit into from
Aug 25, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
38 changes: 0 additions & 38 deletions CRM/Admin/Page/APIExplorer.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,44 +87,6 @@ public function userContext() {
return 'civicrm/api';
}

/**
* AJAX callback to fetch examples.
*/
public static function getExampleFile() {
if (!empty($_GET['entity']) && strpos($_GET['entity'], '.') === FALSE) {
$examples = [];
$paths = self::uniquePaths();
foreach ($paths as $path) {
$dir = \CRM_Utils_File::addTrailingSlash($path) . 'api' . DIRECTORY_SEPARATOR . 'v3' . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $_GET['entity'];
if (\CRM_Utils_File::isDir($dir)) {
foreach (scandir($dir) as $item) {
$item = str_replace('.ex.php', '', $item);
if ($item && strpos($item, '.') === FALSE) {
$examples[] = ['key' => $item, 'value' => $item];
}
}
}
}
CRM_Utils_JSON::output($examples);
}
if (!empty($_GET['file']) && strpos($_GET['file'], '.') === FALSE) {
$paths = self::uniquePaths();
$fileFound = FALSE;
foreach ($paths as $path) {
$fileName = \CRM_Utils_File::addTrailingSlash($path) . 'api' . DIRECTORY_SEPARATOR . 'v3' . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $_GET['file'] . '.ex.php';
if (!$fileFound && file_exists($fileName)) {
$fileFound = TRUE;
echo file_get_contents($fileName);
}
}
if (!$fileFound) {
echo "Not found.";
}
CRM_Utils_System::civiExit();
}
CRM_Utils_System::permissionDenied();
}

/**
* Ajax callback to display code docs.
*/
Expand Down
4 changes: 0 additions & 4 deletions CRM/Contact/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -1579,11 +1579,7 @@ public static function fixDateValues($relative, &$from, &$to) {
* 4 => null
* );
*
* There are some examples of the syntax in
* https://github.com/civicrm/civicrm-core/tree/master/api/v3/examples/Relationship
*
* More notes at CRM_Core_DAO::createSQLFilter
*
* and a list of supported operators in CRM_Core_DAO
*
* @param array $formValues
Expand Down
5 changes: 0 additions & 5 deletions CRM/Core/xml/Menu/Misc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@
<access_arguments>access CiviCRM</access_arguments>
<title>CiviCRM API v3</title>
</item>
<item>
<path>civicrm/ajax/apiexample</path>
<page_callback>CRM_Admin_Page_APIExplorer::getExampleFile</page_callback>
<access_arguments>access CiviCRM</access_arguments>
</item>
<item>
<path>civicrm/ajax/apidoc</path>
<page_callback>CRM_Admin_Page_APIExplorer::getDoc</page_callback>
Expand Down
211 changes: 0 additions & 211 deletions Civi/Test/Api3DocTrait.php

This file was deleted.

11 changes: 11 additions & 0 deletions Civi/Test/Api3TestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,17 @@ public function callAPIFailure($entity, $action, $params, $expectedErrorMessage
return $result;
}

/**
* @deprecated
* @param string $entity
* @param string $action
* @param array $params
* @return array|int
*/
public function callAPIAndDocument($entity, $action, $params) {
return $this->callAPISuccess($entity, $action, $params);
}

/**
* wrap api functions.
* so we can ensure they succeed & throw exceptions without litterering the test with checks
Expand Down
Loading