WordPress.org

Make WordPress Core

Opened 9 years ago

Last modified 4 months ago

#16396 new enhancement

Add a hook to the theme editor page when the write is successful

Reported by: scottconnerly Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1.3
Component: Themes Keywords: needs-refresh
Focuses: Cc:
PR Number:

Description

Add a filter to the end of theme-editor.php's processing when the write is successful.

Attachments (1)

ticket.16396.diff (527 bytes) - added by ptahdunbar 9 years ago.

Download all attachments as: .zip

Change History (13)

#1 @PeteMall
9 years ago

  • Keywords reporter-feedback added

You have a better chance of getting a hook if you can give a use case and demonstrate that it can't be achieved using one of the existing hooks.

#2 @scottconnerly
9 years ago

The use case is for managing a Wordpress install on an SVN-controlled server. Whenever the CMS changes a file's contents (particularly in the wp-content folder) I need to be able to trigger an svn commit.

#3 @scottconnerly
9 years ago

  • Keywords reporter-feedback removed

#4 @scottconnerly
9 years ago

  • Component changed from Administration to Themes

#5 @scottconnerly
9 years ago

  • Cc scottconnerly added
  • Keywords subversion added

#6 @mikeschinkel
9 years ago

  • Cc mikeschinkel@… added

#7 @ptahdunbar
9 years ago

  • Cc trac@… added
  • Keywords has-patch added
  • Summary changed from theme-editor filter to Add a hook to the theme editor page when the write is successful

ticket.16396.diff adds a new 'edited_theme' action, passing the theme's template name, the file edited, and the new content as parameters.

#8 @ericlewis
8 years ago

  • Cc ericlewis added
  • Version changed from 3.0.4 to 3.1.3

This is definitely out of the scope of all hooks currently. In theme-editor.php, from lines 82-100 the new contents of the file are written, a redirect location is set, and then exit(). Inserting this line at 96 would work well:

do_action('theme_file_updated', $file, $theme );

#9 @jose.sg
8 years ago

  • Cc jose.sg added

I just had a lovely chat with the people in #wordpress about just this feature. For reference, see http://wordpress.org/support/topic/unable-to-update-wordpress-theme?replies=8, but essentially I wanted to be able to clear the APC cache when a WordPress theme was updated.

The consensus seemed to be that I should not be using the online editor, which is fine except that:

  • It exists, so it must serve a purpose
  • I'm not going to try and teach a designer yet another tool (ssh) in order to let her get work done

Since this ticket appears to have died (other than the resuscitation by @ericlewis prompted by my wordpress discussion), I created a plugin that seems to work for my use-case (I seem to have lost my commit rights on the wp svn a few years ago). https://gist.github.com/a92e511c5f1d299716cc contains the plugin, for anyone stumbling upon this ticket.

Makes a hook for both theme and plugin file updating, as well as menu items such that they can be triggered on demand (in case you do edit them from the command-line). One caveat is that I think themes are loaded before plugins, and so it looks like calling this hook from a theme's functions.php file fails. Not sure what the best solution to this is.

It would be nice to have official support for this particular request, but again, it appears discussion about this ticket has died, so I figured I'd post my findings for future developers.

#10 @SergeyBiryukov
6 years ago

  • Keywords subversion removed

Related: #16398, #16399, #16400, #16401

#11 @obenland
5 years ago

  • Keywords theme-editor added

#12 @ericlewis
3 years ago

  • Keywords needs-refresh added; has-patch theme-editor removed

Anyone still interested in this enhancement? We'll need a refreshed patch.

Note: See TracTickets for help on using tickets.