Bugfix su problemi di importazione

This commit is contained in:
Riccardo Di Dato
2016-01-07 18:02:10 +01:00
parent 749b1c8dc8
commit 11636e5785
16 changed files with 433 additions and 82 deletions
+2 -2
View File
@@ -148,8 +148,8 @@ function deploy_test_env(){
function deploy_local_env(){
create_project_fs
deploy
if [[ -f "$APPLICATION_CONFIG_PATH/config.local.php" ]];then
rm "$APPLICATION_CONFIG_PATH/config.local.php"
if [[ -f "$APPLICATION_CONFIG_PATH/config.prod.php" ]];then
rm "$APPLICATION_CONFIG_PATH/config.prod.php"
fi
if [[ -f "$APPLICATION_CONFIG_PATH/config.test.php" ]];then
rm "$APPLICATION_CONFIG_PATH/config.test.php"
+37
View File
@@ -0,0 +1,37 @@
<?php
/*
Author: Riccardo Di Dato
Creation Date: 14/nov/2013
*/
// $dbconn = new DatabaseConnection();
// $dbconn->dbname = "cbs";
// $dbconn->dbtype = "mysql";
// $dbconn->location = "localhost";
// $dbconn->username = "root";
// $dbconn->password = "root";
$currentSystem = new stdClass();
$currentSystem->storageBaseDir = "/home"; // Il path con storage ecc in cui mettere immagini, file temporanei ecc
$currentSystem->privateBaseDir = "/home/asdynamics"; // Il path in cui inserire la cartella con lib, task, binari ecc
$currentSystem->logBaseDir = "/var/log"; // Il path dei log....
$currentSystem->xSendFileDir = "/tmp/xsend";
$currentSystem->safeStorage = "/home/cbs/storage";
$currentSystem->apache = new StdClass();
$currentSystem->apache->user = "var-www";
$currentSystem->apache->group = "var-www";
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
$currentSystem->remoteLocation = "http://$_SERVER[HTTP_HOST]";
// $config->locations = new stdClass();
// $config->application->applicationInterfacePath = "/tnc15";
// $config->application->systemTmp = "/tmp";
?>
+37
View File
@@ -0,0 +1,37 @@
<?php
/*
Author: Riccardo Di Dato
Creation Date: 07/gen/2016
*/
// $dbconn = new DatabaseConnection();
// $dbconn->dbname = "cbs";
// $dbconn->dbtype = "mysql";
// $dbconn->location = "localhost";
// $dbconn->username = "root";
// $dbconn->password = "root";
$currentSystem = new stdClass();
$currentSystem->storageBaseDir = "/home"; // Il path con storage ecc in cui mettere immagini, file temporanei ecc
$currentSystem->privateBaseDir = "/home/asdynamics"; // Il path in cui inserire la cartella con lib, task, binari ecc
$currentSystem->logBaseDir = "/var/log"; // Il path dei log....
$currentSystem->xSendFileDir = "/tmp/xsend";
$currentSystem->safeStorage = "/home/cbs/storage";
$currentSystem->apache = new StdClass();
$currentSystem->apache->user = "var-www";
$currentSystem->apache->group = "var-www";
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
$currentSystem->remoteLocation = "http://$_SERVER[HTTP_HOST]";
// $config->locations = new stdClass();
// $config->application->applicationInterfacePath = "/tnc15";
// $config->application->systemTmp = "/tmp";
?>
+67
View File
@@ -0,0 +1,67 @@
<?php
/*
Author: Riccardo Di Dato
Creation Date: 07/gen/2016
*/
$project = new stdClass();
$project->name = "I Fatti di Napoli 2.0";
$project->buildName = "fdn2";
$project->defaultLocale = "it";
if (file_exists(dirname(__FILE__)."/config.local.php") ){
require_once (dirname(__FILE__)."/config.local.php");
}
else if (file_exists(dirname(__FILE__)."/config.env.php") ){
require_once (dirname(__FILE__)."/config.env.php");
}
else{
require_once (dirname(__FILE__)."/config.prod.php");
}
// Generic voices
$config = new stdClass();
$config->locale = new stdClass();
$config->locale->gui = $project->defaultLocale;
$config->locale->system = $project->defaultLocale;
// PATHS
$config->paths = new StdClass();
$config->paths->storage = $currentSystem->storageBaseDir . "/" . $project->buildName;
$config->paths->private = $currentSystem->privateBaseDir . "/" . $project->buildName;
$config->paths->public = $currentSystem->apache->workdir . "/" . $project->buildName;
$config->paths->log = $currentSystem->logBaseDir . "/" . $project->buildName;
$config->paths->backup = $config->paths->storage . "/backup";
$config->paths->binaries = $config->paths->private . "/bin";
$config->paths->common = $config->paths->private . "/common";
$config->paths->libraries = $config->paths->private . "/lib";
$config->paths->task = $config->paths->private . "/task";
$config->paths->pubImages = $config->paths->public . "/style/images";
$config->paths->media = $config->paths->storage . "/media";
// $config->paths->defMedia = $config->paths->pubImages . "/defaults";
$config->paths->tmp = $config->paths->storage . "/tmp";
$config->paths->xsendfile = $currentSystem->xSendFileDir . "/" . $project->buildName;
// FILES
$config->files = new StdClass();
$config->files->core_log = $config->paths->log . "/core.log";
$config->files->dao_log = $config->paths->log . "/dao.log";
$config->files->task_log = $config->paths->log . "/task.log";
$config->files->general_log = $config->paths->log . "/general.log";
// Pages
$config->pages = new StdClass();
$config->pages->index = $config->remoteLocation . "/index.php";
$config->pages->login = $config->remoteLocation . "/login.php";
$config->pages->logout = $config->remoteLocation . "/logout.php";
?>
+39
View File
@@ -0,0 +1,39 @@
<?php
/*
Author: Riccardo Di Dato
Creation Date: 19/nov/2013
*/
// $dbconn = new DatabaseConnection();
// $dbconn->dbname = "cbs";
// $dbconn->dbtype = "mysql";
// $dbconn->location = "localhost";
// $dbconn->username = "root";
// $dbconn->password = "root";
$currentSystem = new stdClass();
$currentSystem->storageBaseDir = "/home"; // Il path con storage ecc in cui mettere immagini, file temporanei ecc
$currentSystem->privateBaseDir = "/home/asdynamics"; // Il path in cui inserire la cartella con lib, task, binari ecc
$currentSystem->logBaseDir = "/var/log"; // Il path dei log....
$currentSystem->xSendFileDir = "/tmp/xsend";
$currentSystem->safeStorage = "/home/cbs/storage";
$currentSystem->apache = new StdClass();
$currentSystem->apache->user = "var-www";
$currentSystem->apache->group = "var-www";
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
$currentSystem->remoteLocation = "http://$_SERVER[HTTP_HOST]";
// $config->locations = new stdClass();
// $config->application->applicationInterfacePath = "/tnc15";
// $config->application->systemTmp = "/tmp";
?>
+1
View File
@@ -5,6 +5,7 @@ Creation Date: 23/dic/2015
*/
interface DaoSaveable {
/**
* @return stdClass L'oggetto da passare alla set di mongo
*/
+55
View File
@@ -0,0 +1,55 @@
<?php
abstract class CatalogManager {
public static $MAX_SUBSTITUTIONS = 9;
abstract protected function retrieveCatalog($index);
public function getCatalog($index,&$data=null) {
// if (is_array($index))var_dump($index);
$reval = "";
if(!is_null($data) && !is_array($data)) $data = array($data);
if($index != null && trim($index) != "") {
$reval = "" . $this->retrieveCatalog($index);
if($reval != null) {
if ($data!=null) $this->tokenize($reval,$data);
}
else $reval = $index;
}
return $reval;
}
/**
* Tokenizza la stringa di catalog
*/
protected function tokenize(&$catalog,&$data) {
$matches = array();
//implementation 3
if(preg_match_all("/\{([0-9]|c[0-9])\}/",$catalog,$matches)) {
$regas = $matches[1];
if(!is_array($regas)) $regas = array($regas);
// var_dump($regas);
foreach( $regas as $idx) {
if(preg_match("/^c[0-9]$/",$idx)) {
$useidx = (int) substr($idx,1);
$useidx--;
// echo "useidx: $useidx $idx\n";
$catalog = str_replace('{'. $idx . '}',$this->getCatalog((array_key_exists($useidx,$data)?$data[$useidx]:"")),$catalog);
}
else {
$useidx = (int) $idx;
$useidx--;
// echo "useidx: $useidx $idx\n";
$catalog = str_replace('{'. $idx . '}',(array_key_exists($useidx,$data)?$data[$useidx]:""),$catalog);
}
}
}
}
}
?>
+25
View File
@@ -0,0 +1,25 @@
<?php
class StaticCatalogManager extends CatalogManager {
private $catalog;
public function __construct(array $copy) {
$this->catalog = $copy;
}
protected function retrieveCatalog($index){
if(array_key_exists($index,$this->catalog))
return $this->catalog[$index];
else
return null;
}
}
?>
+19
View File
@@ -0,0 +1,19 @@
<?php
/*
Author: Riccardo Di Dato
Creation Date: 07/gen/2016
*/
// Include GUI Handler
// require_once(dirname(__FILE__)."/gui/GUIHandler.php");
// require_once(dirname(__FILE__)."/gui/ThumbnailGenerator.php");
require_once(dirname(__FILE__)."/CatalogManager.php");
require_once(dirname(__FILE__)."/StaticCatalogManager.php");
// require_once(dirname(__FILE__)."/LoginManager.php");
// GUIHandler::setCatalogManager(new StaticCatalogManager($catalog[$config->locale->gui]));
// $systemCatalogManager = new StaticCatalogManager($catalog[$config->locale->system]);
$systemCatalogManager = new StaticCatalogManager(array());
?>
+45 -39
View File
@@ -7,6 +7,12 @@ Creation Date: 14/nov/2013
require_once(dirname(__FILE__)."/CoreException.php");
require_once(dirname(__FILE__)."/lib.instances.php");
require_once(dirname(__FILE__)."/gui/lib.inclusion.php");
require_once(dirname(__FILE__)."/logger/lib.inclusion.php");
require_once(dirname(__FILE__)."/system/lib.inclusion.php");
@@ -16,54 +22,54 @@ require_once(dirname(__FILE__)."/system/lib.inclusion.php");
require_once(dirname(__FILE__)."/Status.php");
require_once(dirname(__FILE__)."/OperationStack.php");
require_once(dirname(__FILE__)."/OperationChain.php");
require_once(dirname(__FILE__)."/Context.php");
require_once(dirname(__FILE__)."/ASDSessionHandler.php");
// require_once(dirname(__FILE__)."/Status.php");
// require_once(dirname(__FILE__)."/OperationStack.php");
// require_once(dirname(__FILE__)."/OperationChain.php");
// require_once(dirname(__FILE__)."/Context.php");
// require_once(dirname(__FILE__)."/ASDSessionHandler.php");
require_once(dirname(__FILE__)."/CoreException.php");
// require_once(dirname(__FILE__)."/CoreException.php");
require_once(dirname(__FILE__)."/PostHandler.php");
// require_once(dirname(__FILE__)."/PostHandler.php");
// Include Loggers
// require_once(dirname(__FILE__)."/logger/LoggingFacility.php");
// require_once(dirname(__FILE__)."/logger/LoggingFacilityManager.php");
// require_once(dirname(__FILE__)."/logger/SyslogLogger.php");
// require_once(dirname(__FILE__)."/logger/FileLogger.php");
// // Include Loggers
// // require_once(dirname(__FILE__)."/logger/LoggingFacility.php");
// // require_once(dirname(__FILE__)."/logger/LoggingFacilityManager.php");
// // require_once(dirname(__FILE__)."/logger/SyslogLogger.php");
// // require_once(dirname(__FILE__)."/logger/FileLogger.php");
// Include base UIComponents
require_once(dirname(__FILE__)."/gui/UIComponent.php");
require_once(dirname(__FILE__)."/gui/uicomponents/GenericUIComponent.php");
require_once(dirname(__FILE__)."/gui/uicomponents/TextComponent.php");
require_once(dirname(__FILE__)."/gui/uicomponents/StandardComponents.php");
require_once(dirname(__FILE__)."/gui/uicomponents/CDataComponent.php");
require_once(dirname(__FILE__)."/gui/uicomponents/CDataComponents.php");
require_once(dirname(__FILE__)."/gui/uicomponents/FormComponents.php");
require_once(dirname(__FILE__)."/gui/uicomponents/DynForm.php");
require_once(dirname(__FILE__)."/gui/uicomponents/DynComponents.php");
require_once(dirname(__FILE__)."/gui/uicomponents/DynTables.php");
require_once(dirname(__FILE__)."/gui/uicomponents/unhadbComponents.php");
// // Include base UIComponents
// require_once(dirname(__FILE__)."/gui/UIComponent.php");
// require_once(dirname(__FILE__)."/gui/uicomponents/GenericUIComponent.php");
// require_once(dirname(__FILE__)."/gui/uicomponents/TextComponent.php");
// require_once(dirname(__FILE__)."/gui/uicomponents/StandardComponents.php");
// require_once(dirname(__FILE__)."/gui/uicomponents/CDataComponent.php");
// require_once(dirname(__FILE__)."/gui/uicomponents/CDataComponents.php");
// require_once(dirname(__FILE__)."/gui/uicomponents/FormComponents.php");
// require_once(dirname(__FILE__)."/gui/uicomponents/DynForm.php");
// require_once(dirname(__FILE__)."/gui/uicomponents/DynComponents.php");
// require_once(dirname(__FILE__)."/gui/uicomponents/DynTables.php");
// require_once(dirname(__FILE__)."/gui/uicomponents/unhadbComponents.php");
// DAO Stuff
require_once(dirname(__FILE__)."/dao/DaoRegistry.php");
require_once(dirname(__FILE__)."/dao/DatabaseConnection.php");
require_once(dirname(__FILE__)."/dao/GenericDao.php");
// // DAO Stuff
// require_once(dirname(__FILE__)."/dao/DaoRegistry.php");
// require_once(dirname(__FILE__)."/dao/DatabaseConnection.php");
// require_once(dirname(__FILE__)."/dao/GenericDao.php");
require_once(dirname(__FILE__)."/dao/daos/GeneralConfigurationDao.php");
require_once(dirname(__FILE__)."/dao/daos/AdminDao.php");
require_once(dirname(__FILE__)."/dao/daos/ClientDao.php");
require_once(dirname(__FILE__)."/dao/daos/BackupDao.php");
// require_once(dirname(__FILE__)."/dao/daos/GeneralConfigurationDao.php");
// require_once(dirname(__FILE__)."/dao/daos/AdminDao.php");
// require_once(dirname(__FILE__)."/dao/daos/ClientDao.php");
// require_once(dirname(__FILE__)."/dao/daos/BackupDao.php");
require_once(dirname(__FILE__)."/GeneralConfiguration.php");
// require_once(dirname(__FILE__)."/GeneralConfiguration.php");
// Include GUI Handler
require_once(dirname(__FILE__)."/gui/GUIHandler.php");
require_once(dirname(__FILE__)."/gui/ThumbnailGenerator.php");
require_once(dirname(__FILE__)."/gui/CatalogManager.php");
require_once(dirname(__FILE__)."/gui/StaticCatalogManager.php");
// // Include GUI Handler
// require_once(dirname(__FILE__)."/gui/GUIHandler.php");
// require_once(dirname(__FILE__)."/gui/ThumbnailGenerator.php");
// require_once(dirname(__FILE__)."/gui/CatalogManager.php");
// require_once(dirname(__FILE__)."/gui/StaticCatalogManager.php");
require_once(dirname(__FILE__)."/LoginManager.php");
// require_once(dirname(__FILE__)."/LoginManager.php");
+16 -19
View File
@@ -4,15 +4,12 @@ Author: Riccardo Di Dato
Creation Date: 05/mar/2015
*/
Context::setContextValue("sysconfig",$config);
ASDSessionHandler::setSessionValue("guilocale",$config->locale->gui);
// Context::setContextValue("sysconfig",$config);
// ASDSessionHandler::setSessionValue("guilocale",$config->locale->gui);
GUIHandler::setSystemUrl($config->systemUrl);
// GUIHandler::setSystemUrl($config->systemUrl);
GUIHandler::setCatalogManager(new StaticCatalogManager($catalog[$config->locale->gui]));
$systemCatalogManager = new StaticCatalogManager($catalog[$config->locale->system]);
require_once(dirname(__FILE__)."/../common/html.include.php");
// require_once(dirname(__FILE__)."/../common/html.include.php");
// // _____ ____ ___
// // | ___/ ___| / _ \
@@ -124,20 +121,20 @@ require_once(dirname(__FILE__)."/../common/html.include.php");
// | |_| / ___ \ |_| |
// |____/_/ \_\___/
//
new GeneralConfigurationDao($config->dbConnection);
new AdminDao($config->dbConnection);
new ClientDao($config->dbConnection,$config->paths->pubkey);
new BackupDao($config->dbConnection);
// new GeneralConfigurationDao($config->dbConnection);
// new AdminDao($config->dbConnection);
// new ClientDao($config->dbConnection,$config->paths->pubkey);
// new BackupDao($config->dbConnection);
ASDSessionHandler::regenerateContext();
// ASDSessionHandler::regenerateContext();
$checkPath = $config->paths->tmp."/backup";
if (!file_exists($checkPath)){
mkdir($checkPath,0751,true);
}
else if (!is_dir($checkPath)){
die("Impossible to run cbs... cannot create directory '$checkPath' (a file with this name exists)");
}
// $checkPath = $config->paths->tmp."/backup";
// if (!file_exists($checkPath)){
// mkdir($checkPath,0751,true);
// }
// else if (!is_dir($checkPath)){
// die("Impossible to run cbs... cannot create directory '$checkPath' (a file with this name exists)");
// }
?>
+10 -8
View File
@@ -19,11 +19,19 @@ require_once(dirname(__FILE__)."/FileLogger.php");
//
LoggingFacilityManager::addLogger(
"system",
new SyslogLogger("Core",$systemCatalogManager,true)
new SyslogLogger("System",$systemCatalogManager,true)
);
LoggingFacilityManager::getLogger("system")->setLoggingLevel(LoggingFacility::$LEVEL_DEBUG);
LoggingFacilityManager::addLogger(
"core",
new FileLogger("Core",$systemCatalogManager,$config->files->core_log,true)
);
LoggingFacilityManager::getLogger("core")->setLoggingLevel(LoggingFacility::$LEVEL_DEBUG);
LoggingFacilityManager::addLogger(
"dao",
new FileLogger("DAO",$systemCatalogManager,$config->files->dao_log,true)
@@ -31,19 +39,13 @@ LoggingFacilityManager::addLogger(
LoggingFacilityManager::getLogger("dao")->setLoggingLevel(LoggingFacility::$LEVEL_DEBUG);
LoggingFacilityManager::addLogger(
"system",
new FileLogger("SAAM",$systemCatalogManager,$config->files->saam_log,true)
);
LoggingFacilityManager::getLogger("saam")->setLoggingLevel(LoggingFacility::$LEVEL_DEBUG);
LoggingFacilityManager::addLogger(
"task",
new FileLogger("Task",$systemCatalogManager,$config->files->task_log,true)
);
LoggingFacilityManager::getLogger("task")->setLoggingLevel(LoggingFacility::$LEVEL_DEBUG);
LoggingFacilityManager::addLogger(
"general",
new FileLogger("General",$systemCatalogManager,$config->files->general_log,true)
-14
View File
@@ -60,19 +60,5 @@ SFSManager::addFilesystem(new LocallyMountedFS(
$config->paths->xsendfile,
"XSendFile Filesystem")
);
SFSManager::addFilesystem(new LocallyMountedFS(
FSObject::$DEVICE_TYPE_HARD_DRIVE,
FSObject::$WRITELAW_NORMALLY_W,
LocallyMountedFS::$ACCESSMODE_RW,
$config->paths->pubkey,
"Public Keys Filesystem")
);
SFSManager::addFilesystem(new LocallyMountedFS(
FSObject::$DEVICE_TYPE_HARD_DRIVE,
FSObject::$WRITELAW_NORMALLY_W,
LocallyMountedFS::$ACCESSMODE_RW,
$config->paths->sshDir,
"SSH Configuration directory")
);
?>
+70
View File
@@ -0,0 +1,70 @@
<?php
/*
Author: Riccardo Di Dato
Creation Date: 04/feb/2013
*/
require_once(dirname(__FILE__)."/common/config.php");
require_once(dirname(__FILE__)."/lib/lib.inclusions.php");
// // Include catalogs
// require_once(dirname(__FILE__)."/common/catalog.it.php");
// $config = new StdClass();
// $config->systemUrl = $currentSystem->remoteLocation . "/" . $project->buildName;
// // Database Connection
// $config->dbConnection = $dbconn;
// // Generic voices
// $config->locale = new stdClass();
// $config->locale->gui = $project->defaultLocale;
// $config->locale->system = $project->defaultLocale;
// // TODO inserire controllo per modificare la current locale
// // PATHS
// $config->paths = new StdClass();
// $config->paths->storage = $currentSystem->storageBaseDir . "/" . $project->buildName;
// $config->paths->private = $currentSystem->privateBaseDir . "/" . $project->buildName;
// $config->paths->public = $currentSystem->apache->workdir . "/" . $project->buildName;
// $config->paths->log = $currentSystem->logBaseDir . "/" . $project->buildName;
// $config->paths->backup = $currentSystem->safeStorage . "/" . $project->buildName;
// $config->paths->binaries = $config->paths->private . "/bin";
// $config->paths->common = $config->paths->private . "/common";
// $config->paths->libraries = $config->paths->private . "/lib";
// $config->paths->task = $config->paths->private . "/task";
// $config->paths->pubImages = $config->paths->public . "/style/images";
// $config->paths->media = $config->paths->storage . "/media";
// $config->paths->defMedia = $config->paths->pubImages . "/defaults";
// $config->paths->tmp = $config->paths->storage . "/tmp";
// $config->paths->xsendfile = $currentSystem->xSendFileDir . "/" . $project->buildName;
// $config->paths->pubkey = $config->paths->storage . "/pubkeys";
// $config->paths->sshDir = $currentSystem->os->homeDir . "/.ssh";
// // FILES
// $config->files = new StdClass();
// $config->files->dao_log = $config->paths->log . "/dao.log";
// $config->files->saam_log = $config->paths->log . "/saam.log";
// $config->files->task_log = $config->paths->log . "/task.log";
// $config->files->general_log = $config->paths->log . "/general.log";
// $config->files->authKeys = $config->paths->sshDir . "/authorized_keys";
// // Pages
// $config->pages = new StdClass();
// $config->pages->index = $config->systemUrl . "/index.php";
// $config->pages->login = $config->systemUrl . "/login.php";
// $config->pages->logout = $config->systemUrl . "/logout.php";
// require_once(dirname(__FILE__)."/lib/lib.instances.php");
?>
+1
View File
@@ -4,6 +4,7 @@ Author: Riccardo Di Dato
Creation Date: 22/dic/2015
*/
require_once(dirname(__FILE__)."/load.php");
echo "Index";
?>
+9
View File
@@ -0,0 +1,9 @@
<?php
/*
Author: Riccardo Di Dato
Creation Date: 04/mar/2015
*/
require_once("/home/asdynamics/private/fdn2/load.php");
?>