diff --git a/.gitignore b/.gitignore index 18b49534..4f7d0124 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ storage/*.sqlite storage/oauth-public.key storage/oauth-private.key storage/install.lock +storage/options.php .phpunit.result.cache .php_cs.cache resources/views/overrides diff --git a/app/Console/Commands/OptionsCacheCommand.php b/app/Console/Commands/OptionsCacheCommand.php index db5eadc4..5a13108b 100644 --- a/app/Console/Commands/OptionsCacheCommand.php +++ b/app/Console/Commands/OptionsCacheCommand.php @@ -15,12 +15,13 @@ class OptionsCacheCommand extends Command public function handle(Filesystem $filesystem, Application $app) { - $path = storage_path('options/cache.php'); + $path = storage_path('options.php'); $filesystem->delete($path); $app->forgetInstance(Option::class); $content = var_export(resolve(Option::class)->all(), true); - $content = 'put($path, $content); $this->info('Options cached successfully.'); } diff --git a/app/Http/Controllers/UpdateController.php b/app/Http/Controllers/UpdateController.php index 3e6ea425..f3682e55 100644 --- a/app/Http/Controllers/UpdateController.php +++ b/app/Http/Controllers/UpdateController.php @@ -56,7 +56,7 @@ class UpdateController extends Controller $package->download($this->info['url'], $path)->extract(base_path()); // Delete options cache. This allows us to update the version info which is recorded as an option. - $filesystem->delete(storage_path('options/cache.php')); + $filesystem->delete(storage_path('options.php')); return json(trans('admin.update.complete'), 0); } catch (Exception $e) { diff --git a/app/Services/Option.php b/app/Services/Option.php index 05c65523..b0a9e5fa 100644 --- a/app/Services/Option.php +++ b/app/Services/Option.php @@ -13,7 +13,7 @@ class Option public function __construct(Filesystem $filesystem) { - $cachePath = storage_path('options/cache.php'); + $cachePath = storage_path('options.php'); if ($filesystem->exists($cachePath)) { $this->items = collect($filesystem->getRequire($cachePath)); diff --git a/storage/options/.gitignore b/storage/options/.gitignore deleted file mode 100644 index d6b7ef32..00000000 --- a/storage/options/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/tests/CommandsTest/OptionsCacheCommandTest.php b/tests/CommandsTest/OptionsCacheCommandTest.php index 68dc2955..54c73075 100644 --- a/tests/CommandsTest/OptionsCacheCommandTest.php +++ b/tests/CommandsTest/OptionsCacheCommandTest.php @@ -11,11 +11,11 @@ class OptionsCacheCommandTest extends TestCase { $this->mock(Filesystem::class, function ($mock) { $mock->shouldReceive('exists')->andReturn(false); - $mock->shouldReceive('delete')->with(storage_path('options/cache.php'))->once(); + $mock->shouldReceive('delete')->with(storage_path('options.php'))->once(); $mock->shouldReceive('put') ->withArgs(function ($path, $content) { - $this->assertEquals(storage_path('options/cache.php'), $path); - $this->assertTrue(Str::startsWith($content, 'assertEquals(storage_path('options.php'), $path); + $this->assertTrue(Str::startsWith($content, 'assertTrue(Str::endsWith($content, ';')); return true; diff --git a/tests/HttpTest/ControllersTest/UpdateControllerTest.php b/tests/HttpTest/ControllersTest/UpdateControllerTest.php index 0d96492d..4f2c108e 100644 --- a/tests/HttpTest/ControllersTest/UpdateControllerTest.php +++ b/tests/HttpTest/ControllersTest/UpdateControllerTest.php @@ -93,7 +93,7 @@ class UpdateControllerTest extends TestCase $mock->shouldReceive('progress'); }); $this->mock(\Illuminate\Filesystem\Filesystem::class, function ($mock) { - $mock->shouldReceive('delete')->with(storage_path('options/cache.php'))->once(); + $mock->shouldReceive('delete')->with(storage_path('options.php'))->once(); $mock->shouldReceive('exists')->with(storage_path('install.lock'))->andReturn(true); }); $this->getJson('/admin/update/download?action=download') diff --git a/tests/ServicesTest/OptionTest.php b/tests/ServicesTest/OptionTest.php index 512aadf8..505cd687 100644 --- a/tests/ServicesTest/OptionTest.php +++ b/tests/ServicesTest/OptionTest.php @@ -31,7 +31,7 @@ class OptionTest extends TestCase public function testReadFromCache() { $this->mock(\Illuminate\Filesystem\Filesystem::class, function ($mock) { - $path = storage_path('options/cache.php'); + $path = storage_path('options.php'); $mock->shouldReceive('exists')->with($path)->once()->andReturn(true); $mock->shouldReceive('getRequire')->with($path)->once()->andReturn(['k' => 'v']); });