Update directory structure & allow to configure paths (tmp, log, cache)

This commit is contained in:
Nicolas Le Goff
2014-09-05 11:28:25 +02:00
parent 69fd50906f
commit de7988689e
2201 changed files with 850 additions and 13650 deletions

View File

@@ -89,7 +89,7 @@ class patch_370alpha7a extends patchAbstract
$i = 0;
foreach ($rs as $row) {
$filePath = $app['root.path'] . '/tmp/lazaret/' . $row['filepath'];
$filePath = $app['tmp.lazaret.path'].'/'.$row['filepath'];
if (null === $user = $this->loadUser($app['EM'], $row['usr_id'])) {
continue;
}
@@ -100,7 +100,7 @@ class patch_370alpha7a extends patchAbstract
$spec->setResizeMode(ImageSpec::RESIZE_MODE_INBOUND_FIXEDRATIO);
$spec->setDimensions(375, 275);
$thumbPath = $app['root.path'] . '/tmp/lazaret/' . sprintf("thumb_%s", $row['filepath']);
$thumbPath = $app['tmp.lazaret.path'].'/'.sprintf("thumb_%s", $row['filepath']);
try {
$app['media-alchemyst']->turnInto($filePath, $thumbPath, $spec);

View File

@@ -63,11 +63,11 @@ class patch_380alpha16a extends patchAbstract
}
$xsendfile['mapping'][] = [
'directory' => $app['root.path'] . '/tmp/lazaret/',
'directory' => $app['tmp.lazaret.path'],
'mount-point' => '/lazaret/',
];
$xsendfile['mapping'][] = [
'directory' => $app['root.path'] . '/tmp/download/',
'directory' => $app['tmp.download.path'],
'mount-point' => '/download/',
];

View File

@@ -0,0 +1,100 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
class patch_390alpha19a extends patchAbstract
{
/** @var string */
private $release = '3.9.0-alpha.19';
/** @var array */
private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$storage = $app['conf']->get(['main', 'storage']);
$storage['cache'] = $app['root.path'].'/cache';
$storage['log'] = $app['root.path'].'/logs';
$storage['download'] = $app['root.path'].'/tmp/download';
$storage['lazaret'] = $app['root.path'].'/tmp/lazaret';
$storage['caption'] = $app['root.path'].'/tmp/caption';
$app['conf']->set(['main', 'storage'], $storage);
// update file structure
$this->removeDirectory($app, $app['root.path'].'/tmp/cache_twig');
$this->removeDirectory($app, $app['root.path'].'/tmp/doctrine');
$this->removeDirectory($app, $app['root.path'].'/tmp/profiler');
$this->removeDirectory($app, $app['root.path'].'/tmp/serializer');
$this->removeDirectory($app, $app['root.path'].'/tmp/translations');
$this->removeDirectory($app, $app['root.path'].'/tmp/cache_minify');
$this->removeDirectory($app, $app['root.path'].'/features');
$this->removeDirectory($app, $app['root.path'].'/hudson');
$this->removeDirectory($app, $app['root.path'].'/locales');
$this->removeDirectory($app, $app['root.path'].'/vagrant');
$this->removeDirectory($app, $app['root.path'].'/tmp/doctrine-proxies');
$this->copyFile($app, $app['root.path'].'/tmp/cache_registry.php', $app['cache.path'].'/cache_registry.php');
$this->copyFile($app, $app['root.path'].'/tmp/configuration-compiled.php', $app['root.path'].'/config/configuration-compiled.php');
return true;
}
private function removeDirectory(Application $app, $originDir)
{
if (is_dir($originDir)) {
$app['filesystem']->remove($originDir);
}
}
private function copyFile(Application $app, $originFile, $targetFile)
{
if ($app['filesystem']->exists($originFile)) {
$app['filesystem']->copy($originFile, $targetFile);
}
}
}

View File

@@ -165,7 +165,7 @@ class patch_390alpha9b extends patchAbstract
'GV_smtp_secure' => ['registry', 'email', 'smtp-secure-mode'],
'GV_smtp_user' => ['registry', 'email', 'smtp-user'],
'GV_smtp_password' => ['registry', 'email', 'smtp-password'],
'GV_base_datapath_noweb' => ['main', 'storage', 'subdefs', 'default-dir'],
'GV_base_datapath_noweb' => ['main', 'storage', 'subdefs'],
'GV_youtube_api' => ['main', 'bridge', 'youtube', 'enabled'],
'GV_youtube_client_id' => ['main', 'bridge', 'youtube', 'client_id'],
'GV_youtube_client_secret' => ['main', 'bridge', 'youtube', 'client_secret'],