Skip to content
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

[5.4] Removed compiled class file generation #17003

Merged
merged 1 commit into from
Dec 27, 2016
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"php": ">=5.6.4",
"ext-mbstring": "*",
"ext-openssl": "*",
"classpreloader/classpreloader": "~3.0",
"doctrine/inflector": "~1.0",
"erusev/parsedown": "~1.6",
"league/flysystem": "~1.0",
Expand Down
7 changes: 0 additions & 7 deletions src/Illuminate/Contracts/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ public function booting($callback);
*/
public function booted($callback);

/**
* Get the path to the cached "compiled.php" file.
*
* @return string
*/
public function getCachedCompilePath();

/**
* Get the path to the cached services.php file.
*
Expand Down
10 changes: 0 additions & 10 deletions src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,16 +860,6 @@ public function getCachedRoutesPath()
return $this->bootstrapPath().'/cache/routes.php';
}

/**
* Get the path to the cached "compiled.php" file.
*
* @return string
*/
public function getCachedCompilePath()
{
return $this->bootstrapPath().'/cache/compiled.php';
}

/**
* Get the path to the cached services.php file.
*
Expand Down
4 changes: 0 additions & 4 deletions src/Illuminate/Foundation/ComposerScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ protected static function clearCompiled()
{
$laravel = new Application(getcwd());

if (file_exists($compiledPath = $laravel->getCachedCompilePath())) {
@unlink($compiledPath);
}

if (file_exists($servicesPath = $laravel->getCachedServicesPath())) {
@unlink($servicesPath);
}
Expand Down
7 changes: 1 addition & 6 deletions src/Illuminate/Foundation/Console/ClearCompiledCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@ class ClearCompiledCommand extends Command
*/
public function fire()
{
$compiledPath = $this->laravel->getCachedCompilePath();
$servicesPath = $this->laravel->getCachedServicesPath();

if (file_exists($compiledPath)) {
@unlink($compiledPath);
}

if (file_exists($servicesPath)) {
@unlink($servicesPath);
}

$this->info('The compiled class file has been removed.');
$this->info('The compiled services file has been removed.');
}
}
207 changes: 0 additions & 207 deletions src/Illuminate/Foundation/Console/Optimize/config.php

This file was deleted.

53 changes: 1 addition & 52 deletions src/Illuminate/Foundation/Console/OptimizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace Illuminate\Foundation\Console;

use ClassPreloader\Factory;
use Illuminate\Console\Command;
use Illuminate\Support\Composer;
use Symfony\Component\Console\Input\InputOption;
use ClassPreloader\Exceptions\VisitorExceptionInterface;

class OptimizeCommand extends Command
{
Expand Down Expand Up @@ -59,54 +57,7 @@ public function fire()
$this->composer->dumpOptimized();
}

if ($this->option('force') || ! $this->laravel['config']['app.debug']) {
$this->info('Compiling common classes');
$this->compileClasses();
} else {
$this->call('clear-compiled');
}
}

/**
* Generate the compiled class file.
*
* @return void
*/
protected function compileClasses()
{
$preloader = (new Factory)->create(['skip' => true]);

$handle = $preloader->prepareOutput($this->laravel->getCachedCompilePath());

foreach ($this->getClassFiles() as $file) {
try {
fwrite($handle, $preloader->getCode($file, false)."\n");
} catch (VisitorExceptionInterface $e) {
//
}
}

fclose($handle);
}

/**
* Get the classes that should be combined and compiled.
*
* @return array
*/
protected function getClassFiles()
{
$app = $this->laravel;

$core = require __DIR__.'/Optimize/config.php';

$files = array_merge($core, $app['config']->get('compile.files', []));

foreach ($app['config']->get('compile.providers', []) as $provider) {
$files = array_merge($files, forward_static_call([$provider, 'compiles']));
}

return array_map('realpath', $files);
$this->call('clear-compiled');
}

/**
Expand All @@ -117,8 +68,6 @@ protected function getClassFiles()
protected function getOptions()
{
return [
['force', null, InputOption::VALUE_NONE, 'Force the compiled class file to be written.'],

['psr', null, InputOption::VALUE_NONE, 'Do not optimize Composer dump-autoload.'],
];
}
Expand Down
1 change: 0 additions & 1 deletion src/Illuminate/Support/Facades/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* @method static void boot()
* @method static void booting(mixed $callback)
* @method static void booted(mixed $callback)
* @method static string getCachedCompilePath()
* @method static string getCachedServicesPath()
*
* @see \Illuminate\Foundation\Application
Expand Down