Remove deprectaed feature

This commit is contained in:
Romain Neutron
2012-10-02 13:09:16 +02:00
parent 54428eed6d
commit ec40ce3d49
30 changed files with 118 additions and 578 deletions

71
bin/setup Executable file
View File

@@ -0,0 +1,71 @@
#!/usr/bin/env php
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace KonsoleKommander;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Core\Version;
use Alchemy\Phrasea\Command\UpgradeDBDatas;
use Alchemy\Phrasea\Command\RescanTechnicalDatas;
use Alchemy\Phrasea\Command\BuildMissingSubdefs;
use Alchemy\Phrasea\Command\RecordAdd;
use Alchemy\Phrasea\Command\CreateCollection;
use Alchemy\Phrasea\CLI;
require_once dirname(__FILE__) . '/../lib/bootstrap.php';
try {
$app = new CLI("
_____ _ _ _____ _____ ______ _ _ ______ _______
| __ \| | | | __ \ /\ / ____| ____| /\ | \ | | ____|__ __|
| |__) | |__| | |__) | / \ | (___ | |__ / \ | \| | |__ | |
| ___/| __ | _ / / /\ \ \___ \| __| / /\ \ | . ` | __| | |
| | | | | | | \ \ / ____ \ ____) | |____ / ____ \| |\ | |____ | |
|_| |_| |_|_| \_|_/ \_\_____/|______/_/ \_\_| \_|______| |_|
__
________ / /___ ______
/ ___/ _ \/ __/ / / / __ \
(__ ) __/ /_/ /_/ / /_/ /
/____/\___/\__/\__,_/ .___/
/_/
Phraseanet Copyright (C) 2004 Alchemy
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `about:license' for details.\n\n"
. ' SETUP', Version::getName() . ' ' . Version::getNumber());
$tester = new \Alchemy\Phrasea\Setup\ConfigurationTester($app);
$app->command(new \module_console_aboutAuthors('about:authors'));
$app->command(new \module_console_aboutLicense('about:license'));
if ($tester->isInstalled()) {
$app->command(new \module_console_systemUpgrade('system:upgrade'));
$app->command(new UpgradeDBDatas('system:upgrade-datas'));
}
$app->command(new \module_console_systemConfigCheck('check:system'));
$app->command(new \Alchemy\Phrasea\Command\Setup\Install('system:install'));
$result_code = is_int($app->run()) ? : 1;
} catch (\Exception $e) {
$result_code = 1;
echo sprintf("\nAn error occured :\n\n\t\033[0;31m%s\033[0;37m\n\n", $e->getMessage());
}
exit($result_code);

View File

@@ -1,37 +0,0 @@
environment: dev
dev:
phraseanet:
servername: 'http://local.phrasea/'
maintenance: false
debug: true
display_errors: true
database: main_connexion
template_engine: twig_debug
orm: doctrine_dev
cache: array_cache
opcodecache: array_cache
border-manager: border_manager
prod:
phraseanet:
servername: 'http://local.phrasea/'
maintenance: false
debug: false
display_errors: false
database: main_connexion
template_engine: twig
orm: doctrine_prod
cache: array_cache
opcodecache: array_cache
border-manager: border_manager
test:
phraseanet:
servername: 'http://local.phrasea/'
maintenance: false
debug: true
display_errors: true
database: main_connexion
template_engine: twig_debug
orm: doctrine_test
cache: array_cache
opcodecache: array_cache
border-manager: border_manager

View File

@@ -1,12 +0,0 @@
main_connexion:
host: localhost
port: '3306'
user: root
password: ''
dbname: ab_test
driver: pdo_mysql
charset: UTF8
test_connexion:
driver: pdo_sqlite
path: '/tmp/db.sqlite'
charset: UTF8

View File

@@ -1,179 +0,0 @@
Orm:
#Doctrine developement service options
#Service name
doctrine_dev:
type: Orm\Doctrine
options:
#Set automatically propers values for debug
#Query & result caches are setted to Array cache
#Auto-generating Proxy Classes is setted to false
debug: true
#Assign a connexion from connexions.yml to the DataBase Abstraction Layer
dbal: main_connexion
#Available cache driver [memcached, apc, array]
#Query cache : is used to cache the transformation of a DQL query to its SQL counterpart
#Result cache : is used to cache the results of your queries
#Metadata cache : is used to cache entity class metadatas
#If No cache is provided all cache are setted to default_cache which is an array cache type
cache:
query:
service: Cache\array_cache
result:
service: Cache\array_cache
metadata:
service: Cache\array_cache
# Assign a service to log doctrine queries
log:
service: Log\query_logger
# Doctrine test service options
doctrine_test:
type: Orm\Doctrine
options:
debug: true
#Doctrine use a different connection configuration base to run tests
dbal: test_connexion
cache:
query:
service: Cache\array_cache
result:
service: Cache\array_cache
metadata:
service: Cache\array_cache
# Doctrine production service options
doctrine_prod:
type: Orm\Doctrine
options:
debug: false
dbal: main_connexion
cache:
query:
service: Cache\array_cache
result:
service: Cache\array_cache
metadata:
service: Cache\array_cache
TemplateEngine:
#Define a template engine service
#Only Twig is avalaible as a template engine service
#see http://twig.sensiolabs.org/
#Define the service name first
twig:
#Template engine type
type: TemplateEngine\Twig
options:
#When set to true, the generated templates have a __toString() method that you can use to display the generated nodes
debug: false
#The charset used by the templates
charset: utf-8
#Twig will silently ignore invalid variables (variables and or attributes/methods that do not exist)
#And replace them with a null value. When set to true, Twig throws an exception instead (default to false)
strict_variables: false
autoescape: true
#Optimize the node tree before compilation
optimizer: true
twig_debug:
type: TemplateEngine\Twig
options:
debug: true
charset: utf-8
strict_variables: true
autoescape: true
optimizer: true
Log:
# Define a Log service
# This one is defined to handle the logs of doctrine queries
# Only Monolog is available as a logger service
# Please Notice that for doctrine ONLY a echo logger service is available, see below
# Monolog logger use the PHP Monolog library to handle logs using differents handlers
query_logger:
type: Log\Doctrine\Monolog
options:
#You can precise the output format
#This option is only available when log are used to log doctrine queries
#Available output [vdump, json, yaml]
# vdump : output logs in a var_dump formatted style
# json : output logs in json
# yml : output logs yml
output: json
#Name used for the Monolog channel
channel: query-logger
#Define how the logs will be handled
#Avalaibale Handler are [rotate, stream]
#Rotate handler is used to stores logs to files that are rotated every day
#And a limited number of files are kept by defining the max_day value
#Stream handler is used to stores logs in a single local file
handler: rotate
max_day: 2
#Name of the file where logs are written
filename: doctrine-query.log
# Define a phpecho log service for Doctrine
# phpecho logger logs doctrine queries to the standard output using echo/var_dump
# Notice that phpecho logger do not have options
sql_logger:
type: Log\Doctrine\Phpecho
Cache:
#Define cache services
#There are Four deffirent cache type available [array, xcache, apc, memcache]
#Only a memcache service can take option to define port & host for the memcache server
array_cache:
type: Cache\ArrayCache
memcache_cache:
type: Cache\MemcacheCache
options:
host: localhost
port: 11211
apc_cache:
type: Cache\ApcCache
xcache_cache:
type: Cache\XcacheCache
Border:
border_manager:
type: Border\BorderManager
options:
enabled: true
checkers:
-
type: Checker\Sha256
enabled: true
-
type: Checker\UUID
enabled: true
-
type: Checker\Colorspace
enabled: false
options:
colorspaces: [cmyk, grayscale, rgb]
-
type: Checker\Dimension
enabled: false
options:
width: 80
height: 80
-
type: Checker\Extension
enabled: false
options: { }
-
type: Checker\Filename
enabled: false
options:
sensitive: true
-
type: Checker\MediaType
enabled: false
options:
mediatypes: [Audio, Document, Flash, Image, Video]

View File

@@ -1,69 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2012 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Controller\Setup;
use Silex\Application;
use Silex\ControllerProviderInterface;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class Upgrader implements ControllerProviderInterface
{
public function connect(Application $app)
{
$controllers = $app['controllers_factory'];
$controllers->get('/', function() use ($app) {
require_once __DIR__ . '/../../../../bootstrap.php';
$upgrade_status = \Setup_Upgrade::get_status();
return $app['twig']->render(
'/setup/upgrader.html.twig'
, array(
'locale' => $app['locale']
, 'upgrade_status' => $upgrade_status
, 'available_locales' => $app->getAvailableLanguages()
, 'bad_users' => \User_Adapter::get_wrong_email_users($app)
, 'version_number' => $app['phraseanet.version']->getNumber()
, 'version_name' => $app['phraseanet.version']->getName()
)
);
});
$controllers->get('/status/', function(Application $app) {
require_once __DIR__ . '/../../../../bootstrap.php';
return $app->json(\Setup_Upgrade::get_status());
});
$controllers->post('/execute/', function(Application $app) {
require_once __DIR__ . '/../../../../bootstrap.php';
set_time_limit(0);
session_write_close();
ignore_user_abort(true);
$upgrader = new \Setup_Upgrade($app);
$app['phraseanet.appbox']->forceUpgrade($upgrader, $app);
/**
* @todo Show recomandation instead of redirect
*/
return $app->redirect('/');
});
return $controllers;
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace Alchemy\Phrasea\Setup;
use Alchemy\Phrasea\Application;
class ConfigurationTester
{
private $app;
private $probes;
private $versionProbes;
public function __construct(Application $app)
{
$this->app = $app;
}
public function registerProbe(ProbeInterface $probe)
{
$this->probes[] = $probe;
}
public function isInstalled()
{
return file_exists(__DIR__ . '/../../../../config/config.yml')
&& file_exists(__DIR__ . '/../../../../config/connexions.yml')
&& file_exists(__DIR__ . '/../../../../config/services.yml');
}
public function probeIsMigrable()
{
}
}

View File

@@ -38,8 +38,4 @@ class module_console_aboutAuthors extends Command
return 0;
}
public function requireSetup()
{
return false;
}
}

View File

@@ -37,9 +37,4 @@ class module_console_aboutLicense extends Command
return 0;
}
public function requireSetup()
{
return false;
}
}

View File

@@ -36,11 +36,6 @@ class module_console_checkExtension extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
if ( ! extension_loaded('phrasea2')) {

View File

@@ -35,11 +35,6 @@ class module_console_fieldsDelete extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
try {

View File

@@ -31,11 +31,6 @@ class module_console_fieldsList extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {

View File

@@ -45,11 +45,6 @@ class module_console_fieldsMerge extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$output->writeln("");

View File

@@ -36,11 +36,6 @@ class module_console_fieldsRename extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$new_name = $input->getArgument('name');

View File

@@ -57,11 +57,6 @@ class module_console_fileEnsureDevSetting extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$this->configuration = $this->container['phraseanet.configuration'];

View File

@@ -57,11 +57,6 @@ class module_console_fileEnsureProductionSetting extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$this->configuration = $this->container['phraseanet.configuration'];

View File

@@ -34,11 +34,6 @@ class module_console_schedulerStart extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$logger = new Logger('Task logger');

View File

@@ -49,16 +49,9 @@ class module_console_schedulerState extends Command
return $this;
}
public function requireSetup()
{
return false;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
try {
$this->checkSetup();
} catch (\RuntimeException $e) {
if (!$this->container['phraseanet.configuration']->isInstalled()) {
return self::EXITCODE_SETUP_ERROR;
}

View File

@@ -31,11 +31,6 @@ class module_console_schedulerStop extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
try {

View File

@@ -31,11 +31,6 @@ class module_console_sphinxGenerateSuggestion extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
define('FREQ_THRESHOLD', 10);

View File

@@ -38,11 +38,6 @@ class module_console_systemBackupDB extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$output->write('Phraseanet is going to be backup...', true);

View File

@@ -32,11 +32,6 @@ class module_console_systemClearCache extends Command
return $this;
}
public function requireSetup()
{
return false;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$finder = new Finder();

View File

@@ -32,11 +32,6 @@ class module_console_systemConfigCheck extends Command
return $this;
}
public function requireSetup()
{
return false;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
if ( ! function_exists('_')) {

View File

@@ -71,11 +71,6 @@ class module_console_systemExport extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$docPerDir = max(1, (int) $input->getOption('docperdir'));

View File

@@ -37,11 +37,6 @@ class module_console_systemMailCheck extends Command
return $this;
}
public function requireSetup()
{
return true;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$output->writeln("Processing...");

View File

@@ -33,11 +33,6 @@ class module_console_systemTemplateGenerator extends Command
return $this;
}
public function requireSetup()
{
return false;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$tplDirs = array(

View File

@@ -36,51 +36,22 @@ class module_console_systemUpgrade extends Command
return $this;
}
public function requireSetup()
{
return false;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php';
$interactive = !$input->getOption('yes');
if (!$this->container['phraseanet.configuration']->isInstalled() && \setup::needUpgradeConfigurationFile()) {
if ($interactive) {
$output->writeln('This version of Phraseanet requires a config/config.yml, config/connexion.yml, config/service.yml');
$output->writeln('Would you like it to be created based on your settings ?');
$dialog = $this->getHelperSet()->get('dialog');
do {
$continue = mb_strtolower($dialog->ask($output, '<question>' . _('Create automatically') . ' (Y/n)</question>', 'y'));
} while (!in_array($continue, array('y', 'n')));
} else {
$continue = 'y';
}
if ($continue == 'y') {
try {
if (\setup::requireGVUpgrade()) {
setup::upgradeGV($this->container['phraseanet.registry']);
}
$connexionInc = new \SplFileInfo(__DIR__ . '/../../../../config/connexion.inc');
$configInc = new \SplFileInfo(__DIR__ . '/../../../../config/config.inc');
$this->getService('phraseanet.configuration')->upgradeFromOldConf($configInc, $connexionInc);
} catch (\Exception $e) {
throw new RuntimeException('Error while upgrading : ' . $e->getMessage());
}
} else {
throw new RuntimeException('Phraseanet is not set up');
while ($migrations = $this->container['phraseanet.configuration-tester']->getMigrations()) {
foreach ($migrations as $migration) {
echo get_class($migration) . "\n";
$migration->migrate();
echo get_class($migration) . " finished\n";
}
}
if ( ! $this->getService('phraseanet.configuration')->isInstalled()) {
throw new \RuntimeException('Phraseanet must be set-up (no connexion.inc / no config.inc)');
if (!$this->getService('phraseanet.configuration')->isInstalled()) {
throw new \RuntimeException('Phraseanet must be set-up');
}
$output->write('Phraseanet is going to be upgraded', true);

View File

@@ -57,16 +57,9 @@ class module_console_taskState extends Command
return $this;
}
public function requireSetup()
{
return false;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
try {
$this->checkSetup();
} catch (\RuntimeException $e) {
if (!$this->container['phraseanet.configuration']->isInstalled()) {
return self::EXITCODE_SETUP_ERROR;
}

View File

@@ -32,16 +32,9 @@ class module_console_tasklist extends Command
return $this;
}
public function requireSetup()
{
return false;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
try {
$this->checkSetup();
} catch (\RuntimeException $e) {
if (!$this->container['phraseanet.configuration']->isInstalled()) {
return self::EXITCODE_SETUP_ERROR;
}

View File

@@ -63,16 +63,9 @@ class module_console_taskrun extends Command
}
}
public function requireSetup()
{
return false;
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
try {
$this->checkSetup();
} catch (\RuntimeException $e) {
if (!$this->container['phraseanet.configuration']->isInstalled()) {
return self::EXITCODE_SETUP_ERROR;
}

View File

@@ -1,124 +0,0 @@
{% extends '/setup/wrapper.html.twig' %}
{% block extrahead %}
<script type="text/javascript">
{% if upgrade_status.active %}
function update_status()
{
$.ajax({
type: "GET",
url: '/setup/upgrader/status/',
dataType:'json',
beforeSend:function(){
},
success: function(datas){
var percent = Math.round(datas.percentage * 100);
$('#progress_meter .gauge').stop().animate({width:percent + '%'});
$('#progress_meter .counter').empty().append(datas.completed_steps + ' / ' + datas.total_steps);
var update = $('#message_update');
update.empty().append(datas.message);
if(percent < 100)
setTimeout("update_status();", 1000);
else
setTimeout("document.location.href = document.location.href",1000);
return;
},
timeout:function(){
setTimeout("document.location.href = document.location.href",1000);
},
error:function(datas){
setTimeout("document.location.href = document.location.href",1000);
}
});
}
{% endif %}
$(document).ready(function(){
$('.update_button').bind('click', function(){
$(this).attr('disabled','disbaled');
$('.upgrade_loader').show();
setTimeout("document.location.href = document.location.href",1000);
});
{% if upgrade_status.active %}
update_status();
{% endif %}
});
</script>
{% endblock %}
{% block content %}
<div class="steps">
<div class="wrapper">
<div class="PNB10 wrapper_left">
<div class="PNB10 section_title">
<h2>
{% trans 'Mise a jour' %}
</h2>
</div>
<div class="PNB10" style="top:50px;overflow-x:hidden;">
<table class="main_content_wrapper">
<tr>
<td>
<table class="main_content_table">
<tr>
<td>
{% if not upgrade_status.active %}
{% if bad_users|length > 0 %}
<p>
{% trans 'Before any upgrade, you have to fix your database.' %}
{% trans 'Some users have the same email address. You can fix this problem with this script :' %}
</p>
<p>
<code style="width:90%">
{{app['phraseanet.registry'].get('GV_cli')}} {% if app['phraseanet.registry'].get('GV_PHP_INI') %} -c {{app['phraseanet.registry'].get('GV_PHP_INI')}}{% endif %} bin/console system:mailCheck
</code>
</p>
{% else %}
<p>
{% trans 'Une mise a jour de l\'application est necessaire, il est vivement recommande de l\'effectuer en ligne de commande via la commande :' %}
</p>
<p>
<code style="width:90%">
{{app['phraseanet.registry'].get('GV_cli')}} {% if app['phraseanet.registry'].get('GV_PHP_INI') %} -c {{app['phraseanet.registry'].get('GV_PHP_INI')}}{% endif %} bin/console system:upgrade
</code>
</p>
<p>
{% trans 'Si toutefois vous n\'aviez pas acces à la console, suivez le lien suivant' %}
</p>
<p>
<form action="/setup/upgrader/execute/" method="POST" target="update_target">
<button class="update_button">{% trans 'Mise a jour' %}</button>
<img style="display:none;" class="upgrade_loader" src="/skins/icons/loader111111.gif"/>
</form>
<iframe style="display:none;" src="about:blank" name="update_target"></iframe>
</p>
{% endif %}
{% else %}
<p>{% trans 'Progression de la mise a jour : ' %}</p>
<div id="progress_meter" style="text-align:center;width:100%;height:26px;border:1px solid #404040;position:relative;">
{% set percentage = upgrade_status.percentage * 100 %}
<div class="gauge" style="position:absolute;background-color:#404040;left:0;top:0;bottom:0;width:{{percentage}}%;z-index:3;">
</div>
<div class="counter" style="position:absolute;left:0;top:0;bottom:0;right:0;color:white;z-index:4;font-wieght:bold;font-size:1.3em;">
{{ upgrade_status.completed_steps }} / {{ upgrade_status.total_steps }}
</div>
</div>
<p id="message_update">{{upgrade_status.message}}</p>
{% endif %}
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
{% endblock %}