-2

Lets say you downloaded a free PHP script from GitHub and it has thousands of PHP files, language files, etc.

Now if you need to customize a specific line of code and you don't know where it is located, you have to go through each file to find where it belongs to and after spending a huge amount of time, you may be lucky to find it.

Is there any way to find the code faster (offline or in cPanel)?

Kevin Smith
  • 111
  • 7
  • It is possible with standard "Find in Path..." function of JetBrains IDEs, e.g. – Arfeo Mar 03 '19 at 02:12
  • do you know the `string` in question ? – YvesLeBorg Mar 03 '19 at 02:17
  • yes, let's say you know the exact string that you looking for – Kevin Smith Mar 03 '19 at 02:20
  • for example: "Welcome to your profile" – Kevin Smith Mar 03 '19 at 02:31
  • 1
    I use PhpStorm, which will find that. On a mac : spotlight will also find all files with that string ... which also has a 'nix shell which will also do that ( https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux) – YvesLeBorg Mar 03 '19 at 02:48
  • 1
    If you're getting it off Github, Github lets you search the contents of an entire repository via the search bar up top. – ceejayoz Mar 03 '19 at 03:03
  • all good IDE's have a file search function –  Mar 03 '19 at 03:12
  • I have a very small script that does this, I think I wrote it in php, perl, .net, asp, and maybe python too, so whatever version you want, just tell me. what it does, give it... a directory, or compressed file, and the file types to edit, and search and replace strings or an array of search terms, or hash references and it will do the replacements automatically, or you can verify each replacement presented in a form. It also keeps track of the replacements so you can revert changes as many times as you have previously edited a file as long as you don't delete the log file. – Stephanie Temple Mar 03 '19 at 03:30
  • 1
    if you know the function name, a variable name, etc then `man grep` Otherwise learn how to use a debugger with break points and watch values – ivanivan Mar 03 '19 at 03:49
  • As I can't delete the question, I'll ask you for permission for this question to stay. BTW thanks for the tip. – Kevin Smith Mar 03 '19 at 14:11
  • 1
    @KevinSmith Github **absolutely** can search within the code. For example: https://github.com/laravel/laravel/search?q=%22%24user-%3Eid%22 – ceejayoz Mar 04 '19 at 03:17
  • @ceejayoz Yes, I just know that option. Thanks so much mate! – Kevin Smith Mar 04 '19 at 12:33

1 Answers1

0

I personally have used PHiSearch a lot to search through folders of code & usually get a hit for what I'm looking for.

Phil
  • 141
  • 2
  • 5