Fix CS lib/Alchemy

This commit is contained in:
Romain Neutron
2013-01-29 16:38:00 +01:00
parent bf470b69d7
commit 53206af159
87 changed files with 578 additions and 643 deletions

View File

@@ -413,6 +413,7 @@ class Application extends SilexApplication
if (isset($languages[$code])) {
$event->getRequest()->setLocale($code);
return $event->getRequest()->getLocale();
break;
}
@@ -651,4 +652,3 @@ class Application extends SilexApplication
$this->sessionCookieEnabled = false;
}
}

View File

@@ -710,7 +710,6 @@ return call_user_func(function($environment = 'prod') {
})->assert('databox_id', '\d+')->assert('story_id', '\d+');
$app->get('/stories/{any_id}/{anyother_id}/', $bad_request_exception);
/**
* Route Errors
*/

View File

@@ -15,7 +15,6 @@ use Silex\Application as SilexApplication;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Symfony\Component\HttpFoundation\Request;
return call_user_func(function($environment = 'prod') {
$app = new PhraseaApplication($environment);

View File

@@ -83,7 +83,6 @@ return call_user_func(function($environment = 'prod') {
$app->openAccount($auth);
} catch (\Exception $e) {
return new Response($app['twig']->render($template, array("auth" => $oauth2_adapter)));
}
} else {

View File

@@ -28,7 +28,7 @@ class CLI extends Application
* @param string $name Name for this application.
* @param string|null $version Version number for this application.
*/
function __construct($name, $version = null, $environment = null)
public function __construct($name, $version = null, $environment = null)
{
parent::__construct($environment);

View File

@@ -110,4 +110,3 @@ class Manager
file_put_contents($this->cacheFile->getPathname(), $datas);
}
}

View File

@@ -71,6 +71,7 @@ class RecordAdd extends Command
if (strtolower($continue) !== 'y') {
$output->writeln('Aborted !');
return;
}

View File

@@ -32,4 +32,3 @@ interface DatasUpgraderInterface
*/
public function getTimeEstimation();
}

View File

@@ -101,7 +101,6 @@ class Step35 implements DatasUpgraderInterface
} while (count($rs) > 0);
}
foreach ($this->app['phraseanet.appbox']->get_databoxes() as $databox) {
$this->ensureDropMigrateColumn($databox);
}

View File

@@ -499,7 +499,6 @@ class Collection implements ControllerProviderInterface
}
if ('json' === $app['request']->getRequestFormat()) {
return $app->json(array(
'success' => $success,
'msg' => $msg,
@@ -532,7 +531,6 @@ class Collection implements ControllerProviderInterface
}
if ('json' === $app['request']->getRequestFormat()) {
return $app->json(array(
'success' => $success,
'msg' => $success ? _('Successful removal') : _('An error occured'),
@@ -565,7 +563,6 @@ class Collection implements ControllerProviderInterface
}
if ('json' === $app['request']->getRequestFormat()) {
return $app->json(array(
'success' => $success,
'msg' => $success ? _('Successful removal') : _('An error occured'),
@@ -598,7 +595,6 @@ class Collection implements ControllerProviderInterface
}
if ('json' === $app['request']->getRequestFormat()) {
return $app->json(array(
'success' => $success,
'msg' => $success ? _('Successful removal') : _('An error occured'),
@@ -632,7 +628,6 @@ class Collection implements ControllerProviderInterface
}
if ('json' === $app['request']->getRequestFormat()) {
return $app->json(array(
'success' => $success,
'msg' => $success ? _('Successful removal') : _('An error occured'),
@@ -810,7 +805,6 @@ class Collection implements ControllerProviderInterface
}
if ('json' === $app['request']->getRequestFormat()) {
return $app->json(array(
'success' => $success,
'msg' => $msg
@@ -1078,7 +1072,6 @@ class Collection implements ControllerProviderInterface
}
if ('json' === $app['request']->getRequestFormat()) {
return $app->json(array(
'success' => $success,
'msg' => $success ? _('Successful update') : _('An error occured'),

View File

@@ -14,7 +14,6 @@ namespace Alchemy\Phrasea\Controller\Admin;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ConnectedUsers implements ControllerProviderInterface
{
@@ -27,7 +26,6 @@ class ConnectedUsers implements ControllerProviderInterface
$app['firewall']->requireAccessToModule('Admin');
});
$controllers->get('/', $this->call('listConnectedUsers'));
return $controllers;

View File

@@ -164,7 +164,6 @@ class Dashboard implements ControllerProviderInterface
public function flush(Application $app, Request $request)
{
if ($app['phraseanet.cache-service']->flushAll()) {
return $app->redirect('/admin/dashboard/?flush_cache=ok');
}

View File

@@ -931,7 +931,6 @@ class Databox implements ControllerProviderInterface
public function createCollection(Application $app, Request $request, $databox_id)
{
if (($name = trim($request->request->get('name', ''))) === '') {
return $app->redirect('/admin/databox/' . $databox_id . '/collection/error=name');
}

View File

@@ -33,7 +33,6 @@ class Databoxes implements ControllerProviderInterface
$app['firewall']->requireAccessToModule('admin');
});
/**
* Get Databases control panel
*
@@ -50,7 +49,6 @@ class Databoxes implements ControllerProviderInterface
$controllers->get('/', $this->call('getDatabases'))
->bind('admin_databases');
/**
* Create Database
*
@@ -299,6 +297,7 @@ class Databoxes implements ControllerProviderInterface
return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1');
} catch (\Exception $e) {
$app['phraseanet.appbox']->get_connection()->rollBack();
return $app->redirect('/admin/databoxes/?success=0&error=mount-failed');
}
}
@@ -335,7 +334,6 @@ class Databoxes implements ControllerProviderInterface
public function databasesUpgrade(Application $app, Request $request)
{
if (\phrasea::is_scheduler_started($app)) {
return $app->redirect('/admin/databoxes/?success=0&error=scheduler-started');
}

View File

@@ -16,7 +16,6 @@ use PHPExiftool\Driver\TagProvider;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
/**
*
@@ -227,7 +226,6 @@ class Description implements ControllerProviderInterface
$field = \databox_field::create($app, $databox, $request->request->get('newfield'), $request->request->get('newfield_multi'));
}
if (is_array($request->request->get('todelete_ids'))) {
foreach ($request->request->get('todelete_ids') as $id) {
try {

View File

@@ -32,8 +32,6 @@ class TaskManager implements ControllerProviderInterface
return $app->redirect('/admin/task-manager/tasks/');
});
/*
* route /admin/task-manager/tasks/
* tasks status in json
@@ -43,7 +41,6 @@ class TaskManager implements ControllerProviderInterface
$controllers->get('/tasks/', function(Application $app, Request $request) {
if ($request->getContentType() == 'json') {
return $app->json($app['task-manager']->toArray());
} else {
@@ -126,7 +123,6 @@ class TaskManager implements ControllerProviderInterface
}, 200, array('Content-Type' => 'text/html'));
});
$controllers->get('/task/{id}/log', function(Application $app, Request $request, $id) {
$logdir = \p4string::addEndSlash($app['phraseanet.registry']->get('GV_RootPath') . 'logs');
@@ -183,6 +179,7 @@ class TaskManager implements ControllerProviderInterface
/*
* todo : add a message back
*/
return $app->redirect('/admin/task-manager/tasks/');
}
});
@@ -246,7 +243,6 @@ class TaskManager implements ControllerProviderInterface
return $app->json(true);
} catch (\Exception $e) {
return $app->json(false);
}
});
@@ -279,7 +275,6 @@ class TaskManager implements ControllerProviderInterface
return $app->json(true);
} catch (\Exception $e) {
return new Response(
'Bad task ID',
404 // Not Found
@@ -327,6 +322,7 @@ class TaskManager implements ControllerProviderInterface
);
break;
}
return $ret;
});
@@ -339,6 +335,7 @@ class TaskManager implements ControllerProviderInterface
$task = $app['task-manager']->getTask($id);
$template = 'admin/task.html.twig';
return $app['twig']->render($template, array(
'task' => $task,
'view' => 'XML'
@@ -364,6 +361,7 @@ class TaskManager implements ControllerProviderInterface
412 // Precondition Failed
);
}
return $ret;
});

View File

@@ -350,7 +350,6 @@ class Users implements ControllerProviderInterface
$models = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
$sql = "
SELECT demand.date_modif,demand.base_id, usr.usr_id , usr.usr_login ,usr.usr_nom,usr.usr_prenom,
usr.societe, usr.fonction, usr.usr_mail, usr.tel, usr.activite,
@@ -434,7 +433,6 @@ class Users implements ControllerProviderInterface
}
}
if (count($templates) > 0 || count($deny) > 0 || count($accept) > 0) {
$done = array();
$cache_to_update = array();
@@ -448,7 +446,6 @@ class Users implements ControllerProviderInterface
$user->ACL()->apply_model($user_template, $base_ids);
if (!isset($done[$usr])) {
$done[$usr] = array();
}
@@ -575,7 +572,6 @@ class Users implements ControllerProviderInterface
$controllers->post('/import/file/', function(Application $app, Request $request) {
if ((null === $file = $request->files->get('files')) || !$file->isValid()) {
return $app->redirect('/admin/users/import/file/?error=file-invalid');
}
@@ -604,12 +600,10 @@ class Users implements ControllerProviderInterface
}
if (!$loginDefined) {
return $app->redirect('/admin/users/import/file/?error=row-login');
}
if (!$pwdDefined) {
return $app->redirect('/admin/users/import/file/?error=row-pwd');
}
@@ -667,12 +661,10 @@ class Users implements ControllerProviderInterface
}
if (count($out['errors']) > 0) {
return $app['twig']->render('admin/user/import/file.html.twig', array(
'errors' => $out['errors']
));
} elseif ($nbUsrToAdd === 0) {
return $app->redirect('/admin/users/import/file/?error=no-user');
} else {
for ($i = 1; $i < sizeof($array); $i++) {
@@ -905,4 +897,3 @@ class Users implements ControllerProviderInterface
return $equivalenceToMysqlField;
}
}

View File

@@ -102,7 +102,6 @@ class Datafiles extends AbstractDelivery
return $that->deliverContent($app['request'], $record, $subdef, $watermark, $stamp, $app);
})->assert('sbas_id', '\d+')->assert('record_id', '\d+');
return $controllers;
}
}

View File

@@ -320,7 +320,6 @@ class Bridge implements ControllerProviderInterface
$account->get_api()->create_container($container_type, $app['request']);
} catch (\Exception $e) {
return $app->redirect('/prod/bridge/action/' . $account_id . '/' . $action . '/' . $element_type . '/?error=' . get_class($e) . ' : ' . $e->getMessage());
}

View File

@@ -77,7 +77,6 @@ class DoDownload implements ControllerProviderInterface
->bind('execute_download')
->assert('token', '[a-zA-Z0-9]{8,16}');
return $controllers;
}
@@ -186,7 +185,6 @@ class DoDownload implements ControllerProviderInterface
return $response;
}
/**
* Build a zip of downloaded documents
*

View File

@@ -85,7 +85,6 @@ class Edit implements ControllerProviderInterface
}
}
/**
* generate javascript sugg values
*/
@@ -117,7 +116,6 @@ class Edit implements ControllerProviderInterface
unset($collection);
}
/**
* generate javascript status
*/
@@ -402,8 +400,6 @@ class Edit implements ControllerProviderInterface
}
}
return $app['twig']->render('prod/actions/edit_default.html.twig', array('edit' => $editing, 'message' => ''));
});

View File

@@ -210,7 +210,6 @@ class Export implements ControllerProviderInterface
'message' => _('Export saved in the waiting queue')
));
} catch (\Exception $e) {
return $app->json(array(
'success' => false,
'message' => _('Something went wrong')

View File

@@ -516,7 +516,6 @@ class Lazaret implements ControllerProviderInterface
/* @var $lazaretFile \Entities\LazaretFile */
if (null === $lazaretFile) {
return new Response(null, 404);
}

View File

@@ -72,11 +72,13 @@ class MoveCollection implements ControllerProviderInterface
try {
if (null === $request->request->get('base_id')) {
$datas['message'] = _('Missing target collection');
return $app->json($datas);
}
if (!$app['phraseanet.user']->ACL()->has_right_on_base($request->request->get('base_id'), 'canaddrecord')) {
$datas['message'] = sprintf(_("You do not have the permission to move records to %s"), \phrasea::bas_names($move->getBaseIdDestination(), $app));
return $app->json($datas);
}
@@ -84,6 +86,7 @@ class MoveCollection implements ControllerProviderInterface
$collection = \collection::get_from_base_id($app, $request->request->get('base_id'));
} catch (\Exception_Databox_CollectionNotFound $e) {
$datas['message'] = _('Invalid target collection');
return $app->json($datas);
}

View File

@@ -203,7 +203,6 @@ class Order implements ControllerProviderInterface
}
if ('json' === $app['request']->getRequestFormat()) {
return $app->json(array(
'success' => $success,
'msg' => $msg,
@@ -293,7 +292,6 @@ class Order implements ControllerProviderInterface
}
if ('json' === $app['request']->getRequestFormat()) {
return $app->json(array(
'success' => $success,
'msg' => $success ? _('Order has been sent') : _('An error occured while sending, please retry or contact an admin if problem persists'),
@@ -333,7 +331,6 @@ class Order implements ControllerProviderInterface
}
if ('json' === $app['request']->getRequestFormat()) {
return $app->json(array(
'success' => $success,
'msg' => $success ? _('Order has been denied') : _('An error occured while denying, please retry or contact an admin if problem persists'),

View File

@@ -129,7 +129,6 @@ class Tools implements ControllerProviderInterface
$tempoFile = $tempoFile . DIRECTORY_SEPARATOR . $fileName;
copy($file->getPathname(), $tempoFile);
try {
$record = new \record_adapter(
$app,

View File

@@ -270,7 +270,6 @@ class Account implements ControllerProviderInterface
return $app->redirect('/account/reset-email/?update=ok');
} catch (\Exception $e) {
return $app->redirect('/account/reset-email/?update=ko');
}
}

View File

@@ -49,8 +49,6 @@ class Developers implements ControllerProviderInterface
$controllers->get('/applications/', $this->call('listApps'))
->bind('developers_applications');
/**
* Get the form to create a new application
*
@@ -83,7 +81,6 @@ class Developers implements ControllerProviderInterface
$controllers->post('/application/', $this->call('newApp'))
->bind('submit_developers_application');
/**
* Get application information
*

View File

@@ -44,8 +44,6 @@ class Login implements ControllerProviderInterface
}
});
/**
* Login
*
@@ -358,13 +356,10 @@ class Login implements ControllerProviderInterface
&& (null !== $passwordConfirm = $request->request->get('form_password_confirm'))) {
if ($password !== $passwordConfirm) {
return $app->redirect($app['url_generator']->generate('login_forgot_password', array('pass-error' => 'pass-match')));
} elseif (strlen(trim($password)) < 8) {
return $app->redirect($app['url_generator']->generate('login_forgot_password', array('pass-error' => 'pass-short')));
} elseif (trim($password) !== str_replace(array("\r\n", "\n", "\r", "\t", " "), "_", $password)) {
return $app->redirect($app['url_generator']->generate('login_forgot_password', array('pass-error' => 'pass-invalid')));
}
@@ -521,8 +516,6 @@ class Login implements ControllerProviderInterface
}
}
$arrayVerif = $this->getRegisterFieldConfiguration($app);
return $app['twig']->render('login/register.html.twig', array(

View File

@@ -66,10 +66,12 @@ class Session implements ControllerProviderInterface
$usr_id = $app['phraseanet.user']->get_id();
if ($usr_id != $request->request->get('usr')) { // I logged with another user
$ret['status'] = 'disconnected';
return $app->json($ret);
}
} else {
$ret['status'] = 'disconnected';
return $app->json($ret);
}
@@ -81,6 +83,7 @@ class Session implements ControllerProviderInterface
if ($moduleId = (int) $request->request->get('module') < 1) {
$ret['message'] = 'Missing or Invalid `module` parameter';
return $app->json($ret);
}
@@ -121,7 +124,6 @@ class Session implements ControllerProviderInterface
return $app->json($ret);
}
/**
* Prefix the method to call with the controller class name
*

View File

@@ -86,7 +86,6 @@ class Notifications implements ControllerProviderInterface
return $app->json(array('success' => true, 'message' => ''));
} catch (\Exception $e) {
return $app->json(array('success' => false, 'message' => $e->getMessage()));
}
}
@@ -105,6 +104,7 @@ class Notifications implements ControllerProviderInterface
}
$page = (int) $request->query->get('page', 1);
return $app->json($app['events-manager']->get_json_notifications(($page < 1 ? 1 : $page)));
}

View File

@@ -104,7 +104,6 @@ class Configuration
*/
public function getEnvironnement()
{
return $this->environment;
}

View File

@@ -26,6 +26,7 @@ class TaskManagerServiceProvider implements ServiceProviderInterface
->getService($app['phraseanet.configuration']->getTaskManager());
$service = Builder::create($app, $configuration);
return $service->getDriver();
});
}

View File

@@ -43,4 +43,3 @@ class ApcCache extends ServiceAbstract
return 'apc';
}
}

View File

@@ -40,4 +40,3 @@ class ArrayCache extends ServiceAbstract
return 'array';
}
}

View File

@@ -80,4 +80,3 @@ class MemcacheCache extends ServiceAbstract
return $this->port;
}
}

View File

@@ -81,4 +81,3 @@ class RedisCache extends ServiceAbstract
return $this->port;
}
}

View File

@@ -46,4 +46,3 @@ class WinCacheCache extends ServiceAbstract
return 'wincache';
}
}

View File

@@ -117,4 +117,3 @@ class Monolog extends ServiceAbstract
return array('channel', 'handler', 'filename');
}
}

View File

@@ -65,4 +65,3 @@ class WorkZone extends Helper
$tmp_baskets = array();
}
}

View File

@@ -46,7 +46,6 @@ class Multi implements OptionType
}
if (! $value) {
return $this;
}

View File

@@ -143,7 +143,6 @@ class PhraseaEngineQueryParser
if (is_array($tree["VALUE"])) {
return(implode(" ", $tree["VALUE"]));
} else {
return($tree["VALUE"]);
}
break;
@@ -1140,7 +1139,6 @@ class PhraseaEngineQueryParser
"LB" => $newTreeLB,
"RB" => $newTreeRB);
return $tree;
}
@@ -1893,4 +1891,3 @@ class PhraseaEngineQueryParser
}
}
}

View File

@@ -225,4 +225,3 @@ interface SearchEngineInterface
*/
public function clearAllCache(\DateTime $date = null);
}

View File

@@ -614,7 +614,6 @@ class SearchEngineOptions
$options->disallowBusinessFields();
$options->setLocale($app['locale.I18n']);
if (is_array($request->get('bases'))) {
$bas = array_map(function($base_id) use ($app) {
return \collection::get_from_base_id($app, $base_id);

View File

@@ -173,4 +173,3 @@ class SearchEngineResult
return $this->indexes;
}
}

View File

@@ -1007,4 +1007,3 @@ class SphinxSearchEngine implements SearchEngineInterface
}
}

View File

@@ -75,7 +75,6 @@ class Migration35 implements MigrationInterface
rename(__DIR__ . '/../../../../../../config/connexion.inc', __DIR__ . '/../../../../../../config/connexion.inc.old');
rename(__DIR__ . '/../../../../../../config/config.inc', __DIR__ . '/../../../../../../config/config.inc.old');
$this->app['phraseanet.configuration']->setConfigurations($configs);
$this->app['phraseanet.configuration']->setEnvironnement('prod');
}

View File

@@ -28,6 +28,7 @@ class Probe31 implements ProbeInterface
/**
* We can not use registry to inject a path as the install is not yet done
*/
return is_file(__DIR__ . "/../../../../../../config/connexion.inc")
&& is_file(__DIR__ . "/../../../../../../config/_GV.php");
}

View File

@@ -28,6 +28,7 @@ class Probe35 implements ProbeInterface
/**
* We can not use registry to inject a path as the install is not yet done
*/
return is_file(__DIR__ . "/../../../../../../config/connexion.inc")
&& is_file(__DIR__ . "/../../../../../../config/config.inc");
}