Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Rework initial tests and installer.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Oct 7, 2016
1 parent 8aa6a0e commit 531d4f5
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 44 deletions.
47 changes: 21 additions & 26 deletions core/src/core/src/pydio/Tests/startup.phtml
Expand Up @@ -4,17 +4,16 @@
<title>Pydio</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="icon" type="image/x-png" href="AJXP_THEME_FOLDER/images/html-folder.png">
<link rel="icon" type="image/x-png" href="plugins/gui.ajax/res/themes/orbit/images/html-folder.png">
<script src="plugins/gui.ajax/res/js/vendor/prototype/prototype.js" type="text/javascript"></script>
<style>
* {
font-family: Roboto, sans-serif;
}
body {
background-color: #F5F5F5;
background-color: #ECEFF1;
margin: 0;
padding: 20px;
overflow: hidden;
}
h1 {
font-size: 30px;
Expand All @@ -27,13 +26,10 @@

div.mainContainer{
position: relative;
display: block;
border-radius: 4px;
margin: 36px auto;
width: 660px;
height: 80%;
padding: 7px 11px;
color: #535353;
}

p.status{
Expand All @@ -46,32 +42,32 @@
}
p.status a{
display: inline-block;
background-color: #555555;
float: right;
background-color: #009688;
color: white;
text-transform: uppercase;
padding: 5px 10px;
padding: 6px 13px;
text-decoration: none;
border-radius: 3px;
margin: 9px 1px;
border-radius: 1px;
margin: 10px 0;
box-shadow: 0 2px 3px rgba(0,0,0,.16),0 2px 3px rgba(0,0,0,.43);
}
p.status strong{
font-weight: normal;
font-style: italic;
}

div.testList{
font-size: 15px;
margin: 0 auto;
overflow-y: scroll;
background-color: #ffffff;
border-radius: 3px;
box-shadow: 0 0 8px rgba(0,0,0,0.25);
}

div.testLine {
text-align: left;
padding: 15px 15px 9px;
border-bottom: 1px solid #E7E7E7;
margin: 4px 3px;
background-color: #ffffff;
box-shadow: 0 1px 2px rgba(0,0,0,.10),0 1px 1px rgba(0,0,0,.33);
border-radius: 1px;
}
div.testClear{
clear:both;
Expand All @@ -81,8 +77,8 @@
float: left;
width: 80%;
cursor: pointer;
font-size: 20px;
color: #555;
font-size: 16px;
color: #000;
}
div.testName span{
display: none;
Expand All @@ -102,18 +98,17 @@
color: #f90;
}
div.testDescription{
display:none;
font-size: 0.8em;
color: #999;
font-size: 12px;
color: rgba(0, 0, 0, 0.43);
clear: both;
padding: 20px 0 5px;
padding: 9px 0 5px;
font-weight: 500;
}
div.testDescription.visible
{
display: block;
}
p.suggestion{
font-size:0.9em;
margin:5px 0 0;
}

Expand All @@ -128,11 +123,11 @@
<?php
if ($showSkipLink) {
if (count($ALL_ROWS["warning"]) && !count($ALL_ROWS["error"])) {
echo "<p class='status statusWarning'><strong>Status</strong> : You have some warnings, but no fatal error detected, Pydio should run ok. <br/>Please review the warnings, and <a href='?ignore_tests=true'>click here to continue to Pydio</a>.</p>";
echo "<p class='status statusWarning'><strong>Status</strong> : You have some warnings, but no fatal error detected, Pydio should run ok. <br/>Please review the warnings. <a href='?ignore_tests=true'>Continue to Pydio Installation</a></p>";
} else if(count($ALL_ROWS["error"])) {
echo "<p class='status statusError'><strong>Status</strong> : <b>You have some errors</b> that may prevent Pydio from running. Please review the error lines to check what action you should do. If you want to skip this step, simply <a href='?ignore_tests=true'>click here to continue to Pydio</a>.</p>";
echo "<p class='status statusError'><strong>Status</strong> : <b>You have some errors</b> that may prevent Pydio from running. Please review the error lines to check what action you should do. <a href='?ignore_tests=true'>Ignore and continue to Pydio</a>.</p>";
}else{
echo "<p class='status'><strong>Status</strong> : <b>No specific errors</b> were detected, your Pydio installation should run smoothly! <br/><a href='?ignore_tests=true'>Click there to continue to Pydio</a></p>";
echo "<p class='status'><strong>Status</strong> : <b>No specific errors</b> were detected, your Pydio installation should run smoothly! <br/><a href='?ignore_tests=true'>Continue to Pydio Installation!</a></p>";
}
}
?>
Expand Down
49 changes: 32 additions & 17 deletions core/src/plugins/boot.conf/BootConfLoader.php
Expand Up @@ -146,17 +146,18 @@ public function printFormFromServerSettings($fullManifest)
$addParams .= XMLFilter::resolveKeywords($typePlug->getManifestRawContent("server_settings/global_param"));
}
}
$uri = $_SERVER["REQUEST_URI"];
if (strpos($uri, '.php') !== false) $uri = PathUtils::forwardSlashDirname($uri);
if (empty($uri)) $uri = "/";
//$uri = $_SERVER["REQUEST_URI"];
//if (strpos($uri, '.php') !== false) $uri = PathUtils::forwardSlashDirname($uri);
//if (empty($uri)) $uri = "/";
$url = ApplicationState::detectServerURL(true);
$tryFullLocale = setlocale(LC_CTYPE, 0);
$locale = TextEncoder::getEncoding();
if(strpos($tryFullLocale, ".") !== false)$locale = $tryFullLocale;
if(defined('AJXP_LOCALE')) $locale = AJXP_LOCALE;
$apcCache = function_exists('apc_fetch') || function_exists('apcu_fetch');
$loadedValues = array(
"ENCODING" => $locale,
"SERVER_URI" => $uri,
"SERVER_URL" => $url,
"APC_CACHE_ENABLE" => $apcCache ? "true" : "false"
);
foreach ($loadedValues as $pName => $pValue) {
Expand Down Expand Up @@ -267,21 +268,32 @@ public function feedPluginsOptions($confDriver, $data, $optionsLinks = null)
$data["ENABLE_NOTIF"] = true;
// Prepare plugins configs
$direct = array(
"APPLICATION_TITLE" => "core.ajaxplorer/APPLICATION_TITLE",
"APPLICATION_LANGUAGE" => "core.ajaxplorer/DEFAULT_LANGUAGE",
"ENABLE_NOTIF" => "core.notifications/USER_EVENTS",
"APPLICATION_WELCOME" => "gui.ajax/CUSTOM_WELCOME_MESSAGE"
"APPLICATION_TITLE" => "core.ajaxplorer/APPLICATION_TITLE",
"APPLICATION_LANGUAGE" => "core.ajaxplorer/DEFAULT_LANGUAGE",
"SERVER_URL" => "core.ajaxplorer/SERVER_URL",
"ENABLE_NOTIF" => "core.notifications/USER_EVENTS",
"APPLICATION_WELCOME" => "gui.ajax/CUSTOM_WELCOME_MESSAGE",
);
$mailerEnabled = $data["MAILER_ENABLE"]["status"];
if ($mailerEnabled == "yes") {
// Enable core.mailer
$data["MAILER_SYSTEM"] = $data["MAILER_ENABLE"]["MAILER_SYSTEM"];
$data["MAILER_ADMIN"] = $data["MAILER_ENABLE"]["MAILER_ADMIN"];
$data["MAILER_SYSTEM"] = $data["MAILER_ENABLE"]["MAILER_SYSTEM"];
$data["MAILER_ADMIN"] = $data["MAILER_ENABLE"]["MAILER_ADMIN"];
$direct = array_merge($direct, array(
"MAILER_SYSTEM" => "mailer.phpmailer-lite/MAILER",
"MAILER_ADMIN" => "core.mailer/FROM",
"MAILER_SYSTEM" => "mailer.phpmailer-lite/MAILER",
"MAILER_ADMIN" => "core.mailer/FROM",
));
}
// If command line test passed, enable it directly
$diagFile = $this->getPluginWorkDir()."/diag_result.php";
if(file_exists($diagFile)){
$diagResults = [];
include($diagFile);
if(isSet($diagResults['Command Line Available']) && $diagResults['Command Line Available'] === 'Yes'){
$direct["ENABLE_CLI"] = "core.ajaxplorer/CLI_PHP";
$data["ENABLE_CLI"] = true;
}
}
}

foreach ($direct as $key => $value) {
Expand Down Expand Up @@ -335,10 +347,12 @@ public function createBootstrapConf($data)
"SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core")
));
if($data["APC_CACHE_ENABLE"]){
$rand = StringHelper::slugify(trim(parse_url($data["SERVER_URL"], PHP_URL_PATH), "/"));
if(empty($rand)) $rand = substr(md5(time()), 0, 8);
$coreCache["UNIQUE_INSTANCE_CONFIG"] = array_merge($coreCache["UNIQUE_INSTANCE_CONFIG"], array(
"instance_name" => "cache.doctrine",
"group_switch_value" => "cache.doctrine",
"CACHE_PREFIX" => StringHelper::slugify("pydio-".$data["SERVER_URI"]),
"CACHE_PREFIX" => "pydio-".$rand,
"DRIVER" => [
"group_switch_value" => "apc",
"driver" => "apc",
Expand Down Expand Up @@ -414,8 +428,9 @@ public function updateHtAccess($data, &$htContent)

$htAccessToUpdate = null;
$tpl = file_get_contents($this->getBaseDir() . "/htaccess.tpl");
if (!empty($data["SERVER_URI"]) && $data["SERVER_URI"] != "/") {
$htContent = str_replace('${APPLICATION_ROOT}', $data["SERVER_URI"], $tpl);
$uri = rtrim(parse_url($data["SERVER_URL"], PHP_URL_PATH), "/");
if (!empty($uri)) {
$htContent = str_replace('${APPLICATION_ROOT}', $uri, $tpl);
} else {
$htContent = str_replace('${APPLICATION_ROOT}/', "/", $tpl);
$htContent = str_replace('${APPLICATION_ROOT}', "/", $htContent);
Expand Down Expand Up @@ -491,13 +506,13 @@ public function testConnexions($action, $httpVars, $fileVars, ContextInterface $
if ($action == "boot_test_sql_connexion") {

$p = OptionsHelper::cleanDibiDriverParameters($data["db_type"]);
if ($p["driver"] == "sqlite3") {
if ($p["driver"] === "sqlite3") {
$dbFile = VarsFilter::filter($p["database"], $ctx);
if (!file_exists(dirname($dbFile))) {
mkdir(dirname($dbFile), 0755, true);
}
}
if(empty($p["password"])){
if($p["driver"] !== "sqlite3" && empty($p["password"])){
throw new PydioException("Although it's technically possible, for security reasons please do not use blank password for your DB connection.");
}
// Should throw an exception if there was a problem.
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/boot.conf/manifest.xml
Expand Up @@ -22,7 +22,7 @@
<global_param group="CONF_MESSAGE[Database Connexion]" name="db_type" default="mysql" label="CONF_MESSAGE[Database]" description="CONF_MESSAGE[Driver type (do not touch)]" type="group_switch:dibi_provider" mandatory="true" choices="mysql|MySQL,sqlite3|Sqlite 3,postgre|PostgreSQL"/>
<global_param group="CONF_MESSAGE[Advanced Options]" name="AdvancedLegend" type="legend" label="" description="CONF_MESSAGE[Please review these technical parameters. Encoding and URI should be auto-detected, but please make sure they reflect your actual server configuration.]"/>
<global_param group="CONF_MESSAGE[Advanced Options]" name="ENCODING" type="string" label="CONF_MESSAGE[Detected Encoding]" description="CONF_MESSAGE[Please make sure to set the encoding corresponding to your server configuration, something like ln_LN.CHARSET, e.g en_US.UTF-8]" default="" mandatory="true"/>
<global_param group="CONF_MESSAGE[Advanced Options]" name="SERVER_URI" type="string" label="CONF_MESSAGE[Detected Server Path]" description="CONF_MESSAGE[Make sure this is correct, as it's used to rewrite the htaccess file]" default="/" mandatory="true"/>
<global_param group="CONF_MESSAGE[Advanced Options]" name="SERVER_URL" type="string" label="CONF_MESSAGE[Detected Server URL]" description="CONF_MESSAGE[Make sure this is correct, as it's used to rewrite the htaccess file]" default="" mandatory="true"/>
<global_param group="CONF_MESSAGE[Advanced Options]" name="APC_CACHE_ENABLE" type="boolean" label="CONF_MESSAGE[Enable cache (recommended)]" description="CONF_MESSAGE[Use key/value store to cache server data in-memory. If APC/APCu is detected, it will be enabled by default, you can change this setting later to use a dedicated server like Redis or Memcache.]" default="false" mandatory="true"/>
<global_param group="CONF_MESSAGE[Advanced Options]" name="MAILER_ENABLE" type="group_switch:mailer" label="CONF_MESSAGE[Enable emails]" description="CONF_MESSAGE[Set up system to send emails]" default="no" mandatory="true"/>
<global_param group_switch_name="mailer" group_switch_value="no" group_switch_label="CONF_MESSAGE[No (you can enable mails later)]" name="status" type="hidden" label="No" description="s" default="no"/>
Expand Down

0 comments on commit 531d4f5

Please sign in to comment.