Merge pull request #1063 from nlegoff/phras-55

[3.8] PHRAS-55 Rename status icon filename
This commit is contained in:
Nicolas Le Goff
2014-04-23 14:46:39 +02:00
3 changed files with 81 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core;
*/
class Version
{
protected static $number = '3.8.4-alpha.1';
protected static $number = '3.8.4-alpha.2';
protected static $name = 'Diplodocus';
public static function getNumber()

View File

@@ -69,8 +69,14 @@ class databox_status
return;
}
$path = $this->path = $app['root.path'] . "/config/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]);
$url = $this->url = "/custom/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]);
$uniqid = md5(implode('-', array(
$sbas_params[$sbas_id]["host"],
$sbas_params[$sbas_id]["port"],
$sbas_params[$sbas_id]["dbname"]
)));
$path = $this->path = $app['root.path'] . "/config/status/" . $uniqid;
$url = $this->url = "/custom/status/" . $uniqid;
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
$xmlpref = $databox->get_structure();

View File

@@ -0,0 +1,72 @@
<?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;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
class patch_384alpha2a implements patchInterface
{
/** @var string */
private $release = '3.8.4-alpha.2';
/** @var array */
private $concern = array(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 apply(base $appbox, Application $app)
{
$finder = new Finder();
$fs = new Filesystem();
foreach ($finder->files()->in($app['root.path'].'/config/status') as $file) {
if (!$file->isFile()) {
continue;
}
$fileName = $file->getFileName();
$chunks = explode('-', $fileName);
if (count($chunks) < 4) {
continue;
}
$suffix = array_pop($chunks);
$uniqid = md5(implode('-', $chunks));
$fs->rename($file->getRealPath(), $app['root.path'].'/config/status/' . $uniqid . '-' . $suffix);
}
}
}