6

I have a Wordpress blog hosted on a server without outgoing network. Therefore, Wordpress cannot check for a new version and/or update automatically to a new version.

Currently, the only ways I'm aware of to update the blog to a new version of WP is to follow the complicated guide here, or to copy it to another host (with outgoing network), update it, and copy it back. Both ways are very complicated.

I'm looking for a way to use the automatic updater of WP without requiring outgoing network on the host. Basically, I'd like to upload wordpress-4.3.1.zip via FTP, go to the admin panel, and choose "update from zip file: wordpress-4.3.1.zip". Is there such an option, or a plugin that can help me achieve that?

Edit: Note that I don't have access to run arbitrary code on the server. Basically, I have PHP, MySQL, FTP, and that's it.

3 Answers 3

6

As so often, WP-CLI already has you covered:

wp core update --version=3.8 ../latest.zip

Have a look here for more details: http://wp-cli.org/commands/core/update/

5
  • Though I's suggested WP-CLI too, till not used, but it's the best option I guess. Commented Sep 23, 2015 at 11:14
  • Looks promising, but I'm using a shared server, which is quite limited. WP-CLI seems to be a binary, and I don't have access to run arbitrary code on the server. Basically, I have PHP, MySQL, FTP, and that's it.
    – Paul
    Commented Sep 23, 2015 at 20:29
  • It isn't a binary. You just need php-cli. Have you read requirements here? wp-cli.org
    – kraftner
    Commented Sep 24, 2015 at 8:55
  • @kraftner Well, wp-cli.phar is a binary file. Yes, I tried to follow the instructions. I have no command line access to the (shared) hosting, so I can't proceed much. As noted, all I have is PHP, MySQL and FTP. Ho command line or similar. Which ones of the install methods could I use?
    – Paul
    Commented Sep 24, 2015 at 9:45
  • Okay then you probably are out of luck. (I'd personally consider switching host if they do not offer any command line) In theory you could check out WP-CLI from github, upload the files and call them via a php script. But I have never tried that.
    – kraftner
    Commented Sep 24, 2015 at 10:51
1

I often do Manual Update, it's not that pain. :)

Just do it in this way (I hope you know how to update manually):

Step 1: Remove wp-includes, and wp-admin from Server and Upload new two
Step 2: Cut/Copy all the loose files from local folder and Paste them to the server root with Overwrite permission - Just a replace

And you are done. :)

Optional Step 1: In wp-content/themes/ Delete default Theme folders and upload the latest folders, if you use them.
Optional Step 2: In wp-content/plugins/ Delete "Akismet" folder, and upload latest "Akismet" if you use this.

P.S.: Don't delete wp-content, .htaccess, wp-config.php, robots.txt etc.

3
  • 1
    You can just copy over the whole wordpress folder as is without any problems :-) Commented Sep 23, 2015 at 10:59
  • 3
    Another problem with this approach is that it's much slower to upload many small files via FTP than to upload a single zip file and decompress it locally. At this time, the blog is going to be in an inconsistent state. Therefore, I'd rather use the mechanism which updates from zip. An alternative is to write a script which does the operations you listed, but WP already has this functionality built in, just with the zip downloading. I want to be able to use it on a local zip file.
    – Paul
    Commented Sep 23, 2015 at 11:05
  • @PieterGoosen never tried. But sounds cool. :) Commented Sep 23, 2015 at 11:17
0

Here's how it can be done, by temporarily making a minor fixup to the WP code:

  1. Upload the zip file to the root folder of WP, in the same folder as wp-config.php and friends.
  2. Open the file wp-admin\includes\update.php.
  3. Find the function find_core_update, and change it to:

    function find_core_update( $version, $locale ) {
        $updates = get_core_updates();
        return $updates[0];
    }
    
  4. Find the function get_core_updates, and change it to:

    function get_core_updates( $options = array() ) {
        $new_zip = 'wordpress-4.3.1.zip';
        $new_version = '4.3.1';
        return array((object)array(
            'response'      => 'upgrade',
            'current'       => $new_version,
            'download'      => '../' . $new_zip,
            'packages'      => (object) array (
                                'partial' => null,
                                'new_bundled' => null,
                                'no_content' => null,
                                'full' => '../' . $new_zip,
                            ),
            'version' => $new_version,
            'locale' => null
        ));
    }
    

    Set the $new_zip, $new_version variables as needed.

  5. Go to the admin panel and run the update!

2
  • Hacking core files...
    – kraftner
    Commented Sep 24, 2015 at 8:56
  • @kraftner Well, after running the update, the file will get overwritten by the new version, which means that the modification is very temporary. I'd very much prefer a plugin or some other solution, but it seems like there's no other solution to this, considering the fact that I cannot install WP-CLI. If you have a better solution, post an answer, and if it works, I'll be thankful and will accept it.
    – Paul
    Commented Sep 24, 2015 at 9:38

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.