Friday, April 17, 2015

Upgrading a Very Old Wordpress and Dreamweaver 8 Crashing

So, I have been working on updating a very old WordPress install. It's on 2.8.5 and the current version is 4.1.
It was kind of a nightmare. All the plugins are old and no longer maintained. It was running on a very old version of PHP and MySQL.
I actually got it to run on an updated cPanel server, in a test environment on my server, using the various instructions for Moving Wordpress.

I had backups. I removed the outdated plugins.

Even before updating to WP 2.9.1 I started seeing errors in the Dashboard:
Warning: Creating default object from empty value in /home/client/public_html/testfolder/wp-admin/includes/post.php on line 345

This was due to the fact that I moved the blog to a new server that has updated version of PHP which has stricter standards of error reporting. These errors were coming from an old way of declaring objects in PHP that now threw error messages.

In versions of PHP greater than 5.4 you'd need to declare $post as an object of stdClass:
if (!isset($post))
$post = new stdClass();

before saying
$post->ID = 0;
or something like that. I am not going to monkey with the code because later versions of WP will account for this change in PHP 5.4.

I kept going, backing up the database and blowing away the files, and uploaded and updated to 3.1, then to 3.3, then to 3.5, then to 3.7 and then all the way, baby, to 4.11.

Note that I blew away the files besides wp-config.php, .htaccess, my /uploads folder, which I retained at each step. I read and followed the extended instructions for updating WordPress. I also updated the wp-config.php file as I went from version to version. Not doing this resulted in errors too, since later versions of Wordpress define more keys and salts in the config file than 2.8.5 did.

When I got to 3.3 I got a white dashboard in Wordpress (the White Dashboard of Death). The navigation bar was visible along the side, but the content of the page was blank. I looked at the html underlying the blank page and there was an error message:
Fatal error: Access to undeclared static property: WP_Screen::$this in testfolder/wp-admin/includes/screen.php on line 706
I got lucky with a Google search and found this page on StackExchange:
Which said
There is a bug in WordPress 3.3.1 causing the issue. It may affect other versions as well.
To solve the issue you can update WordPress to the current stable release and do integration testing afterwards. Or you can do a quick bug fix.
To fix the bug:
  1. Open file blog/wp-admin/includes/screen.php in your favorite text editor.
  2. On line 706 find the following PHP statement: <?php echo self::$this->_help_sidebar; ?>
  3. Replace it with the statement: <?php echo $this->_help_sidebar; ?>
  4. Save your changes.
I knew I was going to upgrade past 3.3 so, once I was satisfied that this fixed the problem, (and it did!) I backed up the db, blew away the files, and uploaded WP 3.5 files.

The "default object from empty value" error went away as I continued on, as I had thought it would.
Once I got past 3.3 I had no more error messages and no problems. It was just, clean up, back up, upload new files, and upgrade db over and over.

So now the Wordpress 2.8.5 blog is running a nice shiny new template on Wordpress 4.1.1

Dreamweaver 8 crashing on startup

Update: This has happened twice more since the events described below. This most recent event was caused by saving a Netsuite help page from Firefox into one of my site folders. Then when I opened DW, it scanned the folders and crashed. So I had to think about what the very most recent changes I had made to those folders. Removing the files fixed the problem.

The other thing that happened in the middle of this was that my editor, Dreamweaver 8, decided to take a crap on me in the middle of the day, yesterday. It crashed, which it sometimes does, but then I couldn't open it again. The splash screen would appear, and then close. Support threads advised that I delete my site cache folder in either the registry or in the configuration folder in AppData\Roaming\Macromedia\Dreamweaver8\Configuration\
and to delete or rename its WinFileCache
I tried that - renaming WinFileCache. No luck.
I didn't fancy blowing away all my site definitions and having to re-enter all the ftp information and file locations for all my sites.

I tried renaming that site in the site cache in the \Configuration\ folder, and in the registry to see if it was the corruption was in one of those spots. That worked, but then when I re-defined the site in the Manage Sites window, DW8 crashed again as soon as it started building a new site cache.
So now I was pretty sure from this, and the way it crashed immediately after I had downloaded a file, that it was a random bug with the contents of that file.

So, I tested by renaming the website folder that was last used. That worked. No crash.

So that told me that it was something in that folder. I tried removing files one by one, to see if I could find the corrupt file, starting with the most recently modified. But that got boring and didn't produce results, so, since I had backups of all the files in \testfolder I just deleted the whole thing.

Luckily, re-downloading the same damn files didn't make DW8 crash again.

No comments: