cotech/website

Oops we broke the site

chriscroome opened this issue · 8 comments

The live and dev sites are generating errors, for the dev site we have this in the Apache error logs when you try to load the front page:

PHP Warning:  require_once(/home/cotechdev/sites/vendor/autoload.php): failed to open stream: No such file or directory in /home/cotechdev/sites/web/wp-config.php on line 7

And line 7 of wp-config.php is:

require_once(dirname(__DIR__) . '/vendor/autoload.php');

And this file is here:

pwd
/home/cotechdev/sites/web
find ./ -name autoload.php
./app/plugins/posts-to-posts/vendor/scribu/lib-posts-to-posts/autoload.php
./app/themes/coop-tech-oowp-theme/vendor/autoload.php

Anyone have any suggestions regarding fixing this?

The cron job that runs this script to which @nicksellen added:

 # Remove any untracked files/directories
git clean -fd

Looks like it might have caused this:

Date: Thu, 30 Nov 2017 16:23:02 +0000
From: Cron Daemon <root@webarch1.co.uk>
To: cotechdev@webarch1.co.uk
Subject: Cron <cotechdev@webarch1> /home/cotechdev/bin/cron

Removing vendor/

So removing git clean -fd and running the update script fixed the sites.

Oops! Anything that is needed should either be in the repo, or in a .gitignore entry. I'll make a PR :)

Oh, it's already in there. Running git clean -fd locally does not remove the vendor directory :/

That's weird, why would it happen on the server?

That's weird, why would it happen on the server?

I don't know, I would have to poke around on the server I think...

Seems it was a bug in git that was fixed in version 2.13.2 (debian stretch is on 2.11.0):

  • "git clean -d" used to clean directories that has ignored files,
    even though the command should not lose ignored ones without "-x".
    "git status --ignored" did not list ignored and untracked files
    without "-uall". These have been corrected.

https://github.com/git/git/blob/e629a7d28a405e48fae6b064a781a10e885159fc/Documentation/RelNotes/2.13.2.txt#L24-L27

Thanks for finding that 😃.