本文整理汇总了PHP中G::mk_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP G::mk_dir方法的具体用法?PHP G::mk_dir怎么用?PHP G::mk_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::mk_dir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$javaInput = PATH_C . 'javaBridgePM' . PATH_SEP . 'input' . PATH_SEP;
$javaOutput = PATH_C . 'javaBridgePM' . PATH_SEP . 'output' . PATH_SEP;
G::mk_dir($javaInput);
G::mk_dir($javaOutput);
}
示例2: run_flush_cache
function run_flush_cache($args, $opts)
{
$rootDir = realpath(__DIR__."/../../../../");
$app = new Maveriks\WebApplication();
$app->setRootDir($rootDir);
$loadConstants = false;
$workspaces = get_workspaces_from_args($args);
if (! defined("PATH_C")) {
die("ERROR: seems processmaker is not properly installed (System constants are missing).".PHP_EOL);
}
CLI::logging("Flush ".pakeColor::colorize("system", "INFO")." cache ... ");
G::rm_dir(PATH_C);
G::mk_dir(PATH_C, 0777);
echo "DONE" . PHP_EOL;
foreach ($workspaces as $workspace) {
echo "Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... ";
G::rm_dir($workspace->path . "/cache");
G::mk_dir($workspace->path . "/cache", 0777);
G::rm_dir($workspace->path . "/cachefiles");
G::mk_dir($workspace->path . "/cachefiles", 0777);
echo "DONE" . PHP_EOL;
}
}
示例3: runHotfixInstall
function runHotfixInstall($command, $args)
{
CLI::logging("HOTFIX", PATH_DATA . "log" . PATH_SEP . "upgrades.log");
CLI::logging("Install hotfix to system\n");
$arrayFile = $command;
if (count($arrayFile) > 0) {
//Install hotfix
foreach ($arrayFile as $value) {
$f = $value;
$result = workspaceTools::hotfixInstall($f);
CLI::logging($result["message"] . "\n");
}
//Clear server's cache
CLI::logging("\nClearing cache...\n");
if (defined("PATH_C")) {
G::rm_dir(PATH_C);
G::mk_dir(PATH_C, 0777);
}
//Safe upgrade for JavaScript files
CLI::logging("\nSafe upgrade for files cached by the browser\n\n");
G::browserCacheFilesSetUid();
CLI::logging("HOTFIX done\n");
} else {
CLI::logging("Please specify the hotfix to install\n");
}
}
示例4: xcopy
/**
* skinsSave.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
function xcopy($pathSource, $pathTarget)
{
G::mk_dir($pathTarget);
if ($handle = opendir($pathSource)) {
while (false !== ($file = readdir($handle))) {
if (substr($file, 0, 1) != '.' && !is_dir($file)) {
$content = file_get_contents($pathSource . $file);
$filename = $pathTarget . $file;
file_put_contents($filename, $content);
}
}
closedir($handle);
}
}
示例5: importProcessFromLibrary
/**
* import process fromLibrary: downloads and imports a process from the ProcessMaker library
*
* @param string sessionId : The session ID (which was obtained at login).
* @param string processId :
* @param string version :
* @param string importOption :
* @param string usernameLibrary : The username to obtain access to the ProcessMaker library.
* @param string passwordLibrary : The password to obtain access to the ProcessMaker library.
* @return $eturns will return an object
*/
public function importProcessFromLibrary($processId, $version = '', $importOption = '', $usernameLibrary = '', $passwordLibrary = '')
{
try {
G::LoadClass('processes');
//$versionReq = $_GET['v'];
//. (isset($_GET['s']) ? '&s=' . $_GET['s'] : '')
$ipaddress = $_SERVER['REMOTE_ADDR'];
$oProcesses = new Processes();
$oProcesses->ws_open_public();
$oProcess = $oProcesses->ws_processGetData($processId);
if ($oProcess->status_code != 0) {
throw new Exception($oProcess->message);
}
$privacy = $oProcess->privacy;
$strSession = '';
if ($privacy != 'FREE') {
global $sessionId;
$antSession = $sessionId;
$oProcesses->ws_open($usernameLibrary, $passwordLibrary);
$strSession = "&s=" . $sessionId;
$sessionId = $antSession;
}
//downloading the file
$localPath = PATH_DOCUMENT . 'input' . PATH_SEP;
G::mk_dir($localPath);
$newfilename = G::GenerateUniqueId() . '.pm';
$downloadUrl = PML_DOWNLOAD_URL . '?id=' . $processId . $strSession;
$oProcess = new Processes();
$oProcess->downloadFile($downloadUrl, $localPath, $newfilename);
//getting the ProUid from the file recently downloaded
$oData = $oProcess->getProcessData($localPath . $newfilename);
if (is_null($oData)) {
$data['DOWNLOAD_URL'] = $downloadUrl;
$data['LOCAL_PATH'] = $localPath;
$data['NEW_FILENAME'] = $newfilename;
throw new Exception(G::loadTranslation('ID_ERROR_URL_PROCESS_INVALID', SYS_LANG, $data));
}
$sProUid = $oData->process['PRO_UID'];
$oData->process['PRO_UID_OLD'] = $sProUid;
//if the process exists, we need to check the $importOption to and re-import if the user wants,
if ($oProcess->processExists($sProUid)) {
//Update the current Process, overwriting all tasks and steps
if ($importOption == 1) {
$oProcess->updateProcessFromData($oData, $localPath . $newfilename);
//delete the xmlform cache
if (file_exists(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid)) {
$oDirectory = dir(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid);
while ($sObjectName = $oDirectory->read()) {
if ($sObjectName != '.' && $sObjectName != '..') {
$strAux = PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP;
$strAux = $strAux . $sProUid . PATH_SEP . $sObjectName;
unlink($strAux);
}
}
$oDirectory->close();
}
$sNewProUid = $sProUid;
}
//Disable current Process and create a new version of the Process
if ($importOption == 2) {
$oProcess->disablePreviousProcesses($sProUid);
$sNewProUid = $oProcess->getUnusedProcessGUID();
$oProcess->setProcessGuid($oData, $sNewProUid);
$oProcess->setProcessParent($oData, $sProUid);
$oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date('M d, H:i');
$oProcess->renewAll($oData);
$oProcess->createProcessFromData($oData, $localPath . $newfilename);
}
//Create a completely new Process without change the current Process
if ($importOption == 3) {
//krumo ($oData); die;
$sNewProUid = $oProcess->getUnusedProcessGUID();
$oProcess->setProcessGuid($oData, $sNewProUid);
$strAux = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date('M d, H:i');
$oData->process['PRO_TITLE'] = $strAux;
$oProcess->renewAll($oData);
$oProcess->createProcessFromData($oData, $localPath . $newfilename);
}
if ($importOption != 1 && $importOption != 2 && $importOption != 3) {
throw new Exception(G::loadTranslation('ID_PROCESS_ALREADY_IN_SYSTEM'));
}
}
//finally, creating the process if the process doesn't exist
if (!$oProcess->processExists($processId)) {
$oProcess->createProcessFromData($oData, $localPath . $newfilename);
}
//show the info after the imported process
$oProcess = new Processes();
$oProcess->ws_open_public();
//.........这里部分代码省略.........
示例6: verifyPath
/**
* verify path
*
* @author Fernando Ontiveros Lira <fernando@colosa.com>
* @access public
* @param string $strPath path
* @param boolean $createPath if true this public function will create the path
* @return boolean
*/
public function verifyPath($strPath, $createPath = false)
{
$folder_path = strstr($strPath, '.') ? dirname($strPath) : $strPath;
if (file_exists($strPath) || @is_dir($strPath)) {
return true;
} else {
if ($createPath) {
//TODO:: Define Environment constants: Devel (0777), Production (0770), ...
G::mk_dir($strPath, 0777);
} else {
return false;
}
}
return false;
}
示例7: Task
<?php
global $G_FORM;
$sPRO_UID = $oData->PRO_UID;
$sTASKS = $oData->TASKS;
$sDYNAFORM = $oData->DYNAFORM;
$sWE_TYPE = $oData->WE_TYPE;
$sWS_USER = $oData->WS_USER;
$sWS_PASS = $oData->WS_PASS;
$sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN;
$sWE_USR = $oData->WE_USR;
$withWS = $sWE_TYPE == 'WS';
G::LoadClass("system");
try {
$pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP;
G::mk_dir($pathProcess, 0777);
$oTask = new Task();
$TaskFields = $oTask->load($sTASKS);
$WE_EVN_UID = $oTask->getStartingEvent($sTASKS);
if ($TaskFields['TAS_ASSIGN_TYPE'] != 'BALANCED') {
throw new Exception("The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have a valid assignment type. The task needs to have a 'Cyclical Assignment'.");
}
G::LoadClass('tasks');
$oTask = new Tasks();
$user = $oTask->assignUsertoTask($sTASKS);
if ($user == 0) {
throw new Exception(G::LoadTranslation('ID_TASK') . "'" . $TaskFields['TAS_TITLE'] . "'" . G::LoadTranslation('ID_NOT_HAVE_USERS'));
}
$http = G::is_https() ? "https://" : "http://";
$sContent = '';
$infoProcess = new Process();
示例8: getTranslationEnvironments
function getTranslationEnvironments()
{
$filePath = $this->envFilePath;
$envs = array();
if (!file_exists($filePath)) {
//the transaltions table file doesn't exist, then build it
if (!is_dir(dirname($this->envFilePath))) {
G::mk_dir(dirname($this->envFilePath));
}
$translationsPath = PATH_CORE . "content" . PATH_SEP . 'translations' . PATH_SEP;
$basePOFile = $translationsPath . 'english' . PATH_SEP . 'processmaker.en.po';
$params = self::getInfoFromPOFile($basePOFile);
$this->addTranslationEnvironment($params['LOCALE'], $params['HEADERS'], $params['COUNT']);
//getting more lanuguage translations
$files = glob($translationsPath . "*.po");
foreach ($files as $file) {
$params = self::getInfoFromPOFile($file);
$this->addTranslationEnvironment($params['LOCALE'], $params['HEADERS'], $params['COUNT']);
}
}
$envs = unserialize(file_get_contents($filePath));
$environments = array();
foreach ($envs as $LAN_ID => $rec1) {
foreach ($rec1 as $IC_UID => $rec2) {
$environments[] = $rec2;
}
}
return $environments;
/*G::LoadSystem('dbMaintenance');
$o = new DataBaseMaintenance('localhost', 'root', 'atopml2005');
$o->connect('wf_os');
$r = $o->query('select * from ISO_COUNTRY');
foreach($r as $i=>$v){
$r[$i]['IC_NAME'] = utf8_encode($r[$i]['IC_NAME']);
unset($r[$i]['IC_SORT_ORDER']);
}
$r1 = $o->query('select * from LANGUAGE');
$r2 = Array();
foreach($r1 as $i=>$v){
$r2[$i]['LAN_NAME'] = utf8_encode($r1[$i]['LAN_NAME']);
$r2[$i]['LAN_ID'] = utf8_encode($r1[$i]['LAN_ID']);
}
$s = Array('ISO_COUNTRY'=>$r, 'LANGUAGE'=>$r2);
file_put_contents($translationsPath . 'pmos-translations.meta', serialize($s));
*/
}
示例9: explode
}
$ainfoSite = explode("/", $_SERVER["REQUEST_URI"]);
//it was added to show the logo into management plugin add by krlos
if (isset($_GET['wsName']) && $_GET['wsName'] != '') {
$ainfoSite[1] = $_GET['wsName'];
}
//end add
$dir = PATH_DATA . "sites" . PATH_SEP . str_replace("sys", "", $ainfoSite[1]) . PATH_SEP . "files/logos";
$imagen = $dir . PATH_SEP . $idDecode64;
if (is_file($imagen)) {
showLogo($imagen);
} else {
$newDir = PATH_DATA . "sites" . PATH_SEP . str_replace("sys", "", $ainfoSite[1]) . PATH_SEP . "files/logos";
$dir = PATH_HOME . "public_html/files/logos";
if (!is_dir($newDir)) {
G::mk_dir($newDir);
}
//this function does copy all logos from public_html/files/logos to /shared/site/yourSite/files/logos
//cpyMoreLogos($dir,$newDir);
$newDir .= PATH_SEP . $idDecode64;
$dir .= PATH_SEP . $idDecode64;
copy($dir, $newDir);
showLogo($newDir);
die;
}
function showLogo($imagen)
{
$info = @getimagesize($imagen);
$fp = fopen($imagen, "rb");
if ($info && $fp) {
header("Content-type: {$info['mime']}");
示例10: save
function save($params)
{
require_once 'classes/model/Event.php';
global $G_FORM;
$sPRO_UID = $params->pro_uid;
$sEVN_UID = $params->evn_uid;
$sDYNAFORM = $params->initDyna;
$sWS_USER = trim($params->username);
$sWS_PASS = trim($params->password);
$sWS_ROUNDROBIN = '';
$sWE_USR = '';
$xDYNA = $params->dynaform;
if ($xDYNA != '') {
$pro_uid = $params->pro_uid;
$filename = $xDYNA;
$filename = $filename . '.php';
unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename);
unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace(".php", "Post", $filename) . ".php");
}
//return $params;
G::LoadClass("system");
$pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP;
G::mk_dir($pathProcess, 0777);
$oEvent = new Event();
$oEvent->load($sEVN_UID);
$sTASKS = $oEvent->getEvnTasUidTo();
$oTask = new Task();
$oTask->load($sTASKS);
$tas_title = $oTask->getTasTitle();
if (G::is_https()) {
$http = 'https://';
} else {
$http = 'http://';
}
$sContent = '';
$SITE_PUBLIC_PATH = '';
if (file_exists($SITE_PUBLIC_PATH . '')) {
}
require_once 'classes/model/Dynaform.php';
$oDynaform = new Dynaform();
$aDynaform = $oDynaform->load($sDYNAFORM);
$dynTitle = str_replace(' ', '_', str_replace('/', '_', $aDynaform['DYN_TITLE']));
$sContent = "<?php\n";
$sContent .= "global \$_DBArray;\n";
$sContent .= "if (!isset(\$_DBArray)) {\n";
$sContent .= " \$_DBArray = array();\n";
$sContent .= "}\n";
$sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n";
$sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n";
$sContent .= "\$G_PUBLISH = new Publisher;\n";
$sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n";
$sContent .= "G::RenderPage('publish', 'blank');";
file_put_contents($pathProcess . $dynTitle . '.php', $sContent);
//creating the second file, the post file who receive the post form.
$pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl';
$template = new TemplatePower($pluginTpl);
$template->prepare();
$template->assign('wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2');
$template->assign('wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload');
$template->assign('processUid', $sPRO_UID);
$template->assign('dynaformUid', $sDYNAFORM);
$template->assign('taskUid', $sTASKS);
$template->assign('wsUser', $sWS_USER);
$template->assign('wsPass', 'md5:' . md5($sWS_PASS));
$template->assign('wsRoundRobin', $sWS_ROUNDROBIN);
if ($sWE_USR == "2") {
$template->assign('USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;");
} else {
$template->assign('USR_VAR', '$USR_UID = -1;');
}
$template->assign('dynaform', $dynTitle);
$template->assign('timestamp', date('l jS \\of F Y h:i:s A'));
$template->assign('ws', SYS_SYS);
$template->assign('version', System::getVersion());
$fileName = $pathProcess . $dynTitle . 'Post.php';
file_put_contents($fileName, $template->getOutputContent());
//creating the third file, only if this wsClient.php file doesn't exists.
$fileName = $pathProcess . 'wsClient.php';
$pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php';
if (file_exists($fileName)) {
if (filesize($fileName) != filesize($pluginTpl)) {
@copy($fileName, $pathProcess . 'wsClient.php.bck');
@unlink($fileName);
$template = new TemplatePower($pluginTpl);
$template->prepare();
file_put_contents($fileName, $template->getOutputContent());
}
} else {
$template = new TemplatePower($pluginTpl);
$template->prepare();
file_put_contents($fileName, $template->getOutputContent());
}
require_once 'classes/model/Event.php';
$oEvent = new Event();
$aDataEvent = array();
$aDataEvent['EVN_UID'] = $sEVN_UID;
$aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE';
$aDataEvent['EVN_ACTION'] = $sDYNAFORM;
$aDataEvent['EVN_CONDITIONS'] = $sWS_USER;
$output = $oEvent->update($aDataEvent);
//.........这里部分代码省略.........
示例11: PMFGenerateOutputDocument
/**
*
* @method
*
* Generates an Output Document
*
* @name PMFGenerateOutputDocument
* @label PMF Generate Output Document
*
* @param string(32) | $outputID | Output ID | Output Document ID
* @return none | $none | None | None
*
*/
function PMFGenerateOutputDocument($outputID, $sApplication = null, $index = null, $sUserLogged = null)
{
$g = new G();
$g->sessionVarSave();
if ($sApplication) {
$_SESSION["APPLICATION"] = $sApplication;
} else {
$sApplication = $_SESSION["APPLICATION"];
}
if ($index) {
$_SESSION["INDEX"] = $index;
} else {
$index = $_SESSION["INDEX"];
}
if ($sUserLogged) {
$_SESSION["USER_LOGGED"] = $sUserLogged;
} else {
$sUserLogged = $_SESSION["USER_LOGGED"];
}
G::LoadClass('case');
$oCase = new Cases();
$oCase->thisIsTheCurrentUser($sApplication, $index, $sUserLogged, '', 'casesListExtJs');
//require_once 'classes/model/OutputDocument.php';
$oOutputDocument = new OutputDocument();
$aOD = $oOutputDocument->load($outputID);
$Fields = $oCase->loadCase($sApplication);
//The $_GET['UID'] variable is used when a process executes.
//$_GET['UID']=($aOD['OUT_DOC_VERSIONING'])?$_GET['UID']:$aOD['OUT_DOC_UID'];
//$sUID = ($aOD['OUT_DOC_VERSIONING'])?$_GET['UID']:$aOD['OUT_DOC_UID'];
$sFilename = preg_replace('[^A-Za-z0-9_]', '_', G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA']));
require_once 'classes/model/AppFolder.php';
require_once 'classes/model/AppDocument.php';
//Get the Custom Folder ID (create if necessary)
$oFolder = new AppFolder();
//$aOD['OUT_DOC_DESTINATION_PATH'] = ($aOD['OUT_DOC_DESTINATION_PATH']=='')?PATH_DOCUMENT
// . $_SESSION['APPLICATION'] . PATH_SEP . 'outdocs'. PATH_SEP:$aOD['OUT_DOC_DESTINATION_PATH'];
$folderId = $oFolder->createFromPath($aOD['OUT_DOC_DESTINATION_PATH'], $sApplication);
//Tags
$fileTags = $oFolder->parseTags($aOD['OUT_DOC_TAGS'], $sApplication);
//Get last Document Version and apply versioning if is enabled
$oAppDocument = new AppDocument();
$lastDocVersion = $oAppDocument->getLastDocVersion($outputID, $sApplication);
$oCriteria = new Criteria('workflow');
$oCriteria->add(AppDocumentPeer::APP_UID, $sApplication);
//$oCriteria->add(AppDocumentPeer::DEL_INDEX, $index);
$oCriteria->add(AppDocumentPeer::DOC_UID, $outputID);
$oCriteria->add(AppDocumentPeer::DOC_VERSION, $lastDocVersion);
$oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT');
$oDataset = AppDocumentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
if ($aOD['OUT_DOC_VERSIONING'] && $lastDocVersion != 0) {
//Create new Version of current output
$lastDocVersion++;
if ($aRow = $oDataset->getRow()) {
$aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'], 'APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion + 1, 'USR_UID' => $sUserLogged, 'APP_DOC_TYPE' => 'OUTPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_FILENAME' => $sFilename, 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
$oAppDocument = new AppDocument();
$oAppDocument->create($aFields);
$sDocUID = $aRow['APP_DOC_UID'];
}
} else {
////No versioning so Update a current Output or Create new if no exist
if ($aRow = $oDataset->getRow()) {
//Update
$aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'], 'APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion, 'USR_UID' => $sUserLogged, 'APP_DOC_TYPE' => 'OUTPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_FILENAME' => $sFilename, 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
$oAppDocument = new AppDocument();
$oAppDocument->update($aFields);
$sDocUID = $aRow['APP_DOC_UID'];
} else {
//we are creating the appdocument row
//create
if ($lastDocVersion == 0) {
$lastDocVersion++;
}
$aFields = array('APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion, 'USR_UID' => $sUserLogged, 'APP_DOC_TYPE' => 'OUTPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_FILENAME' => $sFilename, 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
$oAppDocument = new AppDocument();
$aFields['APP_DOC_UID'] = $sDocUID = $oAppDocument->create($aFields);
}
}
$sFilename = $aFields['APP_DOC_UID'] . "_" . $lastDocVersion;
$pathOutput = PATH_DOCUMENT . G::getPathFromUID($sApplication) . PATH_SEP . 'outdocs' . PATH_SEP;
//G::pr($sFilename);die;
G::mk_dir($pathOutput);
$aProperties = array();
if (!isset($aOD['OUT_DOC_MEDIA'])) {
$aOD['OUT_DOC_MEDIA'] = 'Letter';
}
//.........这里部分代码省略.........
示例12: prepare
/**
* Prepare the pmTable env
*/
public function prepare($loadSchema = true)
{
//prevent execute prepare() twice or more
if (is_object($this->dom)) {
return true;
}
$this->schemaFilename = 'schema.xml';
$this->baseDir = PATH_DB . SYS_SYS . PATH_SEP;
$this->targetDir = $this->baseDir . 'pmt-propel' . PATH_SEP . $this->dataSource . PATH_SEP;
$this->configDir = $this->targetDir . 'config' . PATH_SEP;
$this->dataDir = $this->targetDir . 'data' . PATH_SEP;
$this->classesDir = $this->baseDir . 'classes' . PATH_SEP;
// G::mk_dir create the requested dir and the parents directories if not exists
G::mk_dir($this->configDir);
G::mk_dir($this->dataDir);
if ($loadSchema) {
$this->loadSchema();
}
}
示例13: run_upgrade
function run_upgrade($command, $args)
{
CLI::logging("UPGRADE", PROCESSMAKER_PATH . "upgrade.log");
CLI::logging("Checking files integrity...\n");
//setting flag to true to check into sysGeneric.php
$flag = G::isPMUnderUpdating(1);
//start to upgrade
$checksum = System::verifyChecksum();
if ($checksum === false) {
CLI::logging(CLI::error("checksum.txt not found, integrity check is not possible") . "\n");
if (!CLI::question("Integrity check failed, do you want to continue the upgrade?")) {
CLI::logging("Upgrade failed\n");
$flag = G::isPMUnderUpdating(0);
die;
}
} else {
if (!empty($checksum['missing'])) {
CLI::logging(CLI::error("The following files were not found in the installation:") . "\n");
foreach ($checksum['missing'] as $missing) {
CLI::logging(" {$missing}\n");
}
}
if (!empty($checksum['diff'])) {
CLI::logging(CLI::error("The following files have modifications:") . "\n");
foreach ($checksum['diff'] as $diff) {
CLI::logging(" {$diff}\n");
}
}
if (!(empty($checksum['missing']) || empty($checksum['diff']))) {
if (!CLI::question("Integrity check failed, do you want to continue the upgrade?")) {
CLI::logging("Upgrade failed\n");
$flag = G::isPMUnderUpdating(0);
die;
}
}
}
CLI::logging("Clearing cache...\n");
if (defined('PATH_C')) {
G::rm_dir(PATH_C);
G::mk_dir(PATH_C, 0777);
}
$workspaces = get_workspaces_from_args($command);
$count = count($workspaces);
$first = true;
$errors = false;
$countWorkspace = 0;
$buildCacheView = array_key_exists("buildACV", $args);
foreach ($workspaces as $index => $workspace) {
if (!defined("SYS_SYS")) {
define("SYS_SYS", $workspace->name);
}
if (!defined("PATH_DATA_SITE")) {
define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP);
}
try {
$countWorkspace++;
CLI::logging("Upgrading workspaces ({$countWorkspace}/{$count}): " . CLI::info($workspace->name) . "\n");
$workspace->upgrade($first, $buildCacheView, $workspace->name);
$workspace->close();
$first = false;
} catch (Exception $e) {
CLI::logging("Errors upgrading workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n");
$errors = true;
}
}
// SAVE Upgrades/Patches
$arrayPatch = glob(PATH_TRUNK . 'patch-*');
if ($arrayPatch) {
foreach ($arrayPatch as $value) {
if (file_exists($value)) {
// copy content the patch
$names = pathinfo($value);
$nameFile = $names['basename'];
$contentFile = file_get_contents($value);
$contentFile = preg_replace("[\n|\r|\n\r]", '', $contentFile);
CLI::logging($contentFile . ' installed (' . $nameFile . ')', PATH_DATA . 'log/upgrades.log');
// move file of patch
$newFile = PATH_DATA . $nameFile;
G::rm_dir($newFile);
copy($value, $newFile);
G::rm_dir($value);
}
}
} else {
CLI::logging('ProcessMaker ' . System::getVersion() . ' installed', PATH_DATA . 'log/upgrades.log');
}
//Safe upgrade for JavaScript files
CLI::logging("\nSafe upgrade for files cached by the browser\n\n");
G::browserCacheFilesSetUid();
//Status
if ($errors) {
CLI::logging("Upgrade finished but there were errors upgrading workspaces.\n");
CLI::logging(CLI::error("Please check the log above to correct any issues.") . "\n");
} else {
CLI::logging("Upgrade successful\n");
}
//setting flag to false
$flag = G::isPMUnderUpdating(0);
}
示例14: setWeData
/**
* Set value in WE_DATA
*
* @param string $webEntryUid Unique id of Web Entry
*
* return void
*/
public function setWeData($webEntryUid)
{
try {
//Verify data
$this->throwExceptionIfNotExistsWebEntry($webEntryUid, $this->arrayFieldNameForException["webEntryUid"]);
//Set variables
$arrayWebEntryData = $this->getWebEntry($webEntryUid, true);
$processUid = $arrayWebEntryData["PRO_UID"];
$taskUid = $arrayWebEntryData["TAS_UID"];
$dynaFormUid = $arrayWebEntryData["DYN_UID"];
$webEntryMethod = $arrayWebEntryData["WE_METHOD"];
$webEntryInputDocumentAccess = $arrayWebEntryData["WE_INPUT_DOCUMENT_ACCESS"];
$webEntryData = "";
$wsRoundRobin = 0;
//0, 1 //0 - Cyclical Assignment
$pathDataPublicProcess = PATH_DATA_PUBLIC . $processUid;
//Delete previous files
if (trim($arrayWebEntryData["WE_DATA"]) != "") {
$fileName = str_replace(".php", "", trim($arrayWebEntryData["WE_DATA"]));
$file = $pathDataPublicProcess . PATH_SEP . $fileName . ".php";
if (is_file($file) && file_exists($file)) {
unlink($file);
unlink($pathDataPublicProcess . PATH_SEP . $fileName . "Post.php");
}
}
//Create files
\G::mk_dir($pathDataPublicProcess, 0777);
$http = \G::is_https() ? "https://" : "http://";
switch ($webEntryMethod) {
case "WS":
require_once PATH_RBAC . "model" . PATH_SEP . "RbacUsers.php";
$user = new \RbacUsers();
$arrayUserData = $user->load($arrayWebEntryData["USR_UID"]);
$usrUsername = $arrayUserData["USR_USERNAME"];
$usrPassword = $arrayUserData["USR_PASSWORD"];
$dynaForm = new \Dynaform();
$arrayDynaFormData = $dynaForm->Load($arrayWebEntryData["DYN_UID"]);
//Creating sys.info;
$sitePublicPath = "";
if (file_exists($sitePublicPath . "")) {
}
//Creating the first file
$weTitle = $this->sanitizeFilename($arrayWebEntryData["WE_TITLE"]);
$fileName = $weTitle;
$fileContent = "<?php\n";
$fileContent .= "global \$_DBArray;\n";
$fileContent .= "if (!isset(\$_DBArray)) {\n";
$fileContent .= " \$_DBArray = array();\n";
$fileContent .= "}\n";
$fileContent .= "\$_SESSION[\"PROCESS\"] = \"" . $processUid . "\";\n";
$fileContent .= "\$_SESSION[\"CURRENT_DYN_UID\"] = \"" . $dynaFormUid . "\";\n";
$fileContent .= "\$G_PUBLISH = new Publisher();\n";
$fileContent .= "G::LoadClass(\"pmDynaform\");\n";
$fileContent .= "\$a = new pmDynaform(array(\"CURRENT_DYNAFORM\" => \"" . $arrayWebEntryData["DYN_UID"] . "\"));\n";
$fileContent .= "if (\$a->isResponsive()) {";
$fileContent .= " \$a->printWebEntry(\"" . $fileName . "Post.php\");";
$fileContent .= "} else {";
$fileContent .= " \$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . PATH_SEP . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n";
$fileContent .= " G::RenderPage(\"publish\", \"blank\");";
$fileContent .= "}";
file_put_contents($pathDataPublicProcess . PATH_SEP . $fileName . ".php", $fileContent);
//Creating the second file, the post file who receive the post form.
$pluginTpl = PATH_TPL . "processes" . PATH_SEP . "webentryPost.tpl";
$template = new \TemplatePower($pluginTpl);
$template->prepare();
$template->assign("wsdlUrl", $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2");
$template->assign("wsUploadUrl", $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/upload");
$template->assign("processUid", $processUid);
$template->assign("dynaformUid", $dynaFormUid);
$template->assign("taskUid", $taskUid);
$template->assign("wsUser", $usrUsername);
$template->assign("wsPass", \Bootstrap::getPasswordHashType() . ':' . $usrPassword);
$template->assign("wsRoundRobin", $wsRoundRobin);
if ($webEntryInputDocumentAccess == 0) {
//Restricted to process permissions
$template->assign("USR_VAR", "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;");
} else {
//No Restriction
$template->assign("USR_VAR", "\$USR_UID = -1;");
}
$template->assign("dynaform", $arrayDynaFormData["DYN_TITLE"]);
$template->assign("timestamp", date("l jS \\of F Y h:i:s A"));
$template->assign("ws", SYS_SYS);
$template->assign("version", \System::getVersion());
$fileName = $pathDataPublicProcess . PATH_SEP . $weTitle . "Post.php";
file_put_contents($fileName, $template->getOutputContent());
//Creating the third file, only if this wsClient.php file doesn't exist.
$fileName = $pathDataPublicProcess . PATH_SEP . "wsClient.php";
$pluginTpl = PATH_CORE . "templates" . PATH_SEP . "processes" . PATH_SEP . "wsClient.php";
if (file_exists($fileName)) {
if (filesize($fileName) != filesize($pluginTpl)) {
copy($fileName, $pathDataPublicProcess . PATH_SEP . "wsClient.php.bak");
unlink($fileName);
//.........这里部分代码省略.........
示例15: testMk_dir
/**
* @covers G::mk_dir
* @todo Implement testMk_dir().
*/
public function testMk_dir()
{
$newDir = PATH_HOME . 'test';
G::mk_dir($newDir);
$this->assertTrue(is_dir($newDir));
if (is_dir($newDir)) {
rmdir($newDir);
}
}