skip to Main Content

Before I describe the problem, here is a basic run-down of the overall process to give you a clearer picture. Additionally, I am a novice at PHP:

  1. I have a WordPress website that uses CPanel as its web hosting software
  2. The WordPress website has a form (made by UFB) that has the user upload an image
  3. The image gets directed to the upload folder (/uploads) by using image_upload.php
  4. The image is then downloaded onto a computer, and a program is run which generates numbers about the picture(the number generator program is in python)
  5. After the numbers are generated, it calls on report.php and template.xlsm
  6. Report.php gets those generated numbers and then puts them into their designated places on the xlsm file
  7. The xlsm file is then converted into a pdf, which is then emailed to the user that submitted the picture.

I inherited all of this code from someone else who wanted me to help them on this project. Here is my problem:

I don’t understand how the PHP files are being called. I have python code ready to run the number generator online, however, I can’t do this without figuring how the PHP files are being called.

I understand what the PHP files do, I just don’t understand how they are being called. I tried doing a -grep search for both image_upload.php and report.php, but I come up empty. There aren’t any other PHP files that seem to do an include(xyz.php), which is supposed to be how PHP files are called. I don’t understand what calls image_upload.php to get the pictures moved into the /uploads folder. I also don’t understand what calls report.php to make it run. I tried looking in functions.php, where most of the other PHP files are called, but report.php and image_upload.php aren’t.

Please help me! If any clarification is needed, just comment, and I will try to provide any help I can!

2

Answers


  1. An easy way to get the the calling functions (including include and require calls) from any point in your PHP scripts is to get the stacktrace:

    $e = new Exception();
    var_dump($e->getTraceAsString());
    

    You can also use an logger instead of the var_dump.

    Login or Signup to reply.
  2. Unfortunately a simple grep for requires and includes won’t suffice for a large project like WordPress due to the use of autoloading:

    https://www.php.net/manual/en/language.oop5.autoload.php

    While this resource isn’t specific to your project, and things could be setup drastically different in your project, I think the details here may provide enough hints about autoloading to get you started in the right direction to understanding things in more depth:

    https://wordpress.stackexchange.com/questions/212153/using-spl-autoloading-within-wordpress-plugin

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search