mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 19:43:16 +00:00
Remove Unnecessary SplFileObject's
This commit is contained in:
@@ -39,8 +39,8 @@ return call_user_func(function() {
|
|||||||
|
|
||||||
$app['upgrade'] = true;
|
$app['upgrade'] = true;
|
||||||
} elseif (\setup::needUpgradeConfigurationFile()) {
|
} elseif (\setup::needUpgradeConfigurationFile()) {
|
||||||
$connexionInc = new \SplFileObject(__DIR__ . '/../../../../config/connexion.inc');
|
$connexionInc = new \SplFileInfo(__DIR__ . '/../../../../config/connexion.inc', true);
|
||||||
$configInc = new \SplFileObject(__DIR__ . '/../../../../config/config.inc');
|
$configInc = new \SplFileInfo(__DIR__ . '/../../../../config/config.inc', true);
|
||||||
|
|
||||||
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||||
$configuration->upgradeFromOldConf($configInc, $connexionInc);
|
$configuration->upgradeFromOldConf($configInc, $connexionInc);
|
||||||
|
@@ -11,8 +11,9 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea\Cache;
|
namespace Alchemy\Phrasea\Cache;
|
||||||
|
|
||||||
use \Alchemy\Phrasea\Core\Service\Builder,
|
use Symfony\Component\HttpFoundation\File\File as SymfoFile;
|
||||||
\Alchemy\Phrasea\Core;
|
use Alchemy\Phrasea\Core\Service\Builder;
|
||||||
|
use Alchemy\Phrasea\Core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -23,7 +24,7 @@ class Manager
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var \SplFileObject
|
* @var \SplFileInfo
|
||||||
*/
|
*/
|
||||||
protected $cacheFile;
|
protected $cacheFile;
|
||||||
protected $core;
|
protected $core;
|
||||||
@@ -40,7 +41,7 @@ class Manager
|
|||||||
*/
|
*/
|
||||||
protected $registry = array();
|
protected $registry = array();
|
||||||
|
|
||||||
public function __construct(Core $core, \SplFileObject $file)
|
public function __construct(Core $core, \SplFileInfo $file)
|
||||||
{
|
{
|
||||||
$this->cacheFile = $file;
|
$this->cacheFile = $file;
|
||||||
$this->parser = new \Symfony\Component\Yaml\Yaml();
|
$this->parser = new \Symfony\Component\Yaml\Yaml();
|
||||||
|
@@ -91,7 +91,7 @@ class Core extends \Pimple
|
|||||||
touch(__DIR__ . '/../../../tmp/cache_registry.yml');
|
touch(__DIR__ . '/../../../tmp/cache_registry.yml');
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = new \SplFileObject(__DIR__ . '/../../../tmp/cache_registry.yml');
|
$file = new \SplFileInfo(__DIR__ . '/../../../tmp/cache_registry.yml');
|
||||||
|
|
||||||
return new \Alchemy\Phrasea\Cache\Manager($core, $file);
|
return new \Alchemy\Phrasea\Cache\Manager($core, $file);
|
||||||
});
|
});
|
||||||
|
@@ -72,11 +72,11 @@ class Configuration
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upgradeFromOldConf(\SplFileObject $configInc, \SplFileObject $connexionInc)
|
public function upgradeFromOldConf(\SplFileInfo $configInc, \SplFileInfo $connexionInc)
|
||||||
{
|
{
|
||||||
$this->initialize();
|
$this->initialize();
|
||||||
|
|
||||||
$retrieve_old_credentials = function(\SplFileObject $connexionInc) {
|
$retrieve_old_credentials = function(\SplFileInfo $connexionInc) {
|
||||||
require $connexionInc->getPathname();
|
require $connexionInc->getPathname();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
@@ -102,7 +102,7 @@ class Configuration
|
|||||||
|
|
||||||
$configs = $this->getConfigurations();
|
$configs = $this->getConfigurations();
|
||||||
|
|
||||||
$retrieve_old_parameters = function(\SplFileObject $configInc) {
|
$retrieve_old_parameters = function(\SplFileInfo $configInc) {
|
||||||
require $configInc->getPathname();
|
require $configInc->getPathname();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
@@ -70,17 +70,17 @@ class ApplicationSpecification implements Specification
|
|||||||
|
|
||||||
protected function getConfigurationsFile()
|
protected function getConfigurationsFile()
|
||||||
{
|
{
|
||||||
return new \SplFileObject($this->getConfigurationsPathFile());
|
return new \SplFileInfo($this->getConfigurationsPathFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getConnexionsFile()
|
protected function getConnexionsFile()
|
||||||
{
|
{
|
||||||
return new \SplFileObject($this->getConnexionsPathFile());
|
return new \SplFileInfo($this->getConnexionsPathFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getServicesFile()
|
protected function getServicesFile()
|
||||||
{
|
{
|
||||||
return new \SplFileObject($this->getServicesPathFile());
|
return new \SplFileInfo($this->getServicesPathFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
|
@@ -896,7 +896,7 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
|
|||||||
private function check_record_constraints(record_adapter $record)
|
private function check_record_constraints(record_adapter $record)
|
||||||
{
|
{
|
||||||
$errors = array();
|
$errors = array();
|
||||||
if ( ! $record->get_hd_file() instanceof SplFileObject)
|
if ( ! $record->get_hd_file() instanceof \SplFileInfo)
|
||||||
$errors["file_size"] = _("Le record n'a pas de fichier physique"); //Record must rely on real file
|
$errors["file_size"] = _("Le record n'a pas de fichier physique"); //Record must rely on real file
|
||||||
|
|
||||||
if ($record->get_duration() > self::AUTH_VIDEO_DURATION)
|
if ($record->get_duration() > self::AUTH_VIDEO_DURATION)
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use \Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -818,7 +818,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf
|
|||||||
private function check_record_constraints(record_adapter $record)
|
private function check_record_constraints(record_adapter $record)
|
||||||
{
|
{
|
||||||
$errors = array();
|
$errors = array();
|
||||||
if ( ! $record->get_hd_file() instanceof SplFileObject)
|
if ( ! $record->get_hd_file() instanceof \SplFileInfo)
|
||||||
$errors["file_size"] = _("Le record n'a pas de fichier physique"); //Record must rely on real file
|
$errors["file_size"] = _("Le record n'a pas de fichier physique"); //Record must rely on real file
|
||||||
if ($record->get_technical_infos('size') > self::AUTH_PHOTO_SIZE)
|
if ($record->get_technical_infos('size') > self::AUTH_PHOTO_SIZE)
|
||||||
$errors["size"] = sprintf(_("Le poids maximum d'un fichier est de %s"), p4string::format_octets(self::AUTH_PHOTO_SIZE));
|
$errors["size"] = sprintf(_("Le poids maximum d'un fichier est de %s"), p4string::format_octets(self::AUTH_PHOTO_SIZE));
|
||||||
|
@@ -1022,7 +1022,7 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
{
|
{
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$key = $record->get_serialize_key();
|
$key = $record->get_serialize_key();
|
||||||
if ( ! $record->get_hd_file() instanceof SplFileObject)
|
if ( ! $record->get_hd_file() instanceof SplFileInfo)
|
||||||
$errors["file_size_" . $key] = _("Le record n'a pas de fichier physique"); //Record must rely on real file
|
$errors["file_size_" . $key] = _("Le record n'a pas de fichier physique"); //Record must rely on real file
|
||||||
|
|
||||||
if ($record->get_duration() > self::AUTH_VIDEO_DURATION)
|
if ($record->get_duration() > self::AUTH_VIDEO_DURATION)
|
||||||
|
@@ -50,8 +50,8 @@ class module_console_systemUpgrade extends Command
|
|||||||
|
|
||||||
if ($continue == 'y') {
|
if ($continue == 'y') {
|
||||||
try {
|
try {
|
||||||
$connexionInc = new \SplFileObject(__DIR__ . '/../../../../config/connexion.inc');
|
$connexionInc = new \SplFileInfo(__DIR__ . '/../../../../config/connexion.inc', true);
|
||||||
$configInc = new \SplFileObject(__DIR__ . '/../../../../config/config.inc');
|
$configInc = new \SplFileInfo(__DIR__ . '/../../../../config/config.inc', true);
|
||||||
|
|
||||||
$Core->getConfiguration()->upgradeFromOldConf($configInc, $connexionInc);
|
$Core->getConfiguration()->upgradeFromOldConf($configInc, $connexionInc);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
Reference in New Issue
Block a user