Cleanup Code

This commit is contained in:
Romain Neutron
2013-04-19 20:58:30 +02:00
parent 9f0e7a3e08
commit 43856b7f62
15 changed files with 63 additions and 36 deletions

View File

@@ -320,7 +320,6 @@ class Application extends SilexApplication
throw new \RuntimeException('No Imagine driver available');
});
$app = $this;
$this['phraseanet.logger'] = $this->protect(function($databox) use ($app) {
try {

View File

@@ -73,6 +73,7 @@ return call_user_func(function($environment = 'prod') {
if ($app->isAuthenticated()) {
$app['dispatcher']->dispatch(PhraseaEvents::API_OAUTH2_END, new ApiOAuth2EndEvent());
return;
}

View File

@@ -16,8 +16,7 @@ use Silex\ControllerProviderInterface;
use Silex\Application as SilexApplication;
use Symfony\Component\HttpFoundation\Request;
class Setup implements ControllerProviderInterface
class Setup implements ControllerProviderInterface
{
public function connect(SilexApplication $app)
{
@@ -43,10 +42,10 @@ class Setup implements ControllerProviderInterface
$requirementsCollection = $this->getRequirementsCollection();
return $app['twig']->render('/setup/index.html.twig', array(
'locale' => $app['locale'],
'available_locales' => \Alchemy\Phrasea\Application::getAvailableLanguages(),
'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/',
'requirementsCollection' => $requirementsCollection,
'locale' => $app['locale'],
'available_locales' => \Alchemy\Phrasea\Application::getAvailableLanguages(),
'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/',
'requirementsCollection' => $requirementsCollection,
));
}
@@ -70,8 +69,8 @@ class Setup implements ControllerProviderInterface
$requirementsCollection = $this->getRequirementsCollection();
foreach($requirementsCollection as $requirements) {
foreach($requirements->getRequirements() as $requirement) {
foreach ($requirementsCollection as $requirements) {
foreach ($requirements->getRequirements() as $requirement) {
if (!$requirement->isFulfilled() && !$requirement->isOptional()) {
$warnings[] = $requirement->getTestMessage();
}
@@ -142,16 +141,16 @@ class Setup implements ControllerProviderInterface
$binaryData = array();
foreach (array(
'php_binary' => $request->request->get('binary_php'),
'convert_binary' => $request->request->get('binary_convert'),
'composite_binary' => $request->request->get('binary_composite'),
'swf_extract_binary' => $request->request->get('binary_swfextract'),
'pdf2swf_binary' => $request->request->get('binary_pdf2swf'),
'swf_render_binary' => $request->request->get('binary_swfrender'),
'unoconv_binary' => $request->request->get('binary_unoconv'),
'ffmpeg_binary' => $request->request->get('binary_ffmpeg'),
'mp4box_binary' => $request->request->get('binary_MP4Box'),
'pdftotext_binary' => $request->request->get('binary_xpdf'),
'php_binary' => $request->request->get('binary_php'),
'convert_binary' => $request->request->get('binary_convert'),
'composite_binary' => $request->request->get('binary_composite'),
'swf_extract_binary' => $request->request->get('binary_swfextract'),
'pdf2swf_binary' => $request->request->get('binary_pdf2swf'),
'swf_render_binary' => $request->request->get('binary_swfrender'),
'unoconv_binary' => $request->request->get('binary_unoconv'),
'ffmpeg_binary' => $request->request->get('binary_ffmpeg'),
'mp4box_binary' => $request->request->get('binary_MP4Box'),
'pdftotext_binary' => $request->request->get('binary_xpdf'),
) as $key => $path) {
$binaryData[$key] = $path;
}
@@ -159,14 +158,14 @@ class Setup implements ControllerProviderInterface
$user = $installer->install($email, $password, $abConn, $servername, $dataPath, $dbConn, $template, $binaryData);
$app->openAccount(new \Session_Authentication_None($user));
//exit;
$redirection = '/admin/?section=taskmanager&notice=install_success';
return $app->redirect($redirection);
} catch (\Exception $e) {
}
var_dump($e->getMessage(), $e->getFile(), $e->getLine());
return $app->redirect('/setup/installer/step2/?error=' . sprintf(_('an error occured : %s'), $e->getMessage()));
}

View File

@@ -499,10 +499,10 @@ class Thesaurus implements ControllerProviderInterface
}
}
}
if ( ! $query) {
if (! $query) {
$query = $query0;
}
if ( ! $label) {
if (! $label) {
$label = $label0;
}
@@ -2798,7 +2798,7 @@ class Thesaurus implements ControllerProviderInterface
"reindex" => $request->get('reindex'),
"debug" => $request->get('debug'),
), true)));
$refresh_list = $root->appendChild($ret->createElement("refresh_list"));
if (null === $bid = $request->get("bid")) {

View File

@@ -47,6 +47,7 @@ class PhraseaLocaleServiceProvider implements ServiceProviderInterface
{
if (isset($this->locale)) {
$this->app['locale'] = $this->locale;
return;
}

View File

@@ -12,7 +12,6 @@
namespace Alchemy\Phrasea\Core\Provider;
use Alchemy\Phrasea\Core\Version;
use Alchemy\Phrasea\Security\Firewall;
use Silex\Application as SilexApplication;
use Silex\ServiceProviderInterface;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Core\Provider;
use Alchemy\Phrasea\Core\Version;
use Alchemy\Phrasea\Security\Firewall;
use Silex\Application as SilexApplication;
use Silex\ServiceProviderInterface;

View File

@@ -1217,7 +1217,6 @@ class PhraseaEngineQueryParser
}
break;
// lé ca devient la zone pour savoir si on a que l'année ou si c'est une date sans espaces,slash ou tiret
case 1 :
switch (strlen($tmp[0])) {
@@ -1278,8 +1277,6 @@ class PhraseaEngineQueryParser
break;
}
break;
}

View File

@@ -30,7 +30,7 @@ class CacheServerProbe extends CacheServerRequirement implements ProbeInterface
);
if (null !== $cache->getStats()) {
foreach($cache->getStats() as $name => $value) {
foreach ($cache->getStats() as $name => $value) {
$this->addInformation($name, $value);
}
}

View File

@@ -30,7 +30,7 @@ class OpcodeCacheProbe extends OpcodeCacheRequirement implements ProbeInterface
);
if (null !== $cache->getStats()) {
foreach($cache->getStats() as $name => $value) {
foreach ($cache->getStats() as $name => $value) {
$this->addInformation($name, $value);
}
}

View File

@@ -21,8 +21,7 @@ class SearchEngineProbe extends RequirementCollection implements ProbeInterface
{
$this->setName('Search Engine');
foreach ($searchEngine->getStatus() as $infos)
{
foreach ($searchEngine->getStatus() as $infos) {
$this->addInformation($infos[0], $infos[1]);
}
}

View File

@@ -27,7 +27,7 @@ class LocalesRequirements extends RequirementCollection
);
if (function_exists('_')) {
foreach (PhraseaApplication::getAvailableLanguages() as $code => $language_name){
foreach (PhraseaApplication::getAvailableLanguages() as $code => $language_name) {
\phrasea::use_i18n($code, 'test');
$this->addRecommendation(

View File

@@ -12,7 +12,6 @@
namespace Alchemy\Phrasea\Setup\Requirements;
use Alchemy\Phrasea\Setup\System\RequirementCollection;
use Alchemy\Phrasea\Application as PhraseaApplication;
class SystemRequirements extends RequirementCollection
{
@@ -279,7 +278,6 @@ class SystemRequirements extends RequirementCollection
'Install and enable the <strong>XML</strong> extension.'
);
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->addRecommendation(
function_exists('posix_isatty'),

View File

@@ -1,5 +1,14 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\System;
class Information implements InformationInterface
@@ -13,11 +22,17 @@ class Information implements InformationInterface
$this->value = $value;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->name;
}
/**
* {@inheritdoc}
*/
public function getValue()
{
return $this->value;

View File

@@ -1,9 +1,29 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\System;
interface InformationInterface
{
/**
* The name of the information
*
* @return String
*/
public function getName();
/**
* The value of the information
*
* @return String
*/
public function getValue();
}