mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
rename TEMP_FOLDER to TEMP_PATH
This commit is contained in:
parent
313f8c7ac3
commit
3560a0418d
@ -6,7 +6,7 @@ SilverStripe\Core\Injector\Injector:
|
|||||||
class: 'SilverStripe\Core\Cache\DefaultCacheFactory'
|
class: 'SilverStripe\Core\Cache\DefaultCacheFactory'
|
||||||
constructor:
|
constructor:
|
||||||
args:
|
args:
|
||||||
directory: '`TEMP_FOLDER`'
|
directory: '`TEMP_PATH`'
|
||||||
version: null
|
version: null
|
||||||
logger: '%$Psr\Log\LoggerInterface'
|
logger: '%$Psr\Log\LoggerInterface'
|
||||||
Psr\SimpleCache\CacheInterface.cacheblock:
|
Psr\SimpleCache\CacheInterface.cacheblock:
|
||||||
|
@ -38,7 +38,7 @@ SilverStripe\Core\Injector\Injector:
|
|||||||
constructor:
|
constructor:
|
||||||
0: 'en'
|
0: 'en'
|
||||||
1: null
|
1: null
|
||||||
2: '`TEMP_FOLDER`'
|
2: '`TEMP_PATH`'
|
||||||
properties:
|
properties:
|
||||||
ConfigCacheFactory: '%$Symfony\Component\Config\ConfigCacheFactoryInterface'
|
ConfigCacheFactory: '%$Symfony\Component\Config\ConfigCacheFactoryInterface'
|
||||||
calls:
|
calls:
|
||||||
|
@ -84,7 +84,7 @@ tasks silently in the background.
|
|||||||
|
|
||||||
* Tries to locate an `.env`
|
* Tries to locate an `.env`
|
||||||
[configuration file](/getting_started/environment_management) in the webroot.
|
[configuration file](/getting_started/environment_management) in the webroot.
|
||||||
* Sets constants based on the filesystem structure (e.g. `BASE_URL`, `BASE_PATH` and `TEMP_FOLDER`)
|
* Sets constants based on the filesystem structure (e.g. `BASE_URL`, `BASE_PATH` and `TEMP_PATH`)
|
||||||
|
|
||||||
All requests go through `main.php`, which sets up the core [Kernel](api:SilverStripe\Core\Kernel) and [HTTPApplication](api:SilverStripe\Control\HTTPApplication)
|
All requests go through `main.php`, which sets up the core [Kernel](api:SilverStripe\Core\Kernel) and [HTTPApplication](api:SilverStripe\Control\HTTPApplication)
|
||||||
objects. See [/developer_guides/execution_pipeline/app_object_and_kernel] for details on this.
|
objects. See [/developer_guides/execution_pipeline/app_object_and_kernel] for details on this.
|
||||||
|
@ -65,6 +65,7 @@ guide developers in preparing existing 3.x code for compatibility with 4.0
|
|||||||
* Dependencies can managed via [recipe-plugin](https://github.com/silverstripe/recipe-plugin). See [recipe-core](https://github.com/silverstripe/recipe-core) and [recipe-cms](https://github.com/silverstripe/recipe-cms) as examples.
|
* Dependencies can managed via [recipe-plugin](https://github.com/silverstripe/recipe-plugin). See [recipe-core](https://github.com/silverstripe/recipe-core) and [recipe-cms](https://github.com/silverstripe/recipe-cms) as examples.
|
||||||
* Authentication has been upgraded to a modular approach using re-usable interfaces and easier to hook in to LoginHandlers.
|
* Authentication has been upgraded to a modular approach using re-usable interfaces and easier to hook in to LoginHandlers.
|
||||||
* Core modules are installed in the `vendor/` folder by default (other modules can opt-in, see [guide](/developer_guides/extending/how_tos/publish_a_module))
|
* Core modules are installed in the `vendor/` folder by default (other modules can opt-in, see [guide](/developer_guides/extending/how_tos/publish_a_module))
|
||||||
|
* Renamed constant for temp folder from `TEMP_FOLDER` to `TEMP_PATH` for naming consistency with other path variables and constants
|
||||||
|
|
||||||
## <a name="upgrading"></a>Upgrading
|
## <a name="upgrading"></a>Upgrading
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class ParameterConfirmationToken
|
|||||||
|
|
||||||
protected function pathForToken($token)
|
protected function pathForToken($token)
|
||||||
{
|
{
|
||||||
return TEMP_FOLDER.'/token_'.preg_replace('/[^a-z0-9]+/', '', $token);
|
return TEMP_PATH . DIRECTORY_SEPARATOR . 'token_'.preg_replace('/[^a-z0-9]+/', '', $token);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,7 +169,7 @@ class CsvBulkLoader extends BulkLoader
|
|||||||
*/
|
*/
|
||||||
protected function getNewSplitFileName()
|
protected function getNewSplitFileName()
|
||||||
{
|
{
|
||||||
return TEMP_FOLDER . DIRECTORY_SEPARATOR . uniqid(str_replace('\\', '_', static::class), true) . '.csv';
|
return TEMP_PATH . DIRECTORY_SEPARATOR . uniqid(str_replace('\\', '_', static::class), true) . '.csv';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,8 +196,9 @@ class DatabaseAdmin extends Controller
|
|||||||
*/
|
*/
|
||||||
public static function lastBuilt()
|
public static function lastBuilt()
|
||||||
{
|
{
|
||||||
$file = TEMP_FOLDER
|
$file = TEMP_PATH
|
||||||
. '/database-last-generated-'
|
. DIRECTORY_SEPARATOR
|
||||||
|
. 'database-last-generated-'
|
||||||
. str_replace(array('\\','/',':'), '.', Director::baseFolder());
|
. str_replace(array('\\','/',':'), '.', Director::baseFolder());
|
||||||
|
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
@ -371,8 +372,9 @@ class DatabaseAdmin extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
touch(TEMP_FOLDER
|
touch(TEMP_PATH
|
||||||
. '/database-last-generated-'
|
. DIRECTORY_SEPARATOR
|
||||||
|
. 'database-last-generated-'
|
||||||
. str_replace(array('\\', '/', ':'), '.', Director::baseFolder()));
|
. str_replace(array('\\', '/', ':'), '.', Director::baseFolder()));
|
||||||
|
|
||||||
if (isset($_REQUEST['from_installer'])) {
|
if (isset($_REQUEST['from_installer'])) {
|
||||||
|
@ -500,10 +500,10 @@ class SSViewer implements Flushable
|
|||||||
public static function flush_template_cache($force = false)
|
public static function flush_template_cache($force = false)
|
||||||
{
|
{
|
||||||
if (!self::$template_cache_flushed || $force) {
|
if (!self::$template_cache_flushed || $force) {
|
||||||
$dir = dir(TEMP_FOLDER);
|
$dir = dir(TEMP_PATH);
|
||||||
while (false !== ($file = $dir->read())) {
|
while (false !== ($file = $dir->read())) {
|
||||||
if (strstr($file, '.cache')) {
|
if (strstr($file, '.cache')) {
|
||||||
unlink(TEMP_FOLDER . '/' . $file);
|
unlink(TEMP_PATH . DIRECTORY_SEPARATOR . $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self::$template_cache_flushed = true;
|
self::$template_cache_flushed = true;
|
||||||
@ -626,7 +626,7 @@ class SSViewer implements Flushable
|
|||||||
|
|
||||||
$template = $this->chosen;
|
$template = $this->chosen;
|
||||||
|
|
||||||
$cacheFile = TEMP_FOLDER . "/.cache"
|
$cacheFile = TEMP_PATH . DIRECTORY_SEPARATOR . '.cache'
|
||||||
. str_replace(['\\','/',':'], '.', Director::makeRelative(realpath($template)));
|
. str_replace(['\\','/',':'], '.', Director::makeRelative(realpath($template)));
|
||||||
$lastEdited = filemtime($template);
|
$lastEdited = filemtime($template);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class SSViewer_FromString extends SSViewer
|
|||||||
public function process($item, $arguments = null, $scope = null)
|
public function process($item, $arguments = null, $scope = null)
|
||||||
{
|
{
|
||||||
$hash = sha1($this->content);
|
$hash = sha1($this->content);
|
||||||
$cacheFile = TEMP_FOLDER . "/.cache.$hash";
|
$cacheFile = TEMP_PATH . DIRECTORY_SEPARATOR . ".cache.$hash";
|
||||||
|
|
||||||
if (!file_exists($cacheFile) || isset($_GET['flush'])) {
|
if (!file_exists($cacheFile) || isset($_GET['flush'])) {
|
||||||
$content = $this->parseTemplateContent($this->content, "string sha1=$hash");
|
$content = $this->parseTemplateContent($this->content, "string sha1=$hash");
|
||||||
|
@ -63,7 +63,7 @@ class FlushInvalidatedResource implements SelfCheckingResourceInterface, \Serial
|
|||||||
*/
|
*/
|
||||||
protected static function canary()
|
protected static function canary()
|
||||||
{
|
{
|
||||||
return TEMP_FOLDER . '/catalog.i18n_canary';
|
return TEMP_PATH . DIRECTORY_SEPARATOR . 'catalog.i18n_canary';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,7 +15,7 @@ use SilverStripe\Core\TempFolder;
|
|||||||
* - BASE_URL: Full URL to the webroot, e.g. "http://my-host.com/my-webroot" (no trailing slash).
|
* - BASE_URL: Full URL to the webroot, e.g. "http://my-host.com/my-webroot" (no trailing slash).
|
||||||
* - BASE_PATH: Absolute path to the webroot, e.g. "/var/www/my-webroot" (no trailing slash).
|
* - BASE_PATH: Absolute path to the webroot, e.g. "/var/www/my-webroot" (no trailing slash).
|
||||||
* See Director::baseFolder(). Can be overwritten by Config::modify()->set(Director::class, 'alternate_base_folder', ).
|
* See Director::baseFolder(). Can be overwritten by Config::modify()->set(Director::class, 'alternate_base_folder', ).
|
||||||
* - TEMP_FOLDER: Absolute path to temporary folder, used for manifest and template caches. Example: "/var/tmp"
|
* - TEMP_PATH: Absolute path to temporary folder, used for manifest and template caches. Example: "/var/tmp"
|
||||||
* See getTempFolder(). No trailing slash.
|
* See getTempFolder(). No trailing slash.
|
||||||
* - ASSETS_DIR: Dir for assets folder. e.g. "assets"
|
* - ASSETS_DIR: Dir for assets folder. e.g. "assets"
|
||||||
* - ASSETS_PATH: Full path to assets folder. e.g. "/var/www/my-webroot/assets"
|
* - ASSETS_PATH: Full path to assets folder. e.g. "/var/www/my-webroot/assets"
|
||||||
@ -140,6 +140,15 @@ if (defined('CUSTOM_INCLUDE_PATH')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define the temporary folder if it wasn't defined yet
|
// Define the temporary folder if it wasn't defined yet
|
||||||
if (!defined('TEMP_FOLDER')) {
|
if (!defined('TEMP_PATH')) {
|
||||||
define('TEMP_FOLDER', TempFolder::getTempFolder(BASE_PATH));
|
if (defined('TEMP_FOLDER')) {
|
||||||
|
define('TEMP_PATH', TEMP_FOLDER);
|
||||||
|
} else {
|
||||||
|
define('TEMP_PATH', TempFolder::getTempFolder(BASE_PATH));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define the temporary folder for backwards compatibility
|
||||||
|
if (!defined('TEMP_FOLDER')) {
|
||||||
|
define('TEMP_FOLDER', TEMP_PATH);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ class DirectorTest extends SapphireTest
|
|||||||
public function testFileExists()
|
public function testFileExists()
|
||||||
{
|
{
|
||||||
$tempFileName = 'DirectorTest_testFileExists.tmp';
|
$tempFileName = 'DirectorTest_testFileExists.tmp';
|
||||||
$tempFilePath = TEMP_FOLDER . '/' . $tempFileName;
|
$tempFilePath = TEMP_PATH . DIRECTORY_SEPARATOR . $tempFileName;
|
||||||
|
|
||||||
// create temp file
|
// create temp file
|
||||||
file_put_contents($tempFilePath, '');
|
file_put_contents($tempFilePath, '');
|
||||||
|
@ -230,7 +230,7 @@ class InjectorTest extends SapphireTest
|
|||||||
'properties' => array(
|
'properties' => array(
|
||||||
'filters' => array(
|
'filters' => array(
|
||||||
'`BASE_PATH`',
|
'`BASE_PATH`',
|
||||||
'`TEMP_FOLDER`',
|
'`TEMP_PATH`',
|
||||||
'`NOT_DEFINED`',
|
'`NOT_DEFINED`',
|
||||||
'THIRDPARTY_DIR' // Not back-tick escaped
|
'THIRDPARTY_DIR' // Not back-tick escaped
|
||||||
)
|
)
|
||||||
@ -243,7 +243,7 @@ class InjectorTest extends SapphireTest
|
|||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
[
|
[
|
||||||
BASE_PATH,
|
BASE_PATH,
|
||||||
TEMP_FOLDER,
|
TEMP_PATH,
|
||||||
null,
|
null,
|
||||||
'THIRDPARTY_DIR',
|
'THIRDPARTY_DIR',
|
||||||
],
|
],
|
||||||
|
@ -79,7 +79,7 @@ require_once '$classpath';
|
|||||||
$src .= "->execute();";
|
$src .= "->execute();";
|
||||||
|
|
||||||
// Now stick it in a temporary file & run it
|
// Now stick it in a temporary file & run it
|
||||||
$codepath = TEMP_FOLDER . '/ErrorControlChainTest_' . sha1($src) . '.php';
|
$codepath = TEMP_PATH . DIRECTORY_SEPARATOR . 'ErrorControlChainTest_' . sha1($src) . '.php';
|
||||||
|
|
||||||
if ($includeStderr) {
|
if ($includeStderr) {
|
||||||
$null = '&1';
|
$null = '&1';
|
||||||
|
@ -1689,7 +1689,7 @@ after'
|
|||||||
// as protocol-less absolute urls
|
// as protocol-less absolute urls
|
||||||
$base = Convert::raw2att('/file.com?foo"onclick="alert(\'xss\')""');
|
$base = Convert::raw2att('/file.com?foo"onclick="alert(\'xss\')""');
|
||||||
|
|
||||||
$tmplFile = TEMP_FOLDER . '/SSViewerTest_testRewriteHashlinks_' . sha1(rand()) . '.ss';
|
$tmplFile = TEMP_PATH . DIRECTORY_SEPARATOR . 'SSViewerTest_testRewriteHashlinks_' . sha1(rand()) . '.ss';
|
||||||
|
|
||||||
// Note: SSViewer_FromString doesn't rewrite hash links.
|
// Note: SSViewer_FromString doesn't rewrite hash links.
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
@ -1746,7 +1746,7 @@ after'
|
|||||||
{
|
{
|
||||||
SSViewer::setRewriteHashLinksDefault('php');
|
SSViewer::setRewriteHashLinksDefault('php');
|
||||||
|
|
||||||
$tmplFile = TEMP_FOLDER . '/SSViewerTest_testRewriteHashlinksInPhpMode_' . sha1(rand()) . '.ss';
|
$tmplFile = TEMP_PATH . DIRECTORY_SEPARATOR . 'SSViewerTest_testRewriteHashlinksInPhpMode_' . sha1(rand()) . '.ss';
|
||||||
|
|
||||||
// Note: SSViewer_FromString doesn't rewrite hash links.
|
// Note: SSViewer_FromString doesn't rewrite hash links.
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
@ -2060,7 +2060,7 @@ EOC;
|
|||||||
public function testFromStringCaching()
|
public function testFromStringCaching()
|
||||||
{
|
{
|
||||||
$content = 'Test content';
|
$content = 'Test content';
|
||||||
$cacheFile = TEMP_FOLDER . '/.cache.' . sha1($content);
|
$cacheFile = TEMP_PATH . DIRECTORY_SEPARATOR . '.cache.' . sha1($content);
|
||||||
if (file_exists($cacheFile)) {
|
if (file_exists($cacheFile)) {
|
||||||
unlink($cacheFile);
|
unlink($cacheFile);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class i18nTextCollectorTest extends SapphireTest
|
|||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->setupManifest();
|
$this->setupManifest();
|
||||||
|
|
||||||
$this->alternateBaseSavePath = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'i18nTextCollectorTest_webroot';
|
$this->alternateBaseSavePath = TEMP_PATH . DIRECTORY_SEPARATOR . 'i18nTextCollectorTest_webroot';
|
||||||
Filesystem::makeFolder($this->alternateBaseSavePath);
|
Filesystem::makeFolder($this->alternateBaseSavePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user