Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

Commit

Permalink
support laravel4.1.x #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Che Kun committed Jan 21, 2014
1 parent 8c72f1a commit 24dcb5c
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/Lavender/Cloud/Sina/Patcher/Commands/Patch.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Patch extends Command {
*
* @var string
*/
protected $description = "Optimize the framework for better performance";
protected $description = "Patch files for laravel4 to run on SAE.";

/**
* Files need to Patch
Expand All @@ -27,6 +27,14 @@ class Patch extends Command {
'vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php'
);

/**
* Replace files
* @var array
*/
private $replaceFiles = array(
'vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php' => 'vendor/chekun/laravel4sae/src/Lavender/Cloud/Sina/Patcher/Foundation/ProviderRepository.php',
);

public function fire()
{
$this->call('dump');
Expand All @@ -39,13 +47,25 @@ public function fire()

$code = file_get_contents($file);

$code = str_replace('ini_set', '@ini_set', $code);
if (strpos($code, '@ini_set') === false) {

$code = str_replace('ini_set', '@ini_set', $code);

}

file_put_contents($file, $code);

}

foreach ($this->replaceFiles as $file => $replacedFile) {

@unlink($file);

@copy($replacedFile, $file);

}


}

}
}

0 comments on commit 24dcb5c

Please sign in to comment.