Advertisement:

Author Topic: Keeping track of code changes - best method?  (Read 435 times)

Offline landyvlad

  • Sr. Member
  • ****
  • Posts: 799
  • Gender: Male
    • Michael Reed on Facebook
    • GSX1400 Owners ORG
Keeping track of code changes - best method?
« on: March 19, 2019, 10:37:29 PM »
Can anyone suggest an efficient way of keeping track of changes done to smf files?

I'm thinking of just keeping track of what has been edited and why.
Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

To paraphrase Kindred: "There are no technical solutions to social problems."

Offline skb

  • Jr. Member
  • **
  • Posts: 310
    • Metabolically Challenged
Re: Keeping track of code changes - best method?
« Reply #1 on: March 19, 2019, 10:46:07 PM »
I use a (admin only) thread in which I record all the changes. New post for each change. I change the subject line every time to a more relevant / understandable / searchable one.
Learning, every day.
Forum - The Diabetic Pub
Because every diabetic needs help
SMF 2.1 RC1 (default theme) / TP 1.6.2

Offline shawnb61

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,135
    • sbulen on GitHub
Re: Keeping track of code changes - best method?
« Reply #2 on: March 19, 2019, 11:23:23 PM »
I've started my own local git repository. 

I hope to recreate all customizations/tweaks to little mods.  I want to get to the point where I can rebuild the forum completely via package manager. 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 448
  • Gender: Female
Re: Keeping track of code changes - best method?
« Reply #3 on: March 20, 2019, 03:29:30 AM »
I always do the following:
1.  Insert a comment explaining what I've done and why and add my initials to the end of the line (I can then search a file for my initials);
2.  If the change came about as a result of something I read on this forum (or, very occasionally, somewhere else) I include the URL of the source of the information; and
3.  Keep a copy of the original line/lines of code as comments (very important for installing/uninstalling/reinstalling mods later on);

Here's an example from ./Sources/Load.php on one of my forums.
Quote
        // Fix for bug in Display Additional Membergroups on Profile mod. KL
        // See https://www.simplemachines.org/community/index.php?topic=141200.msg3031487#msg3031487
        //'list_additional_groups' => $profile['list_additional_groups'],
        'list_additional_groups' => !empty($profile['list_additional_groups']) ? $profile['list_additional_groups'] : '',

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 70,535
    • StoryBB/StoryBB on GitHub
Re: Keeping track of code changes - best method?
« Reply #4 on: March 20, 2019, 03:36:47 AM »
Git repository with build tools to automate syncing from local to server. (But I have multiple sites, multiple platforms and this lets me manage patching too, mostly.)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline landyvlad

  • Sr. Member
  • ****
  • Posts: 799
  • Gender: Male
    • Michael Reed on Facebook
    • GSX1400 Owners ORG
Re: Keeping track of code changes - best method?
« Reply #5 on: March 20, 2019, 07:03:22 AM »
Thanks all

GL700wing yep i agree with your method and that's great for individual code but I'd like to keep some master list so I easily know what files I've made manual edits to; as well.


Arantor & shawn Git repositories are well beyond me :)

skb yes but if the forum is down, so is that thread !



Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

To paraphrase Kindred: "There are no technical solutions to social problems."

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 448
  • Gender: Female
Re: Keeping track of code changes - best method?
« Reply #6 on: March 20, 2019, 07:41:31 AM »
GL700wing yep i agree with your method and that's great for individual code but I'd like to keep some master list so I easily know what files I've made manual edits to; as well.
Easy enough to do with a UNIX/Linux command ...

Quote
cd ~/www/forum ; find . \( -name \*php -o -name \*css \) -type f -exec grep -l KL {} \; | sort -f
./proxy.php
./Sources/Load.php
./Sources/LogInOut.php
./Sources/ManageMembers.php
./Sources/ManageSettings.php
./Sources/Memberlist.php
./Sources/PersonalMessage.php
./Sources/Post.php
./Sources/Profile-Modify.php
./Sources/Profile.php
./Sources/Subs-Graphics.php
./Sources/Subs-Post.php
./Sources/Subs.php
./Themes/default/Admin.template.php
./Themes/default/css/admin.css
./Themes/default/css/index.css
./Themes/default/Display.template.php
./Themes/default/GenericControls.template.php
./Themes/default/index.template.php
./Themes/default/languages/Admin.english-utf8.php
./Themes/default/languages/Admin.english.php
./Themes/default/languages/ManageSettings.english.php
./Themes/default/Login.template.php
./Themes/default/ManageMembers.template.php
./Themes/default/PersonalMessage.template.php
./Themes/default/Profile.template.php

Offline landyvlad

  • Sr. Member
  • ****
  • Posts: 799
  • Gender: Male
    • Michael Reed on Facebook
    • GSX1400 Owners ORG
Re: Keeping track of code changes - best method?
« Reply #7 on: March 20, 2019, 09:30:58 PM »
I have no idea how that works or what it does....
Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

To paraphrase Kindred: "There are no technical solutions to social problems."

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 448
  • Gender: Female
Re: Keeping track of code changes - best method?
« Reply #8 on: Yesterday at 04:59:06 AM »
I have no idea how that works or what it does....
That's OK - here's a PHP file that does the same thing.

1. Edit the file and change the value of $my_id to whatever string you use to identify your edits (eg, MKR).
2. Use the cPanel file manager to copy the file to the root/home directory/folder (ie, the same location where SSI.php and Settings.php reside) of each forum where you modify files.
3. To list the files where you've recorded details of edits open the MyFiles.php (eg, www.mywebsite.org/forum/MyFiles.php) and wait for it to display the results.



Here's the code ...

Quote
<?php
$my_id = "KL";
$this_dir = getcwd();
$command = "find . \( -name \*php -o -name \*css \) -type f -exec grep -liz $my_id\[\[:space:\]\] {} \; | sort -f";
$output = shell_exec($command);
echo "List of all .php and .css files containing string \"$my_id\" in $this_dir";
echo nl2br("\n\n$output\n");
echo "Finished listing .php and .css files containing string \"$my_id\" in $this_dir";
?>

Offline Study Force

  • SMF Hero
  • ******
  • Posts: 3,480
    • StudyForcePS on Facebook
    • @studyforceps on Twitter
Re: Keeping track of code changes - best method?
« Reply #9 on: Yesterday at 08:08:18 AM »
Git repository with build tools to automate syncing from local to server. (But I have multiple sites, multiple platforms and this lets me manage patching too, mostly.)

I feel that's too risky, b/c what if Github gets hacked or they change a setting (like Facebook as done in the past), where all your private information becomes public. I like the idea, but it's scary

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,409
Re: Keeping track of code changes - best method?
« Reply #10 on: Yesterday at 08:10:46 AM »
you can have a git repo without GitHub being involved.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 70,535
    • StoryBB/StoryBB on GitHub
Re: Keeping track of code changes - best method?
« Reply #11 on: Yesterday at 08:41:22 AM »
Indeed, I use my VPS for that. Others use Bitbucket, others use GitLab, Gerrit, or even just Git itself can be used that way with care.

I doubt Github will hit that problem, it’s not in Microsoft’s interest to let that happen.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Gwenwyfar

  • Pirate valkyrie neko-chan
  • Lead Customizer
  • SMF Hero
  • *
  • Posts: 2,095
  • Gender: Female
    • Gwenwyfar on GitHub
Re: Keeping track of code changes - best method?
« Reply #12 on: Yesterday at 09:46:54 AM »
You could also have only a local repository. So it's essentially no different than having the files stored in your computer.

This is what I do, personally.
What can you bring down from the realm of dreams?

Be mindful of your flaws, but never forget your strengths.                                                                                                                                                       
                                                                                                                                 

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 70,535
    • StoryBB/StoryBB on GitHub
Re: Keeping track of code changes - best method?
« Reply #13 on: Yesterday at 09:57:51 AM »
I just have the master repository in my server so build tools can work with it and deploy things.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Gwenwyfar

  • Pirate valkyrie neko-chan
  • Lead Customizer
  • SMF Hero
  • *
  • Posts: 2,095
  • Gender: Female
    • Gwenwyfar on GitHub
Re: Keeping track of code changes - best method?
« Reply #14 on: Yesterday at 10:04:26 AM »
Yeah, that sounds better. My setup isn't that elaborate. I still miss FireFTP auto-uploading things for me though.
What can you bring down from the realm of dreams?

Be mindful of your flaws, but never forget your strengths.                                                                                                                                                       
                                                                                                                                 

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 70,535
    • StoryBB/StoryBB on GitHub
Re: Keeping track of code changes - best method?
« Reply #15 on: Yesterday at 10:07:56 AM »
Yeah but I host a bunch of stuff.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 448
  • Gender: Female
Re: Keeping track of code changes - best method?
« Reply #16 on: Yesterday at 06:03:57 PM »
Yeah, that sounds better. My setup isn't that elaborate. I still miss FireFTP auto-uploading things for me though.
I'm still using FireFTP - I use a portable version of Firefox ESR and installed FireFTP as an unsigned add-on.

Alternatively, you could use Waterfox - FireFTP installs without the need to enable unsigned add-ons.