mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 02:13:15 +00:00
Merge branch '3.6' of github.com:alchemy-fr/Phraseanet into 3.6
This commit is contained in:
@@ -22,11 +22,10 @@ require_once __DIR__ . '/../../../bootstrap.php';
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
|
||||
return call_user_func(function()
|
||||
{
|
||||
$app = new Silex\Application();
|
||||
|
||||
|
||||
$app['Core'] = bootstrap::getCore();
|
||||
|
||||
$app['install'] = false;
|
||||
@@ -39,10 +38,48 @@ return call_user_func(function()
|
||||
$appbox = appbox::get_instance();
|
||||
|
||||
if (!$appbox->need_major_upgrade())
|
||||
{
|
||||
throw new Exception_Setup_PhraseaAlreadyInstalled();
|
||||
}
|
||||
|
||||
$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
|
||||
{
|
||||
$app['install'] = true;
|
||||
|
||||
@@ -170,16 +170,41 @@ class Installer implements ControllerProviderInterface
|
||||
|
||||
try
|
||||
{
|
||||
$servername = $request->getScheme() . '://' . $request->getHttpHost() . '/';
|
||||
$setupRegistry = new \Setup_Registry();
|
||||
$setupRegistry->set('GV_ServerName', $servername);
|
||||
$appbox = \appbox::create($setupRegistry, $conn, $appbox_name, true);
|
||||
$servername = $request->getScheme() . '://' . $request->getHttpHost() . '/';
|
||||
$setupRegistry = new \Setup_Registry();
|
||||
$setupRegistry->set('GV_ServerName', $servername);
|
||||
$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();
|
||||
\setup::create_global_values($registry);
|
||||
|
||||
$appbox->set_registry($registry);
|
||||
|
||||
|
||||
$registry->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->get('datapath_noweb')));
|
||||
$registry->set('GV_base_datapath_web', \p4string::addEndSlash($request->get('datapath_web')));
|
||||
$registry->set('GV_base_dataurl', \p4string::addEndSlash($request->get('mount_point_web')));
|
||||
|
||||
@@ -69,10 +69,16 @@ class setup
|
||||
public static function is_installed()
|
||||
{
|
||||
$appConf = new \Alchemy\Phrasea\Core\Configuration\Application();
|
||||
|
||||
|
||||
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())
|
||||
{
|
||||
require(__DIR__ . "/../../lib/conf.d/_GV_template.inc");
|
||||
|
||||
@@ -452,7 +452,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
, 'imgtools' => '1'
|
||||
, 'manage' => '1'
|
||||
, 'modify_struct' => '1'
|
||||
, 'bas_manage' => '1'
|
||||
, 'manage' => '1'
|
||||
, 'bas_modify_struct' => '1'
|
||||
);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
var $this = $(this);
|
||||
var $current = $this.closest('.steps');
|
||||
$('.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(){
|
||||
$('.optional_ab_datas').fadeToggle();
|
||||
@@ -121,12 +122,12 @@
|
||||
setTimeout("$('form#create_admin').submit();",500);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if($current.hasClass('appbox_settings'))
|
||||
{
|
||||
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);
|
||||
}
|
||||
@@ -194,7 +195,7 @@
|
||||
var password_input = $('input[name="ab_password"]', appbox_scope);
|
||||
|
||||
var dbname_input = $('input[name="db_name"]', databox_scope);
|
||||
|
||||
|
||||
var user = user_input.val();
|
||||
var password = password_input.val();
|
||||
var dbname = dbname_input.val();
|
||||
@@ -236,10 +237,10 @@
|
||||
if(datas.connection === true && datas.database === true)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
if(typeof callback == 'function')
|
||||
@@ -249,11 +250,11 @@
|
||||
}
|
||||
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
|
||||
{
|
||||
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();
|
||||
|
||||
@@ -262,12 +263,12 @@
|
||||
timeout:function(){
|
||||
el_loader.css('visibility', 'hidden');
|
||||
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){
|
||||
el_loader.css('visibility', 'hidden');
|
||||
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