Skip to content

[5.1+] Fallback for "clear-compiled" command when vendors not yet installed #3694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions artisan
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#!/usr/bin/env php
<?php

$bootstrapPath = __DIR__.'/bootstrap';

/*
Composer may call "clear-compiled" before installing the autoloader for
the first time. In this particular case, we'll try to do the cleanup
here, then exit as artisan won't be able to continue nevertheless.
*/
if (isset($argv[1]) && $argv[1] == 'clear-compiled' && ! file_exists(__DIR__.'/vendor/autoload.php')) {
@unlink($bootstrapPath.'/cache/compiled.php');
@unlink($bootstrapPath.'/cache/services.json');
exit;
}

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
Expand All @@ -13,9 +26,9 @@
|
*/

require __DIR__.'/bootstrap/autoload.php';
require $bootstrapPath.'/autoload.php';

$app = require_once __DIR__.'/bootstrap/app.php';
$app = require_once $bootstrapPath.'/app.php';

/*
|--------------------------------------------------------------------------
Expand Down