Skip to content

Commit b1eafdc

Browse files
committed
feat(agent): remove unnecessary code
1 parent ec10d19 commit b1eafdc

File tree

6 files changed

+0
-95
lines changed

6 files changed

+0
-95
lines changed

agent/fw_hooks.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ extern void nr_phpunit_enable(TSRMLS_D);
5757
extern void nr_predis_enable(TSRMLS_D);
5858
extern void nr_zend_http_enable(TSRMLS_D);
5959
extern void nr_monolog_enable(TSRMLS_D);
60-
extern void nr_get_package_information(TSRMLS_D);
6160

6261
/* Vulnerability Management Packages */
6362
extern void nr_drupal_version(void);

agent/fw_symfony4.c

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -215,56 +215,6 @@ NR_PHP_WRAPPER(nr_symfony4_name_the_wt) {
215215
}
216216
NR_PHP_WRAPPER_END
217217

218-
void nr_get_package_information() {
219-
zval retval;
220-
int result = -1;
221-
char* func_string
222-
= ""
223-
"(function() {"
224-
" try {"
225-
" if (class_exists('Composer\\InstalledVersions')) {"
226-
" if (method_exists('Composer\\InstalledVersions', "
227-
" 'getInstalledPackages') && method_exists('Composer\\InstalledVersions', "
228-
" 'getVersion')) {"
229-
" return Composer\\InstalledVersions::getInstalledPackages();"
230-
" } else {"
231-
" return NULL;"
232-
" }"
233-
" } else {"
234-
" return NULL;"
235-
" }"
236-
" } catch (Exception $e) {"
237-
" return NULL;"
238-
" }"
239-
"})();";
240-
241-
char* getVersion = "Composer\\InstalledVersions::getVersion(\"%s\");";
242-
zend_eval_string(func_string, &retval, "Retrieve symfony package name");
243-
244-
if (result == SUCCESS) {
245-
if (Z_TYPE(retval) == IS_ARRAY) {
246-
zval* value;
247-
char buf[512];
248-
int result2;
249-
zval retval2;
250-
char* version;
251-
(void)version;
252-
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(retval), value) {
253-
if (Z_TYPE_P(value) == IS_STRING) {
254-
snprintf(buf, sizeof(buf), getVersion, Z_STRVAL_P(value));
255-
result2 = zend_eval_string(buf, &retval2, "Retrieve symfony Version");
256-
if (SUCCESS == result2) {
257-
if (nr_php_is_zval_valid_string(&retval2)) {
258-
version = Z_STRVAL(retval2);
259-
}
260-
}
261-
}
262-
} ZEND_HASH_FOREACH_END();
263-
}
264-
zval_dtor(&retval);
265-
}
266-
}
267-
268218
void nr_symfony4_enable(TSRMLS_D) {
269219
/*
270220
* We set the path to 'unknown' to prevent having to name routing errors.

agent/php_agent.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,36 +1229,3 @@ bool nr_php_function_is_static_method(const zend_function* func) {
12291229

12301230
return (func->common.fn_flags & ZEND_ACC_STATIC);
12311231
}
1232-
1233-
nr_composer_classification_t nr_composer_special(
1234-
const char* filename TSRMLS_DC) {
1235-
NR_UNUSED_TSRMLS;
1236-
1237-
if (nr_strcaseidx(filename, "vendor/composer/") >= 0) {
1238-
zval retval;
1239-
int result = -1;
1240-
char* func_string
1241-
= ""
1242-
"(function() {"
1243-
" try {"
1244-
" if (file_exists('vendor/composer/installed.php')) {"
1245-
" return 'SUCCESS';"
1246-
" } else {"
1247-
" return NULL;"
1248-
" }"
1249-
" } catch (exception $e) {"
1250-
" return NULL;"
1251-
" }"
1252-
"})();";
1253-
result = zend_eval_string(func_string, &retval, "check if file exists" TSRMLS_CC);
1254-
if (result == SUCCESS) {
1255-
NR_PHP_PROCESS_GLOBALS(composer_exists) = 1;
1256-
return FILE_EXISTS;
1257-
} else {
1258-
NR_PHP_PROCESS_GLOBALS(composer_exists) = 0;
1259-
return FILE_DOES_NOT_EXIST;
1260-
}
1261-
}
1262-
1263-
return FILE_DOES_NOT_EXIST;
1264-
}

agent/php_agent.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,6 @@ extern zval* nr_php_parse_str(const char* str, size_t len TSRMLS_DC);
847847
*/
848848
extern bool nr_php_function_is_static_method(const zend_function* func);
849849

850-
extern nr_composer_classification_t nr_composer_special(
851-
const char* filename TSRMLS_DC);
852-
853850
/*
854851
* Purpose : Get the execution data for the current PHP environment.
855852
*

agent/php_execute.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@ typedef enum {
4141
typedef nr_framework_classification_t (*nr_framework_special_fn_t)(
4242
const char* filename TSRMLS_DC);
4343

44-
typedef enum {
45-
FILE_EXISTS, /* The file we are looking for exists */
46-
FILE_DOES_NOT_EXIST, /* The file we are looking for does not exist */
47-
} nr_composer_classification_t;
48-
typedef nr_composer_classification_t (*nr_composer_special_fn_t)(
49-
const char* filename);
50-
5144
/*
5245
* Version specific metadata that we have to gather before we call the original
5346
* execute_ex handler, as different versions of PHP behave differently in terms

agent/php_globals.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ typedef struct _nrphpglobals_t {
7676
int preload_framework_library_detection; /* Enables preloading framework and
7777
library detection */
7878
char* docker_id; /* 64 byte hex docker ID parsed from /proc/self/mountinfo */
79-
int composer_exists; /* Check if composer exists*/
8079

8180
/* Original PHP callback pointer contents */
8281
nrphperrfn_t orig_error_cb;

0 commit comments

Comments
 (0)