Some of it was even commented out incorrectly (PHP code commented out with HTML comments). There was an awful lot of commented code. This drastically reduced the size of the repository. I therefore took the vendor folder out of Git, and added zendframework/zendframework1 as a dependency. The vendor/ directory was also checked into version control. The project was using Composer, but only to a limited degree - the framework itself was in the library/ folder, and several other dependencies were also stored here. Using that, it was straightforward to start adding migrations to make any necessary changes to the database structure and fixtures. I therefore did some research and wound up stumbling across Phinx, which is a standalone migration package with a command-line runner. Unfortunately, Zend 1 doesn't include migrations, and no-one had added a third party solution. The next job involved making some changes to the database. I used this post as a guide, and it was pretty straightforward, but took all of my first day. When I first started working on the project, the repository was in Subversion, and was absolutely colossal - checking it out took two hours! Needless to say, my first action was to migrate it to Git. I've also found Sourcemaking to be a useful resource in identifying antipatterns in use, refactoring strategies, and applicable design patterns. In working with this legacy project, I've found Paul Jones' book Modernizing Legacy Applications in PHP to be very useful, and if you're working on a similar legacy project, I highly recommend investing in a copy. Not all of them are complete as at time of writing, but they've all helped to make this decidedly crappy project somewhat better.
In this article I'll go through some of the steps I've taken to help bring this legacy project under control. It's a fairly typical example of a project built on an older MVC framework by inexperienced developers (I've been responsible for building similar things in my CodeIgniter days). It has to be said, it's the worst code base I have ever seen, with textbook examples of many antipatterns, spaghetti jQuery, copy-pasted code and overly complex methods. In my current job I've been maintaining and developing a Zend 1 legacy project for the best part of a year.
How I'm refactoring a Zend 1 legacy project