This commit is contained in:
Paula V. Quispe
2016-08-30 17:18:13 -04:00
parent 094afd7dd8
commit eef416ba63
2 changed files with 6 additions and 358 deletions

View File

@@ -39,13 +39,6 @@ pake_task('create-poedit-file', 'project_exists');
pake_desc("generate a unit test file for an existing class\n args: <class-filename>");
pake_task('generate-unit-test-class', 'project_exists');
//pake_desc('generate basic CRUD files for an existing class');
//pake_task('generate-crud', 'project_exists');
pake_desc("build new project \n args: <name>");
pake_task('new-project', 'project_exists');
pake_desc("build new plugin \n args: <name>");
pake_task('new-plugin', 'project_exists');
@@ -1100,296 +1093,6 @@ function copy_file($newFilename) {
printf("saved %s bytes in file %s \n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($newFilename, 'INFO'));
}
function run_new_project($task, $args) {
global $pathHome;
global $projectName;
//the class filename in the first argument
$projectName = $args[0];
if( trim($projectName) == '' ) {
printf("Error: %s\n", pakeColor::colorize("you must specify a valid name for the project", 'ERROR'));
exit(0);
}
$createProject = strtolower(prompt("Do you want to create the project '$projectName' ? [Y/n]"));
if( $createProject == 'n' )
die();
G::LoadSystem('templatePower');
define('PATH_SHARED', PATH_SEP . 'shared' . PATH_SEP . $projectName . '_data' . PATH_SEP);
$pathHome = PATH_TRUNK . $projectName;
printf("creating project %s in %s\n", pakeColor::colorize($projectName, 'INFO'), pakeColor::colorize($pathHome, 'INFO'));
define('G_ENVIRONMENT', G_DEV_ENV);
require_once ("propel/Propel.php");
//create project.conf for httpd conf
//$dbFile = PATH_TRUNK . $projectName . PATH_SEP . 'shared' . PATH_SEP . 'sites'. PATH_SEP . 'dev'. PATH_SEP . 'db.php';
$dbFile = PATH_SEP . PATH_SHARED . 'sites' . PATH_SEP . $projectName . PATH_SEP . 'db.php';
$dbn = "db_" . $projectName;
$dbrn = "rb_" . $projectName;
$dbnpass = substr(G::GenerateUniqueId(), 0, 8);
if( 1 || ! file_exists($dbFile) ) {
if( ! defined('HASH_INSTALLATION') ) {
printf("%s\n", pakeColor::colorize('HASH INSTALLATION is invalid or does not exist. Please check the paths_installed.php file', 'ERROR'));
exit(0);
}
$dbOpt = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
$connectionDatabase = mysql_connect($dbOpt[0], $dbOpt[1], $dbOpt[2]);
if( ! $connectionDatabase ) {
printf("%s\n", pakeColor::colorize('HASH INSTALLATION has invalid credentials. Please check the paths_installed.php file', 'ERROR'));
exit(0);
}
printf("creating database %s \n", pakeColor::colorize($dbn, 'INFO'));
$q = "CREATE DATABASE IF NOT EXISTS $dbn DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci";
$ac = @mysql_query($q, $connectionDatabase);
if( ! $ac ) {
printf("%s\n", pakeColor::colorize(mysql_error(), 'ERROR'));
exit(0);
}
printf("creating database %s \n", pakeColor::colorize($dbrn, 'INFO'));
$q = "CREATE DATABASE IF NOT EXISTS $dbrn DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci";
$ac = @mysql_query($q, $connectionDatabase);
if( ! $ac ) {
printf("%s\n", pakeColor::colorize(mysql_error(), 'ERROR'));
exit(0);
}
$q = "GRANT ALL PRIVILEGES ON `$dbn`.* TO $dbn@'localhost' IDENTIFIED BY '$dbnpass' WITH GRANT OPTION";
$ac = @mysql_query($q, $connectionDatabase);
if( ! $ac ) {
printf("%s\n", pakeColor::colorize(mysql_error(), 'ERROR'));
exit(0);
}
$q = "GRANT ALL PRIVILEGES ON `$dbrn`.* TO $dbn@'localhost' IDENTIFIED BY '$dbnpass' WITH GRANT OPTION";
$ac = @mysql_query($q, $connectionDatabase);
if( ! $ac ) {
printf("%s\n", pakeColor::colorize(mysql_error(), 'ERROR'));
exit(0);
}
$rbSql = PATH_RBAC_MYSQL_DATA . 'schema.sql';
printf("executing %s \n", pakeColor::colorize($rbSql, 'INFO'));
mysql_select_db($dbrn, $connectionDatabase);
$qrs = query_sql_file($rbSql, $connectionDatabase);
$q = "INSERT INTO `USERS` VALUES ('00000000000000000000000000000001','admin',md5('admin'),'Administrator','','admin@colosa.com','2020-01-01','2007-08-03 12:24:36','2008-02-13 07:24:07',1);";
$ac = @mysql_query($q, $connectionDatabase);
$q = "INSERT INTO `USERS` VALUES ('00000000000000000000000000000002','operator',md5('operator'),'Operator','','operator@colosa.com','2020-01-01','2007-08-03 12:24:36','2008-02-13 07:24:07',1);";
$ac = @mysql_query($q, $connectionDatabase);
//database wf_ db_
$dbInsertSql = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . 'db_insert.sql';
printf("executing %s \n", pakeColor::colorize($dbInsertSql, 'INFO'));
mysql_select_db($dbn, $connectionDatabase);
$qrs = query_sql_file($dbInsertSql, $connectionDatabase);
G::mk_dir(PATH_SHARED . 'sites' . PATH_SEP);
G::mk_dir(PATH_SHARED . 'sites' . PATH_SEP . $projectName);
$dbFields['rootUser'] = $dbn;
$dbFields['rootPass'] = $dbnpass;
create_file_from_tpl('db.php', $dbFile, $dbFields);
}
global $G_ENVIRONMENTS;
$G_ENVIRONMENTS['DEVELOPMENT']['dbfile'] = $dbFile;
//print_r ( $G_ENVIRONMENTS );
Propel::init(PATH_CORE . "config/databases.php");
$configuration = Propel::getConfiguration();
$connectionDSN = $configuration['datasources']['workflow']['connection'];
printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO'));
$rbacProjectName = strtoupper($projectName);
G::LoadSystem('rbac');
$RBAC = RBAC::getSingleton();
$RBAC->sSystem = $rbacProjectName;
$RBAC->initRBAC();
$RBAC->createSystem($rbacProjectName);
$RBAC->createPermision(substr($rbacProjectName, 0, 3) . '_LOGIN');
$RBAC->createPermision(substr($rbacProjectName, 0, 3) . '_ADMIN');
$RBAC->createPermision(substr($rbacProjectName, 0, 3) . '_OPERATOR');
$systemData = $RBAC->systemObj->LoadByCode($rbacProjectName);
$roleData['ROL_UID'] = G::GenerateUniqueId();
$roleData['ROL_PARENT'] = '';
$roleData['ROL_SYSTEM'] = $systemData['SYS_UID'];
$roleData['ROL_CODE'] = substr($rbacProjectName, 0, 3) . '_ADMIN';
$roleData['ROL_CREATE_DATE'] = date('Y-m-d H:i:s');
$roleData['ROL_UPDATE_DATE'] = date('Y-m-d H:i:s');
$roleData['ROL_STATUS'] = '1';
$RBAC->createRole($roleData);
$roleData['ROL_UID'] = G::GenerateUniqueId();
$roleData['ROL_PARENT'] = '';
$roleData['ROL_SYSTEM'] = $systemData['SYS_UID'];
$roleData['ROL_CODE'] = substr($rbacProjectName, 0, 3) . '_OPERATOR';
$roleData['ROL_CREATE_DATE'] = date('Y-m-d H:i:s');
$roleData['ROL_UPDATE_DATE'] = date('Y-m-d H:i:s');
$roleData['ROL_STATUS'] = '1';
$RBAC->createRole($roleData);
$roleData = $RBAC->rolesObj->LoadByCode(substr($rbacProjectName, 0, 3) . '_ADMIN');
//Assign permissions to ADMIN
$roleData = $RBAC->rolesObj->LoadByCode(substr($rbacProjectName, 0, 3) . '_ADMIN');
$permData = $RBAC->permissionsObj->LoadByCode(substr($rbacProjectName, 0, 3) . '_LOGIN');
$RBAC->assignPermissionToRole($roleData['ROL_UID'], $permData['PER_UID']);
$permData = $RBAC->permissionsObj->LoadByCode(substr($rbacProjectName, 0, 3) . '_ADMIN');
$RBAC->assignPermissionToRole($roleData['ROL_UID'], $permData['PER_UID']);
$userRoleData['ROL_UID'] = $roleData['ROL_UID'];
$userRoleData['USR_UID'] = '00000000000000000000000000000001';
$RBAC->assignUserToRole($userRoleData);
//Assign permissions to OPERATOR
$roleData = $RBAC->rolesObj->LoadByCode(substr($rbacProjectName, 0, 3) . '_OPERATOR');
$permData = $RBAC->permissionsObj->LoadByCode(substr($rbacProjectName, 0, 3) . '_LOGIN');
$RBAC->assignPermissionToRole($roleData['ROL_UID'], $permData['PER_UID']);
$permData = $RBAC->permissionsObj->LoadByCode(substr($rbacProjectName, 0, 3) . '_OPERATOR');
$RBAC->assignPermissionToRole($roleData['ROL_UID'], $permData['PER_UID']);
$userRoleData['ROL_UID'] = $roleData['ROL_UID'];
$userRoleData['USR_UID'] = '00000000000000000000000000000002';
$RBAC->assignUserToRole($userRoleData);
//create folder and structure
G::mk_dir($pathHome);
G::mk_dir($pathHome . PATH_SEP . 'public_html');
G::mk_dir($pathHome . PATH_SEP . 'public_html' . PATH_SEP . 'images');
G::mk_dir($pathHome . PATH_SEP . 'public_html' . PATH_SEP . 'skins');
G::mk_dir($pathHome . PATH_SEP . 'public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green');
G::mk_dir($pathHome . PATH_SEP . 'public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images');
G::mk_dir($pathHome . PATH_SEP . 'engine');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'classes');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'map');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'om');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'config');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'content');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'content' . PATH_SEP . 'languages');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'content' . PATH_SEP . 'translations');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'data');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'data' . PATH_SEP . 'mysql');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'js');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'js' . PATH_SEP . 'labels');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'menus');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'methods');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'users');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'skins');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'templates');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'test');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'test' . PATH_SEP . 'bootstrap');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'test' . PATH_SEP . 'fixtures');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'test' . PATH_SEP . 'unit');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'xmlform');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'gulliver');
G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'users');
//create project.conf for httpd conf
create_file_from_tpl('httpd.conf', $projectName . '.conf');
create_file_from_tpl('sysGeneric.php', 'public_html' . PATH_SEP . 'sysGeneric.php');
copy_file_from_tpl('bm.jpg', 'public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP . 'bm.jpg');
copy_file_from_tpl('bsm.jpg', 'public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP . 'bsm.jpg');
create_file_from_tpl('index.html', 'public_html' . PATH_SEP . 'index.html');
create_file_from_tpl('paths.php', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
create_file_from_tpl('defines.php', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'defines.php');
create_file_from_tpl('databases.php', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'databases.php');
$fields['dbName'] = 'mysql';
create_file_from_tpl('propel.ini', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'propel.ini', $fields);
create_file_from_tpl('propel.ini', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'propel.mysql.ini', $fields);
if( file_exists($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'schema.xml') ) {
$createSchema = strtolower(prompt("schema.xml exists!. Do you want to overwrite the schema.xml file? [y/N]"));
if( $createSchema == 'y' ) {
create_file_from_tpl('schema.xml', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'schema.xml');
}
} else
create_file_from_tpl('schema.xml', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'schema.xml');
create_file_from_tpl('sysLogin.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login' . PATH_SEP . 'sysLogin.php');
create_file_from_tpl('login.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login' . PATH_SEP . 'login.php');
create_file_from_tpl('authentication.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login' . PATH_SEP . 'authentication.php');
create_file_from_tpl('welcome.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login' . PATH_SEP . 'welcome.php');
create_file_from_tpl('dbInfo.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login' . PATH_SEP . 'dbInfo.php');
create_file_from_tpl('usersList.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'users' . PATH_SEP . 'usersList.php');
create_file_from_tpl('rolesList.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'users' . PATH_SEP . 'rolesList.php');
create_file_from_tpl('permissionsList.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'users' . PATH_SEP . 'permissionsList.php');
create_file_from_tpl('sysLogin.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login' . PATH_SEP . 'sysLogin.xml');
create_file_from_tpl('login.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login' . PATH_SEP . 'login.xml');
create_file_from_tpl('showMessage.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login' . PATH_SEP . 'showMessage.xml');
create_file_from_tpl('welcome.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login' . PATH_SEP . 'welcome.xml');
copy_file_from_tpl('xmlform.html', 'engine' . PATH_SEP . 'templates' . PATH_SEP . 'xmlform.html');
copy_file_from_tpl('publish.php', 'engine' . PATH_SEP . 'templates' . PATH_SEP . 'publish.php');
copy_file_from_tpl('publish-treeview.php', 'engine' . PATH_SEP . 'templates' . PATH_SEP . 'publish-treeview.php');
create_file_from_tpl('dbInfo.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login' . PATH_SEP . 'dbInfo.xml');
create_file_from_tpl('usersList.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'users' . PATH_SEP . 'usersList.xml');
create_file_from_tpl('rolesList.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'users' . PATH_SEP . 'rolesList.xml');
create_file_from_tpl('permissionsList.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'users' . PATH_SEP . 'permissionsList.xml');
create_file_from_tpl('mainmenu.php', 'engine' . PATH_SEP . 'menus' . PATH_SEP . $projectName . '.php');
create_file_from_tpl('users.menu.php', 'engine' . PATH_SEP . 'menus' . PATH_SEP . 'users.php');
copy_file('public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'style.css');
copy_file('public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP . 'bsms.jpg');
copy_file('public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP . 'ftl.png');
copy_file('public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP . 'ftr.png');
copy_file('public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP . 'fbl.png');
copy_file('public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP . 'fbr.png');
copy_file('public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP . 'fbc.png');
copy_file('public_html' . PATH_SEP . 'images' . PATH_SEP . 'favicon.ico');
copy_file('public_html' . PATH_SEP . 'images' . PATH_SEP . 'bulletButton.gif');
copy_file('public_html' . PATH_SEP . 'images' . PATH_SEP . 'bulletSubMenu.jpg');
copy_file('public_html' . PATH_SEP . 'images' . PATH_SEP . 'users.png');
copy_file('public_html' . PATH_SEP . 'images' . PATH_SEP . 'trigger.gif');
copy_file('engine' . PATH_SEP . 'skins' . PATH_SEP . 'green.html');
copy_file('engine' . PATH_SEP . 'skins' . PATH_SEP . 'green.php');
copy_file('engine' . PATH_SEP . 'skins' . PATH_SEP . 'blank.html');
copy_file('engine' . PATH_SEP . 'skins' . PATH_SEP . 'blank.php');
copy_file('engine' . PATH_SEP . 'skins' . PATH_SEP . 'raw.html');
copy_file('engine' . PATH_SEP . 'skins' . PATH_SEP . 'raw.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.ArrayPeer.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.BasePeer.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.configuration.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.plugin.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.pluginRegistry.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.popupMenu.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.propelTable.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'Application.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'ApplicationPeer.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'Content.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'ContentPeer.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'Configuration.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'ConfigurationPeer.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'om' . PATH_SEP . 'BaseApplication.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'om' . PATH_SEP . 'BaseApplicationPeer.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'om' . PATH_SEP . 'BaseContent.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'om' . PATH_SEP . 'BaseContentPeer.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'om' . PATH_SEP . 'BaseConfiguration.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'om' . PATH_SEP . 'BaseConfigurationPeer.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'map' . PATH_SEP . 'ApplicationMapBuilder.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'map' . PATH_SEP . 'ContentMapBuilder.php');
copy_file('engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'map' . PATH_SEP . 'ConfigurationMapBuilder.php');
copy_file('engine' . PATH_SEP . 'config' . PATH_SEP . 'environments.php');
copy_file('engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login' . PATH_SEP . 'login.xml');
copy_file('engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'gulliver' . PATH_SEP . 'pagedTable_PopupMenu.xml');
copy_file('engine' . PATH_SEP . 'templates' . PATH_SEP . 'popupMenu.html');
copy_file('engine' . PATH_SEP . 'templates' . PATH_SEP . 'paged-table.html');
copy_file('engine' . PATH_SEP . 'templates' . PATH_SEP . 'xmlmenu.html');
copy_file('engine' . PATH_SEP . 'templates' . PATH_SEP . 'filterform.html');
copy_file('engine' . PATH_SEP . 'templates' . PATH_SEP . 'tree.html');
copy_file('engine' . PATH_SEP . 'templates' . PATH_SEP . 'dummyTemplate.html');
$filePng = $pathHome . PATH_SEP . 'public_html' . PATH_SEP . 'images' . PATH_SEP . 'processmaker.logo.jpg';
createPngLogo($filePng, $projectName);
if( ! PHP_OS == "WINNT" ) {
printf("creating symlinks %s \n", pakeColor::colorize($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'gulliver', 'INFO'));
symlink(PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'gulliver', $pathHome . PATH_SEP . 'engine' . PATH_SEP . 'gulliver');
}
//create schema.xml with empty databases
exit(0);
}
function fieldToLabel($field) {
$aux = substr($field, 4);
$res = $aux[0];
@@ -2164,65 +1867,6 @@ function getDataBaseConfiguration($dsn) {
return $result;
}
function run_workspace_restore($task, $args) {
try {
ini_set('display_errors', 'on');
ini_set('error_reporting', E_ERROR);
// the environment for poedit always is Development
define('G_ENVIRONMENT', G_DEV_ENV);
$overwrite = array_search('-o', $args);
if ($overwrite === false)
$overwrite = array_search('--overwrite', $args);
if ($overwrite !== false) {
unset($args[$overwrite]);
$args = array_values($args);
$overwrite = true;
}
if (count($args) < 1 || count($args) > 2) {
throw (new Exception('Wrong number of arguments specified'));
}
/* Search for the backup file in several directories, choosing the first one
* that is found.
* 1) An absolute filename used as is.
* 2) A filename relative to the backups directory (eg. workflow.tar)
* 3) A workspace name (such as workflow) uncompressed backup
* 4) A workspace name compressed backup
* 5) A filename in the old backups directory (for legacy compatibiility)
*/
$backupFiles = array(
$args[0],
PATH_DATA . 'backups' . PATH_SEP . $args[0],
PATH_DATA . 'backups' . PATH_SEP . $args[0] . ".tar",
PATH_DATA . 'backups' . PATH_SEP . $args[0] . ".tar.gz",
PATH_OUTTRUNK . 'backups' . PATH_SEP . $args[0]
);
foreach ($backupFiles as $backupFile) {
if (file_exists($backupFile))
break;
}
if (!file_exists($backupFile))
throw(new Exception("Backup file not found."));
$targetWorkspaceName = isset($args[1]) ? $args[1] : NULL;
printf("Using file %s \n", pakeColor::colorize($backupFile, 'INFO'));
if( workspaceRestore($backupFile, $targetWorkspaceName, $overwrite) ) {
printf("Successfully restored from file %s \n", pakeColor::colorize($backupFile, 'INFO'));
} else {
throw (new Exception('There was an error in file descompression. '));
}
} catch( Exception $e ) {
printf("Error: %s\n", pakeColor::colorize($e->getMessage(), 'ERROR'));
exit(0);
}
}
function updateDBCallback($matches) {
global $updateDBCallbackData;
/* This function changes the values of defines while keeping their formatting

View File

@@ -290,14 +290,18 @@ EOT;
$taskOpts[$validOpts[$optName]] = $optArg;
}
} catch (Exception $e) {
echo self::error( "Invalid options: " . $e->getMessage() ) . "\n\n";
$token = strtotime("now");
PMException::registerErrorLog($e, $token);
echo self::error( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
self::help( $taskName );
return;
}
try {
call_user_func( $taskData['function'], $arguments, $taskOpts );
} catch (Exception $e) {
echo self::error( "\n Error executing '$taskName':\n\n {$e->getMessage()}\n" ) . "\n";
$token = strtotime("now");
PMException::registerErrorLog($e, $token);
echo self::error( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
global $tempDirectory;
if (!empty($tempDirectory)) {
G::rm_dir($tempDirectory);