Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Editing index.template.php results in file size 0b

Started by NorfolkGreg, June 13, 2023, 06:09:32 PM

Previous topic - Next topic

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters


I am opposed to removing the feature....   I have used it myself when having to make emergency edits from my phone, when I don't have access to the normal file manager, ftp or text editors...

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sir Osis of Liver

Yes, that works for you, but I think in general the people most likely to use the theme editor are also the least likely to make backups (editor doesn't), and the least able to recover if they crash the forum with a bad edit.  If the feature is retained, might be a good idea to have a recommendation/warning up top that better methods should be used if available, and that backups are a must before editing a file.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters


I have to agree with Sir Osis here. TBH I think that if this feature is going to be retained it really should:

a/ make an automatic backup of the file which is about to be edited, and
b/ provide a means for the admin to access the backup file and overwrite with it.

That's the only way of allowing editing of PHP templates without the risk of trashing the site. And it's tricky, because a parse error will crash the site, so you would need to build in a way of circumventing SMF admin to allow the overwrite.

Which really brings things back to FTP + code editor. I have crashed a site with a parse error before, and if you have a backup ready to rumble it's a few seconds to FTP it into place.