本文整理汇总了PHP中G::sys_get_temp_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP G::sys_get_temp_dir方法的具体用法?PHP G::sys_get_temp_dir怎么用?PHP G::sys_get_temp_dir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类G
的用法示例。
在下文中一共展示了G::sys_get_temp_dir方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.abbr.js', true);
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.dashboard.js', true);
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'widgets/js-calendar/js-calendar.js');
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'widgets/suggest/bsn.AutoSuggest_2.1.3.js');
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'widgets/tooltip/pmtooltip.js');
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'thirdparty/krumo/krumo.js');
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'widgets/calendar/pmcalendar.js', true);
$oHeadPublisher->addMaborakFile(PATH_CORE . 'js' . PATH_SEP . 'cases/core/cases.js', true);
$oHeadPublisher->addMaborakFile(PATH_CORE . 'js' . PATH_SEP . 'cases/core/cases_Step.js', true);
$oHeadPublisher->addMaborakFile(PATH_CORE . 'js' . PATH_SEP . 'processmap/core/processmap.js', true);
$oHeadPublisher->addMaborakFile(PATH_CORE . 'js' . PATH_SEP . 'appFolder/core/appFolderList.js', true);
$oHeadPublisher->addMaborakFile(PATH_THIRDPARTY . 'htmlarea/editor.js', true);
//check if it is a installation instance
if (!defined('PATH_C')) {
// is a intallation instance, so we need to define PATH_C and PATH_LANGUAGECONT constants temporarily
define('PATH_C', rtrim(G::sys_get_temp_dir(), PATH_SEP) . PATH_SEP);
define('PATH_LANGUAGECONT', PATH_HOME . 'engine/content/languages/');
}
// defining Virtual URLs
$virtualURITable = array();
$virtualURITable['/plugin/(*)'] = 'plugin';
$virtualURITable['/(sys*)/(*.js)'] = 'jsMethod';
$virtualURITable['/js/(*)'] = PATH_GULLIVER_HOME . 'js/';
$virtualURITable['/jscore/(*)'] = PATH_CORE . 'js/';
if (defined('PATH_C')) {
$virtualURITable['/jsform/(*.js)'] = PATH_C . 'xmlform/';
$virtualURITable['/extjs/(*)'] = PATH_C . 'ExtJs/';
}
$virtualURITable['/htmlarea/(*)'] = PATH_THIRDPARTY . 'htmlarea/';
$virtualURITable['/sys[a-zA-Z][a-zA-Z0-9]{0,}()/'] = 'sysNamed';
$virtualURITable['/(sys*)'] = FALSE;
示例2: renderTemplate
/**
* render a smarty template
*
* @author Erik Amaru Ortiz <erik@colosa.com>
* @param $template string containing the template filename on /gulliver/templates/ directory
* @param $data associative array containig the template data
*/
public function renderTemplate($template, $data = array())
{
if (!defined('PATH_THIRDPARTY')) {
throw new Exception('System constant (PATH_THIRDPARTY) is not defined!');
}
require_once PATH_THIRDPARTY . 'smarty/libs/Smarty.class.php';
$fInfo = pathinfo($template);
$tplExists = true;
// file has absolute path
if (strpos($template, PATH_TRUNK) === false) {
$template = PATH_TPL . $template;
}
// fix for template that have dot in its name but is not a valid extension
if (isset($fInfo['extension']) && ($fInfo['extension'] != 'tpl' || $fInfo['extension'] != 'html')) {
unset($fInfo['extension']);
}
if (!isset($fInfo['extension'])) {
if (file_exists($template . '.tpl')) {
$template .= '.tpl';
} elseif (file_exists($template . '.html')) {
$template .= '.html';
} else {
$tplExists = false;
}
} else {
if (!file_exists($template)) {
$tplExists = false;
}
}
if (!$tplExists) {
throw new Exception("Template: {$template}, doesn't exist!");
}
$smarty = new Smarty();
$smarty->compile_dir = G::sys_get_temp_dir();
$smarty->cache_dir = G::sys_get_temp_dir();
$smarty->config_dir = PATH_THIRDPARTY . 'smarty/configs';
$smarty->template_dir = PATH_TEMPLATE;
$smarty->force_compile = true;
foreach ($data as $key => $value) {
$smarty->assign($key, $value);
}
$smarty->display($template);
}
示例3: testSys_get_temp_dir
/**
* @covers G::sys_get_temp_dir
* @todo Implement testSys_get_temp_dir().
*/
public function testSys_get_temp_dir()
{
$tmpDir = G::sys_get_temp_dir();
$this->assertFileExists($tmpDir);
$this->assertTrue(is_writable($tmpDir));
}
示例4: deleteTmpfile
/**
* This function removes a temporal file
*
*
* @name deleteTmpfile
*
* param
* @return void
*/
private function deleteTmpfile()
{
if ($this->sessionId == NULL) {
throw new Exception('session id was not set.');
}
$this->tmpfile = G::sys_get_temp_dir() . PATH_SEP . "pm-rg-{$this->sessionId}";
@unlink($this->tmpfile);
}
示例5: date
if (is_object($result)) {
$_SESSION['WS_SESSION_ID'] = '';
$fields['status_code'] = $result->status_code;
$fields['message'] = $result->message;
$fields['time_stamp'] = date("Y-m-d H:i:s");
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/wsShowResult', null, $fields);
}
}
G::RenderPage('publish', 'raw');
break;
case "wsSendFiles":
if (isset($_FILES['form'])) {
foreach ($_FILES['form']['name'] as $sFieldName => $vValue) {
if ($_FILES['form']['error'][$sFieldName] == 0) {
file_put_contents(G::sys_get_temp_dir() . PATH_SEP . $_FILES['form']['name'][$sFieldName], file_get_contents($_FILES['form']['tmp_name'][$sFieldName]));
$filename = G::sys_get_temp_dir() . PATH_SEP . $_FILES['form']['name'][$sFieldName];
}
}
}
// G::pr ( $_SESSION );
if (!isset($_POST['form']['INPUT_DOCUMENT'])) {
$_POST['form']['INPUT_DOCUMENT'] = '';
}
if (isset($_SESSION['_DBArray']['inputDocument'])) {
foreach ($_SESSION['_DBArray']['inputDocument'] as $inputDocument) {
if ($inputDocument['guid'] == $_POST['form']['INPUT_DOCUMENT']) {
$doc_uid = $inputDocument['docId'];
}
}
} else {
$doc_uid = "default";
示例6: run_workspace_backup
//.........这里部分代码省略.........
G::LoadSystem('dbMaintenance');
$oDbMaintainer = new DataBaseMaintenance($dbOpt[0], $dbOpt[1], $dbOpt[2]);
try {
$oDbMaintainer->connect("mysql");
} catch (Exception $e) {
echo "Problems contacting the database with the administrator user\n";
echo "The response was: {$e->getMessage()}\n";
}
require_once $dbFile;
require_once "propel/Propel.php";
G::LoadSystem('templatePower');
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'));
$con = Propel::getConnection('workflow');
$sql = "show variables like 'datadir'";
$stmt = $con->createStatement();
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
if (!is_array($row)) {
throw new Exception("unable to execute query in database");
}
$dataDir = $row['Value'];
if ($dataDir[count($dataDir) - 1] == '/') {
$dataDir = substr($dataDir, count($dataDir) - 1);
}
printf("MySQL data dir %s \n", pakeColor::colorize($dataDir, 'INFO'));
$sql = "SELECT VERSION();";
$stmt = $con->createStatement();
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM);
$rs->next();
$row = $rs->getRow();
$mysqlVersion = $row[0];
$aSerializeData['DATABASE'] = $mysqlVersion;
//new db restore rotines, by Erik <erik@colosa.com> on May 17th, 2010
//set the temporal directory for all tables into wf, rb, and rp databases
$tmpDir = G::sys_get_temp_dir() . PATH_SEP . 'pmDbBackup' . PATH_SEP;
//create the db maintenance temporal dir
G::mk_dir($tmpDir);
$fileMetadata = $tmpDir . 'metadata.txt';
$sMetadata = file_put_contents($fileMetadata, serialize($aSerializeData));
if ($sMetadata === false) {
throw new Exception("Metadata file could not be written");
}
G::LoadThirdParty('pear/Archive', 'Tar');
$tar = new Archive_Tar($fileTar);
if (!isset($gzipPath)) {
$tar->_compress = $compress;
}
/*** WORKFLOW DATABASE BACKUP ***/
$dbSettings = getDataBaseConfiguration($configuration['datasources']['workflow']['connection']);
backupDB($dbOpt[0], $dbOpt[1], $dbOpt[2], $dbSettings['dbname'], $tmpDir);
printf("Copying folder: %s \n", pakeColor::colorize($tmpDir, 'INFO'));
backupAddTarFolder($tar, $tmpDir . $dbSettings['dbname'] . PATH_SEP, $tmpDir);
/*** RBAC DATABASE BACKUP ***/
$dbSettings = getDataBaseConfiguration($configuration['datasources']['rbac']['connection']);
backupDB($dbOpt[0], $dbOpt[1], $dbOpt[2], $dbSettings['dbname'], $tmpDir);
printf("Copying folder: %s \n", pakeColor::colorize($tmpDir, 'INFO'));
backupAddTarFolder($tar, $tmpDir . $dbSettings['dbname'] . PATH_SEP, $tmpDir);
/*** RP DATABASE BACKUP ***/
$dbSettings = getDataBaseConfiguration($configuration['datasources']['rp']['connection']);
backupDB($dbOpt[0], $dbOpt[1], $dbOpt[2], $dbSettings['dbname'], $tmpDir);
printf("Copying folder: %s \n", pakeColor::colorize($tmpDir, 'INFO'));
backupAddTarFolder($tar, $tmpDir . $dbSettings['dbname'] . PATH_SEP, $tmpDir);
$pathSharedBase = PATH_DATA . 'sites' . PATH_SEP . $workspace . PATH_SEP;
printf("copying folder: %s \n", pakeColor::colorize($pathSharedBase, 'INFO'));
backupAddTarFolder($tar, $pathSharedBase, PATH_DATA . 'sites');
backupAddTarFolder($tar, $fileMetadata, dirname($fileMetadata));
unlink($fileMetadata);
$aFiles = $tar->listContent();
$total = 0;
foreach ($aFiles as $key => $val) {
// printf( " %6d %s \n", $val['size'], pakeColor::colorize( $val['filename'], 'INFO') );
$total += $val['size'];
}
/* If using system gzip, compress the temporary tar to the original
* filename.
*/
if (isset($gzipPath)) {
exec("gzip -c \"{$fileTar}\" > {$gzipFinal}", $output, $ret);
if ($ret != 0) {
/* The error message is in stderr, which should be displayed already */
echo pakeColor::colorize("Error compressing backup", "ERROR") . "\n";
die(1);
}
unlink($fileTar);
$fileTar = $gzipFinal;
}
printMetadata($aSerializeData);
printf("%20s %s \n", 'Backup File', pakeColor::colorize($fileTar, 'INFO'));
printf("%20s %s \n", 'Files in Backup', pakeColor::colorize(count($aFiles), 'INFO'));
printf("%20s %s \n", 'Total Filesize', pakeColor::colorize(sprintf("%5.2f MB", $total / 1024 / 1024), 'INFO'));
printf("%20s %s \n", 'Backup Filesize', pakeColor::colorize(sprintf("%5.2f MB", filesize($fileTar) / 1024 / 1024), 'INFO'));
} catch (Exception $e) {
printf("Error: %s\n", pakeColor::colorize($e->getMessage(), 'ERROR'));
exit(0);
}
}
示例7: fixEnvironment
/**
* On this method have some sys env, configuration, and other fixes
*/
public function fixEnvironment()
{
// IIS Compatibility, SERVER_ADDR doesn't exist on that env, so we need to define it.
$_SERVER['SERVER_ADDR'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME'];
//check if it is a installation instance
if (!defined('PATH_C')) {
// is a intallation instance, so we need to define PATH_C and PATH_LANGUAGECONT constants temporarily
define('PATH_C', rtrim(G::sys_get_temp_dir(), PATH_SEP) . PATH_SEP);
define('PATH_LANGUAGECONT', PATH_HOME . 'engine/content/languages/');
}
}