mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 10:23:17 +00:00
Merge branch '3.6' of github.com:alchemy-fr/Phraseanet into 3.6
This commit is contained in:
@@ -22,7 +22,6 @@ require_once __DIR__ . '/../../../bootstrap.php';
|
|||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
* @link www.phraseanet.com
|
* @link www.phraseanet.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return call_user_func(function()
|
return call_user_func(function()
|
||||||
{
|
{
|
||||||
$app = new Silex\Application();
|
$app = new Silex\Application();
|
||||||
@@ -39,10 +38,48 @@ return call_user_func(function()
|
|||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
|
|
||||||
if (!$appbox->need_major_upgrade())
|
if (!$appbox->need_major_upgrade())
|
||||||
|
{
|
||||||
throw new Exception_Setup_PhraseaAlreadyInstalled();
|
throw new Exception_Setup_PhraseaAlreadyInstalled();
|
||||||
|
}
|
||||||
|
|
||||||
$app['upgrade'] = true;
|
$app['upgrade'] = true;
|
||||||
}
|
}
|
||||||
|
elseif (\setup::needUpgradeConfigurationFile())
|
||||||
|
{
|
||||||
|
//copy sample
|
||||||
|
$file = __DIR__ . "/../../../../config/config.sample.yml";
|
||||||
|
$file1 = __DIR__ . "/../../../../config/config.yml";
|
||||||
|
if (!copy($file, $file1))
|
||||||
|
{
|
||||||
|
throw new \Exception(sprintf("Unable to copy %s", $file1));
|
||||||
|
}
|
||||||
|
|
||||||
|
//get connexion credentials
|
||||||
|
$conn = \connection::getPDOConnection();
|
||||||
|
$credentials = $conn->get_credentials();
|
||||||
|
|
||||||
|
//get configuration object
|
||||||
|
$app = new \Alchemy\Phrasea\Core\Configuration\Application();
|
||||||
|
$parser = new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml();
|
||||||
|
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler($app, $parser);
|
||||||
|
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||||
|
|
||||||
|
//refactor credentials
|
||||||
|
$connexionINI = array();
|
||||||
|
foreach ($credentials as $key => $value)
|
||||||
|
{
|
||||||
|
$key = $key == 'hostname' ? 'host' : $key;
|
||||||
|
$connexionINI[$key] = (string) $value;
|
||||||
|
}
|
||||||
|
//write credentials to config file
|
||||||
|
$configuration->setAllDatabaseConnexion($connexionINI);
|
||||||
|
$request = $app["request"];
|
||||||
|
//write servername
|
||||||
|
$serverName = $request->getScheme() . '://' . $request->getHttpHost() . '/';
|
||||||
|
$configuration->setServerName($serverName);
|
||||||
|
|
||||||
|
$app->redirect("/");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$app['install'] = true;
|
$app['install'] = true;
|
||||||
|
|||||||
@@ -175,6 +175,31 @@ class Installer implements ControllerProviderInterface
|
|||||||
$setupRegistry->set('GV_ServerName', $servername);
|
$setupRegistry->set('GV_ServerName', $servername);
|
||||||
$appbox = \appbox::create($setupRegistry, $conn, $appbox_name, true);
|
$appbox = \appbox::create($setupRegistry, $conn, $appbox_name, true);
|
||||||
|
|
||||||
|
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
||||||
|
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
||||||
|
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
||||||
|
);
|
||||||
|
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||||
|
if ($configuration->isInstalled())
|
||||||
|
{
|
||||||
|
// Get Entity Manager using the new configuration
|
||||||
|
$doctrineConf = $configuration->getDoctrine()->all();
|
||||||
|
$doctrine = new \Alchemy\Phrasea\Core\Service\Doctrine($doctrineConf);
|
||||||
|
|
||||||
|
$em = $doctrine->getEntityManager();
|
||||||
|
/* @var $em \Doctrine\ORM\EntityManager */
|
||||||
|
|
||||||
|
$metadatas = $em->getMetadataFactory()->getAllMetadata();
|
||||||
|
|
||||||
|
if (!empty($metadatas))
|
||||||
|
{
|
||||||
|
// Create SchemaTool
|
||||||
|
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
|
||||||
|
// Create schema
|
||||||
|
$tool->createSchema($metadatas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$registry = \registry::get_instance();
|
$registry = \registry::get_instance();
|
||||||
\setup::create_global_values($registry);
|
\setup::create_global_values($registry);
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,12 @@ class setup
|
|||||||
return is_file($appConf->getConfigurationPathName());
|
return is_file($appConf->getConfigurationPathName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function needUpgradeConfigurationFile()
|
||||||
|
{
|
||||||
|
return (is_file(__DIR__ . "/../../conf/connexion.inc")
|
||||||
|
&& is_file(__DIR__ . "/../../config.inc"));
|
||||||
|
}
|
||||||
|
|
||||||
function create_global_values(registryInterface &$registry, $datas=array())
|
function create_global_values(registryInterface &$registry, $datas=array())
|
||||||
{
|
{
|
||||||
require(__DIR__ . "/../../lib/conf.d/_GV_template.inc");
|
require(__DIR__ . "/../../lib/conf.d/_GV_template.inc");
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
, 'imgtools' => '1'
|
, 'imgtools' => '1'
|
||||||
, 'manage' => '1'
|
, 'manage' => '1'
|
||||||
, 'modify_struct' => '1'
|
, 'modify_struct' => '1'
|
||||||
, 'bas_manage' => '1'
|
, 'manage' => '1'
|
||||||
, 'bas_modify_struct' => '1'
|
, 'bas_modify_struct' => '1'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var $current = $this.closest('.steps');
|
var $current = $this.closest('.steps');
|
||||||
$('.databox_creation_input', $current).attr('disabled', $this.attr('checked'));
|
$('.databox_creation_input', $current).attr('disabled', $this.attr('checked'));
|
||||||
|
$('.db_tester', $current).attr('disabled', $this.attr('checked')).toggleClass( "ui-state-disabled", $this.attr('checked') );
|
||||||
});
|
});
|
||||||
$('.ab_opt_toggler').bind('click', function(){
|
$('.ab_opt_toggler').bind('click', function(){
|
||||||
$('.optional_ab_datas').fadeToggle();
|
$('.optional_ab_datas').fadeToggle();
|
||||||
@@ -126,7 +127,7 @@
|
|||||||
{
|
{
|
||||||
test_connection_appbox(callback);
|
test_connection_appbox(callback);
|
||||||
}
|
}
|
||||||
else if($current.hasClass('databox_settings'))
|
else if($current.hasClass('databox_settings') && $('.databox_create', $current).is(':not(:checked)'))
|
||||||
{
|
{
|
||||||
test_connection_databox(callback);
|
test_connection_databox(callback);
|
||||||
}
|
}
|
||||||
@@ -236,10 +237,10 @@
|
|||||||
if(datas.connection === true && datas.database === true)
|
if(datas.connection === true && datas.database === true)
|
||||||
{
|
{
|
||||||
el_status.attr('src','/skins/icons/ok.png').show();
|
el_status.attr('src','/skins/icons/ok.png').show();
|
||||||
el_message.empty().append('{% trans 'Successfull connection' %}');
|
el_message.empty().append("{% trans 'Successfull connection' %}");
|
||||||
if(!datas.is_empty)
|
if(!datas.is_empty)
|
||||||
{
|
{
|
||||||
el_message.append('<br>{% trans 'Warning, this database is not empty' %}');
|
el_message.append("<br>{% trans 'Warning, this database is not empty' %}");
|
||||||
el_status.attr('src','/skins/icons/alert.png').show();
|
el_status.attr('src','/skins/icons/alert.png').show();
|
||||||
}
|
}
|
||||||
if(typeof callback == 'function')
|
if(typeof callback == 'function')
|
||||||
@@ -249,11 +250,11 @@
|
|||||||
}
|
}
|
||||||
if(datas.connection === true)
|
if(datas.connection === true)
|
||||||
{
|
{
|
||||||
el_message.empty().append('{% trans 'Connection is OK but database does not exists or can not be accessed' %}');
|
el_message.empty().append("{% trans 'Connection is OK but database does not exists or can not be accessed' %}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
el_message.empty().append('{% trans 'Unable to connect to MySQL server' %}');
|
el_message.empty().append("{% trans 'Unable to connect to MySQL server' %}");
|
||||||
}
|
}
|
||||||
el_status.attr('src', '/skins/icons/delete.png').show();
|
el_status.attr('src', '/skins/icons/delete.png').show();
|
||||||
|
|
||||||
@@ -262,12 +263,12 @@
|
|||||||
timeout:function(){
|
timeout:function(){
|
||||||
el_loader.css('visibility', 'hidden');
|
el_loader.css('visibility', 'hidden');
|
||||||
el_status.attr('src', '/skins/icons/delete.png').show();
|
el_status.attr('src', '/skins/icons/delete.png').show();
|
||||||
el_message.empty().append('{% trans 'Unable to connect to MySQL server' %}');
|
el_message.empty().append("{% trans 'Unable to connect to MySQL server' %}");
|
||||||
},
|
},
|
||||||
error:function(datas){
|
error:function(datas){
|
||||||
el_loader.css('visibility', 'hidden');
|
el_loader.css('visibility', 'hidden');
|
||||||
el_status.attr('src', '/skins/icons/delete.png').show();
|
el_status.attr('src', '/skins/icons/delete.png').show();
|
||||||
el_message.empty().append('{% trans 'Unable to connect to MySQL server' %}');
|
el_message.empty().append("{% trans 'Unable to connect to MySQL server' %}");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user