Add uninstaller for development purposes

This commit is contained in:
Romain Neutron
2013-10-04 17:16:24 +02:00
parent 8af5b3f610
commit 6345fcc83a
4 changed files with 77 additions and 2 deletions

View File

@@ -9,7 +9,6 @@ services:
- redis
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
- npm --version
- npm install
@@ -21,6 +20,7 @@ before_script:
- echo 'extension="memcached.so"' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/memcached.ini
- composer self-update
- composer install --dev --prefer-source
- bin/developer system:uninstall
- wget http://sphinxsearch.com/files/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"

View File

@@ -19,6 +19,7 @@ use Alchemy\Phrasea\Command\Developer\InstallAll;
use Alchemy\Phrasea\Command\Developer\LessCompiler;
use Alchemy\Phrasea\Command\Developer\RegenerateSqliteDb;
use Alchemy\Phrasea\Command\Developer\RoutesDumper;
use Alchemy\Phrasea\Command\Developer\Uninstaller;
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
@@ -75,6 +76,7 @@ $cli->command(new APIRoutesDumper());
$cli->command(new RoutesDumper());
$cli->command(new Behat());
$cli->command(new LessCompiler());
$cli->command(new Uninstaller());
$cli->command(new \module_console_systemTemplateGenerator('system:generate-templates'));

View File

@@ -1,4 +1,6 @@
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/_GV.php config/ || exit 1
npm install -g uglify-js recess grunt-cli jake

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;
}
}