I'm using phantomjs via an extension to save a screenshot into an EE file directory, but before it's accessible in the admin area, I need to synchronise files.

I can't see anything in the docs for how to go about this, does anyone know if this is possible?

2 Answers 2


Take a look at line 1187 in system/expressionengine/controllers/cp/content_files.php. The function do_sync_files() is called by the synchronize page. This would be in the EE 2.8.1 core files.

You could probably write a script that calls that function or else re write the logic for your own use (I think it checks a bunch of environment variables that would not let it work from the command line).

  • Hmm I attempted the following in an extension: $cp_path = APPPATH.'controllers/cp/'; include_once($cp_path.'content_files.php'); $this->EE->load->add_package_path($cp_path); $cp_files = new Content_files(); which resulted in: Message: Undefined property: Content_files::$core Filename: core/EE_Controller.php Line Number: 33 Not sure if I'm missing something there, but I fear I may have to rewrite it somewhat. I've got things of higher priority than this at the moment, so I'll hold off trying that for the time being.
    – Jammooka
    Apr 30, 2014 at 16:09

Did you ever get the code for auto sync working? I am in need of the same functionality and would rather not reinvent the wheel.

  • I'm afraid not, no. As it happened I didn't need the client to actually access the image itself as it was part of a larger project, so I was able to just access the URL.
    – Jammooka
    Mar 15, 2015 at 23:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.