Add uninstaller for development purposes

This commit is contained in:
Romain Neutron
2013-10-04 17:16:24 +02:00
parent 1d780c4f3e
commit 0a950b0ae6
4 changed files with 77 additions and 3 deletions

View File

@@ -9,7 +9,6 @@ services:
- redis - redis
before_script: before_script:
- rm -f config/services.yml config/connexions.yml config/config.yml config/config.inc config/connexion.inc config/_GV.php config/_GV.php.old
- node --version - node --version
- npm --version - npm --version
- npm install bower-canary mocha-phantomjs@">=2.0 <3.0" recess@">=1.1.0 <1.1.7" uglify-js -g - npm install bower-canary mocha-phantomjs@">=2.0 <3.0" recess@">=1.1.0 <1.1.7" uglify-js -g
@@ -20,6 +19,7 @@ before_script:
- echo 'extension="memcached.so"' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/memcached.ini - echo 'extension="memcached.so"' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/memcached.ini
- composer self-update - composer self-update
- composer install --dev --prefer-source - composer install --dev --prefer-source
- bin/developer system:uninstall
- wget http://sphinxsearch.com/files/sphinx-2.0.6-release.tar.gz - wget http://sphinxsearch.com/files/sphinx-2.0.6-release.tar.gz
- tar xzf sphinx-2.0.6-release.tar.gz - tar xzf sphinx-2.0.6-release.tar.gz
- sh -c "cd sphinx-2.0.6-release && wget http://snowball.tartarus.org/dist/libstemmer_c.tgz && tar xzf libstemmer_c.tgz && ./configure --with-libstemmer --with-iconv --with-mysql --enable-id64 --quiet && make -j --quiet && sudo make install" - sh -c "cd sphinx-2.0.6-release && wget http://snowball.tartarus.org/dist/libstemmer_c.tgz && tar xzf libstemmer_c.tgz && ./configure --with-libstemmer --with-iconv --with-mysql --enable-id64 --quiet && make -j --quiet && sudo make install"

View File

@@ -20,6 +20,7 @@ use Alchemy\Phrasea\Command\Developer\InstallAll;
use Alchemy\Phrasea\Command\Developer\JavascriptBuilder; use Alchemy\Phrasea\Command\Developer\JavascriptBuilder;
use Alchemy\Phrasea\Command\Developer\RegenerateSqliteDb; use Alchemy\Phrasea\Command\Developer\RegenerateSqliteDb;
use Alchemy\Phrasea\Command\Developer\RoutesDumper; use Alchemy\Phrasea\Command\Developer\RoutesDumper;
use Alchemy\Phrasea\Command\Developer\Uninstaller;
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper; use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper; use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
@@ -77,6 +78,7 @@ $cli->command(new RoutesDumper());
$cli->command(new Behat()); $cli->command(new Behat());
$cli->command(new LessCompiler()); $cli->command(new LessCompiler());
$cli->command(new JavascriptBuilder()); $cli->command(new JavascriptBuilder());
$cli->command(new Uninstaller());
$cli->command(new \module_console_systemTemplateGenerator('system:generate-templates')); $cli->command(new \module_console_systemTemplateGenerator('system:generate-templates'));
$cli['console']->addCommands(array( $cli['console']->addCommands(array(

View File

@@ -1,7 +1,8 @@
rm -f config/configuration.yml config/services.yml config/connexions.yml config/config.yml config/config.inc config/connexion.inc config/_GV.php config/_GV.php.old || exit 1 composer install --dev
./bin/developer dependencies:all || exit 1
./bin/developer system:uninstall || exit 1
cp -f hudson/connexion.inc config/ || exit 1 cp -f hudson/connexion.inc config/ || exit 1
cp -f hudson/_GV.php config/ || exit 1 cp -f hudson/_GV.php config/ || exit 1
./bin/developer dependencies:all || exit 1
sudo mysql -e 'drop database ab_test;drop database db_test; drop database ab_unitTests; drop database db_unitTests;' || exit 1 sudo mysql -e 'drop database ab_test;drop database db_test; drop database ab_unitTests; drop database db_unitTests;' || exit 1
sudo mysql -e 'create database ab_test;create database db_test; create database ab_unitTests; create database db_unitTests;' || exit 1 sudo mysql -e 'create database ab_test;create database db_test; create database ab_unitTests; create database db_unitTests;' || exit 1
sudo mysql -e "GRANT ALL PRIVILEGES ON ab_unitTests.* TO 'phraseaUnitTests'@'localhost' IDENTIFIED BY 'iWvGxPE8' WITH GRANT OPTION" || exit 1 sudo mysql -e "GRANT ALL PRIVILEGES ON ab_unitTests.* TO 'phraseaUnitTests'@'localhost' IDENTIFIED BY 'iWvGxPE8' WITH GRANT OPTION" || exit 1

View File

@@ -0,0 +1,71 @@
<?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\Command\Developer;
use Alchemy\Phrasea\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder;
class Uninstaller extends Command
{
public function __construct()
{
parent::__construct('system:uninstall');
$this->setDescription('Uninstall Phraseanet');
}
/**
* {@inheritdoc}
*/
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$root = $this->container['root.path'];
foreach (array(
$root.'/tmp/configuration-compiled.php',
$root.'/config/configuration.yml',
$root.'/config/services.yml',
$root.'/config/connexions.yml',
$root.'/config/config.yml',
$root.'/config/config.inc',
$root.'/config/connexion.inc',
$root.'/config/_GV.php',
$root.'/config/_GV.php.old',
$root.'/tmp/cache_registry.php',
$root.'/tmp/cache_registry.yml',
) as $file) {
if (is_file($file)) {
unlink($file);
}
}
foreach (array(
$root.'/tmp/serializer',
$root.'/tmp/cache_twig',
$root.'/tmp/cache_minify',
$root.'/tmp/download',
$root.'/tmp/locks',
$root.'/tmp/cache',
) as $dir) {
if (is_dir($dir)) {
$finder = new Finder();
foreach ($finder->files()->in($dir) as $file) {
unlink($file);
}
}
}
return 0;
}
}