mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 19:43:16 +00:00
Change Version to non-static
This commit is contained in:
@@ -49,6 +49,7 @@ use Alchemy\Phrasea\SearchEngine\SearchEngineInterface;
|
|||||||
|
|
||||||
require_once __DIR__ . '/../lib/autoload.php';
|
require_once __DIR__ . '/../lib/autoload.php';
|
||||||
|
|
||||||
|
$version = new Version();
|
||||||
$cli = new CLI("
|
$cli = new CLI("
|
||||||
_____ _ _ _____ _____ ______ _ _ ______ _______
|
_____ _ _ _____ _____ ______ _ _ ______ _______
|
||||||
| __ \| | | | __ \ /\ / ____| ____| /\ | \ | | ____|__ __|
|
| __ \| | | | __ \ /\ / ____| ____| /\ | \ | | ____|__ __|
|
||||||
@@ -65,7 +66,7 @@ $cli = new CLI("
|
|||||||
This program comes with ABSOLUTELY NO WARRANTY.
|
This program comes with ABSOLUTELY NO WARRANTY.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `about:license' for details.\n\n"
|
under certain conditions; type `about:license' for details.\n\n"
|
||||||
. ' KONSOLE KOMMANDER', Version::getName() . ' ' . Version::getNumber());
|
. ' KONSOLE KOMMANDER', $version->getName() . ' ' . $version->getNumber());
|
||||||
|
|
||||||
if (!$cli['phraseanet.configuration-tester']->isInstalled()) {
|
if (!$cli['phraseanet.configuration-tester']->isInstalled()) {
|
||||||
throw new \RuntimeException('Phraseanet is not installed, use setup command instead');
|
throw new \RuntimeException('Phraseanet is not installed, use setup command instead');
|
||||||
|
@@ -55,6 +55,7 @@ use Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand;
|
|||||||
|
|
||||||
require_once __DIR__ . '/../lib/autoload.php';
|
require_once __DIR__ . '/../lib/autoload.php';
|
||||||
|
|
||||||
|
$version = new Version();
|
||||||
$cli = new CLI("
|
$cli = new CLI("
|
||||||
___ ___ _ _ ___ __ __ ___ ___ ___ ____ __ __ __ ___
|
___ ___ _ _ ___ __ __ ___ ___ ___ ____ __ __ __ ___
|
||||||
( \( _)( )( )( _)( ) / \( ,\( _)( ,) (_ _)/ \ / \( ) / __)
|
( \( _)( )( )( _)( ) / \( ,\( _)( ,) (_ _)/ \ / \( ) / __)
|
||||||
@@ -65,7 +66,7 @@ $cli = new CLI("
|
|||||||
This program comes with ABSOLUTELY NO WARRANTY.
|
This program comes with ABSOLUTELY NO WARRANTY.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `about:license' for details.\n\n"
|
under certain conditions; type `about:license' for details.\n\n"
|
||||||
. ' Phraseanet Developer Tools ', Version::getName() . ' ' . Version::getNumber());
|
. ' Phraseanet Developer Tools ', $version->getName() . ' ' . $version->getNumber());
|
||||||
|
|
||||||
if ($cli['configuration.store']->isSetup()) {
|
if ($cli['configuration.store']->isSetup()) {
|
||||||
$helpers = [
|
$helpers = [
|
||||||
|
@@ -27,6 +27,7 @@ use Alchemy\Phrasea\Core\CLIProvider\DoctrineMigrationServiceProvider;
|
|||||||
|
|
||||||
require_once __DIR__ . '/../vendor/autoload.php';
|
require_once __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
|
$version = new Version();
|
||||||
$app = new CLI("
|
$app = new CLI("
|
||||||
_____ _ _ _____ _____ ______ _ _ ______ _______
|
_____ _ _ _____ _____ ______ _ _ ______ _______
|
||||||
| __ \| | | | __ \ /\ / ____| ____| /\ | \ | | ____|__ __|
|
| __ \| | | | __ \ /\ / ____| ____| /\ | \ | | ____|__ __|
|
||||||
@@ -45,7 +46,7 @@ $app = new CLI("
|
|||||||
This program comes with ABSOLUTELY NO WARRANTY.
|
This program comes with ABSOLUTELY NO WARRANTY.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `about:license' for details.\n\n"
|
under certain conditions; type `about:license' for details.\n\n"
|
||||||
. ' SETUP', Version::getName() . ' ' . Version::getNumber());
|
. ' SETUP', $version->getName() . ' ' . $version->getNumber());
|
||||||
|
|
||||||
$app->register(new DoctrineMigrationServiceProvider());
|
$app->register(new DoctrineMigrationServiceProvider());
|
||||||
|
|
||||||
|
@@ -209,10 +209,11 @@ class IniReset extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($input->getOption('run-patches') || false === $this->container['phraseanet.configuration']->isUpToDate()) {
|
if ($input->getOption('run-patches') || false === $this->container['phraseanet.configuration']->isUpToDate()) {
|
||||||
|
$version = new Version();
|
||||||
if ($input->getOption('run-patches')) {
|
if ($input->getOption('run-patches')) {
|
||||||
$output->write(sprintf('Upgrading... from version <info>3.1.21</info> to <info>%s</info>', Version::getNumber()), true);
|
$output->write(sprintf('Upgrading... from version <info>3.1.21</info> to <info>%s</info>', $version->getNumber()), true);
|
||||||
} else {
|
} else {
|
||||||
$output->write(sprintf('Upgrading... from version <info>%s</info> to <info>%s</info>', $this->app['phraseanet.appbox']->get_version(), Version::getNumber()), true);
|
$output->write(sprintf('Upgrading... from version <info>%s</info> to <info>%s</info>', $this->app['phraseanet.appbox']->get_version(), $version->getNumber()), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmd = 'php ' . __DIR__ . '/../../../../../bin/setup system:upgrade -y -f -v';
|
$cmd = 'php ' . __DIR__ . '/../../../../../bin/setup system:upgrade -y -f -v';
|
||||||
|
@@ -13,7 +13,6 @@ namespace Alchemy\Phrasea\Controller\Api;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\Authentication\Context;
|
use Alchemy\Phrasea\Authentication\Context;
|
||||||
use Alchemy\Phrasea\Border\Attribute\Status;
|
use Alchemy\Phrasea\Border\Attribute\Status;
|
||||||
use Alchemy\Phrasea\Border\Checker\CheckerInterface;
|
|
||||||
use Alchemy\Phrasea\Border\File;
|
use Alchemy\Phrasea\Border\File;
|
||||||
use Alchemy\Phrasea\Border\Manager as BorderManager;
|
use Alchemy\Phrasea\Border\Manager as BorderManager;
|
||||||
use Alchemy\Phrasea\Border\Manager;
|
use Alchemy\Phrasea\Border\Manager;
|
||||||
|
@@ -13,16 +13,16 @@ namespace Alchemy\Phrasea\Core;
|
|||||||
|
|
||||||
class Version
|
class Version
|
||||||
{
|
{
|
||||||
protected static $number = '3.9.0-alpha.20';
|
private $number = '3.9.0-alpha.20';
|
||||||
protected static $name = 'Herrerasaurus';
|
private $name = 'Herrerasaurus';
|
||||||
|
|
||||||
public static function getNumber()
|
public function getNumber()
|
||||||
{
|
{
|
||||||
return static::$number;
|
return $this->number;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return static::$name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,8 @@ class WebhookJob extends AbstractJob
|
|||||||
parent::__construct($dispatcher, $logger, $translator);
|
parent::__construct($dispatcher, $logger, $translator);
|
||||||
|
|
||||||
$this->httpClient = $httpClient ?: new GuzzleClient();
|
$this->httpClient = $httpClient ?: new GuzzleClient();
|
||||||
$this->httpClient->setUserAgent(sprintf('Phraseanet/%s (%s)', Version::getNumber(), Version::getName()));
|
$version = new Version();
|
||||||
|
$this->httpClient->setUserAgent(sprintf('Phraseanet/%s (%s)', $version->getNumber(), $version->getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -60,7 +60,8 @@ class module_console_systemUpgrade extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($continue == 'y') {
|
if ($continue == 'y') {
|
||||||
$output->write(sprintf('Upgrading... from version <info>%s</info> to <info>%s</info>', $this->container['phraseanet.appbox']->get_version(), Version::getNumber()), true);
|
$version = new Version();
|
||||||
|
$output->write(sprintf('Upgrading... from version <info>%s</info> to <info>%s</info>', $this->container['phraseanet.appbox']->get_version(), $version->getNumber()), true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$upgrader = new Setup_Upgrade($this->container, $input->getOption('force'));
|
$upgrader = new Setup_Upgrade($this->container, $input->getOption('force'));
|
||||||
|
@@ -4,18 +4,20 @@ namespace Alchemy\Tests\Phrasea\Core;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\Core\Version;
|
use Alchemy\Phrasea\Core\Version;
|
||||||
|
|
||||||
class VersionTest extends \PhraseanetTestCase
|
class VersionTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testGetNumber()
|
public function testGetNumber()
|
||||||
{
|
{
|
||||||
$this->assertTrue(is_string(Version::getNumber()));
|
$version = new Version();
|
||||||
$this->assertRegExp('/[\d]{1}\.[\d]{1,2}\.[\d]{1,2}/', Version::getNumber());
|
$this->assertTrue(is_string($version->getNumber()));
|
||||||
|
$this->assertRegExp('/[\d]{1}\.[\d]{1,2}\.[\d]{1,2}/', $version->getNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetName()
|
public function testGetName()
|
||||||
{
|
{
|
||||||
$this->assertTrue(is_string(Version::getName()));
|
$version = new Version();
|
||||||
$this->assertTrue(strlen(Version::getName()) > 3);
|
$this->assertTrue(is_string($version->getName()));
|
||||||
|
$this->assertTrue(strlen($version->getName()) > 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -90,10 +90,8 @@ class ConfigurationTesterTest extends AbstractSetupTester
|
|||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
/**
|
// Must return version + 1
|
||||||
* Must return version + 1
|
$app['phraseanet.version']->expects($this->any())
|
||||||
*/
|
|
||||||
$app['phraseanet.version']::staticExpects($this->any())
|
|
||||||
->method('getNumber')
|
->method('getNumber')
|
||||||
->will($this->returnValue('3.10'));
|
->will($this->returnValue('3.10'));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user