mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Use locator instead of CACHE_DIR
This commit is contained in:
parent
ecf51536b9
commit
cd31d41b07
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
namespace Grav\Common\File;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use RocketTheme\Toolbox\File\PhpFile;
|
||||
|
||||
/**
|
||||
|
|
@ -28,7 +29,8 @@ trait CompiledFile
|
|||
// If nothing has been loaded, attempt to get pre-compiled version of the file first.
|
||||
if ($var === null && $this->raw === null && $this->content === null) {
|
||||
$key = md5($this->filename);
|
||||
$file = PhpFile::instance(CACHE_DIR . "compiled/files/{$key}{$this->extension}.php");
|
||||
$cache_dir = Grav::instance()['locator']->findResource('cache://', true);
|
||||
$file = PhpFile::instance($cache_dir . "compiled/files/{$key}{$this->extension}.php");
|
||||
$modified = $this->modified();
|
||||
|
||||
if (!$modified) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
namespace Grav\Common\GPM;
|
||||
|
||||
use Grav\Common\Filesystem\Folder;
|
||||
use Grav\Common\Grav;
|
||||
|
||||
class Installer
|
||||
{
|
||||
|
|
@ -80,7 +81,8 @@ class Installer
|
|||
|
||||
$zip = new \ZipArchive();
|
||||
$archive = $zip->open($package);
|
||||
$tmp = CACHE_DIR . 'tmp/Grav-' . uniqid();
|
||||
$cache_dir = Grav::instance()['locator']->findResource('cache://', true);
|
||||
$tmp = $cache_dir . 'tmp/Grav-' . uniqid();
|
||||
|
||||
if ($archive !== true) {
|
||||
self::$error = self::ZIP_OPEN_ERROR;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use Grav\Common\GPM\GPM;
|
|||
use Grav\Common\GPM\Installer;
|
||||
use Grav\Common\GPM\Response;
|
||||
use Grav\Common\GPM\Remote\Package as Package;
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Utils;
|
||||
use Grav\Console\ConsoleCommand;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
|
@ -530,7 +531,8 @@ class InstallCommand extends ConsoleCommand
|
|||
*/
|
||||
private function downloadPackage($package)
|
||||
{
|
||||
$this->tmp = CACHE_DIR . DS . 'tmp/Grav-' . uniqid();
|
||||
$cache_dir = Grav::instance()['locator']->findResource('cache://', true);
|
||||
$this->tmp = $cache_dir . DS . 'tmp/Grav-' . uniqid();
|
||||
$filename = $package->slug . basename($package->zipball_url);
|
||||
$output = Response::get($package->zipball_url, [], [$this, 'progress']);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use Grav\Common\Filesystem\Folder;
|
|||
use Grav\Common\GPM\Installer;
|
||||
use Grav\Common\GPM\Response;
|
||||
use Grav\Common\GPM\Upgrader;
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Console\ConsoleCommand;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
|
@ -173,7 +174,8 @@ class SelfupgradeCommand extends ConsoleCommand
|
|||
*/
|
||||
private function download($package)
|
||||
{
|
||||
$this->tmp = CACHE_DIR . DS . 'tmp/Grav-' . uniqid();
|
||||
$cache_dir = Grav::instance()['locator']->findResource('cache://', true);
|
||||
$this->tmp = $cache_dir . DS . 'tmp/Grav-' . uniqid();
|
||||
$output = Response::get($package['download'], [], [$this, 'progress']);
|
||||
|
||||
Folder::mkdir($this->tmp);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user