本文整理汇总了PHP中sugar_touch函数的典型用法代码示例。如果您正苦于以下问题:PHP sugar_touch函数的具体用法?PHP sugar_touch怎么用?PHP sugar_touch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sugar_touch函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testCustomAdditionalDetailsMetadataFileIsUsedBeforeNonCustomOne
public function testCustomAdditionalDetailsMetadataFileIsUsedBeforeNonCustomOne()
{
sugar_touch("modules/{$this->moduleName}/metadata/additionalDetails.php");
sugar_touch("custom/modules/{$this->moduleName}/metadata/additionalDetails.php");
$viewObject = new Bug40216Mock();
$this->assertEquals("custom/modules/{$this->moduleName}/metadata/additionalDetails.php", $viewObject->getAdditionalDetailsMetadataFile($this->moduleName));
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:7,代码来源:Bug40216Test.php
示例2: setUp
public function setUp()
{
sugar_mkdir('tests/include/utils/ziptest/testarchive', null, true);
sugar_touch('tests/include/utils/ziptest/testarchive/testfile1.txt');
sugar_touch('tests/include/utils/ziptest/testarchive/testfile2.txt');
sugar_touch('tests/include/utils/ziptest/testarchive/testfile3.txt');
sugar_mkdir('tests/include/utils/ziptest/testarchiveoutput', null, true);
}
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:8,代码来源:ZipTest.php
示例3: setUp
public function setUp()
{
$this->testdir = sugar_cached("tests/include/utils/ziptest");
sugar_mkdir($this->testdir . '/testarchive', null, true);
sugar_touch($this->testdir . '/testarchive/testfile1.txt');
sugar_touch($this->testdir . '/testarchive/testfile2.txt');
sugar_touch($this->testdir . '/testarchive/testfile3.txt');
sugar_mkdir($this->testdir . '/testarchiveoutput', null, true);
}
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:9,代码来源:ZipTest.php
示例4: testDisplayWithClassicCustomView
public function testDisplayWithClassicCustomView()
{
$view = $this->getMock('ViewClassic', array('includeClassicFile'));
$view->module = 'testmodule' . mt_rand();
$view->action = 'testaction' . mt_rand();
sugar_mkdir("custom/modules/{$view->module}", null, true);
sugar_touch("custom/modules/{$view->module}/{$view->action}.php");
$return = $view->display();
rmdir_recursive("custom/modules/{$view->module}");
$this->assertTrue($return);
}
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:11,代码来源:ViewClassicTest.php
示例5: run
public function run()
{
if (version_compare($this->from_version, '7.6', '>=')) {
return;
}
foreach (glob('custom/include/language/*.lang.php') as $file) {
if (is_dir($file)) {
continue;
}
sugar_touch($file);
}
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:12,代码来源:9_TouchStudioLanguageCustomizations.php
示例6: setUp
public function setUp()
{
$GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
$GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']);
$GLOBALS['module'] = 'Imports';
$_REQUEST['module'] = 'Imports';
$_REQUEST['import_module'] = 'Accounts';
$_REQUEST['action'] = 'last';
$_REQUEST['type'] = '';
$_REQUEST['has_header'] = 'off';
sugar_touch('upload/import/status_' . $GLOBALS['current_user']->id . '.csv');
}
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:12,代码来源:Bug48496Test.php
示例7: setUp
public function setUp()
{
if (!class_exists('ZipArchive')) {
$this->markTestSkipped('ZipArchive class not loaded');
}
$this->testdir = sugar_cached("tests/include/utils/ziptest");
sugar_mkdir($this->testdir . '/testarchive', null, true);
sugar_touch($this->testdir . '/testarchive/testfile1.txt');
sugar_touch($this->testdir . '/testarchive/testfile2.txt');
sugar_touch($this->testdir . '/testarchive/testfile3.txt');
sugar_mkdir($this->testdir . '/testarchiveoutput', null, true);
}
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:12,代码来源:ZipTest.php
示例8: mt_rand
public function testCallLegacyCodeIfLegacyDetailViewAndNewDetailViewFoundAndCustomLegacyDetailViewFoundAndCustomNewDetailViewFound()
{
$module_name = 'TestModule' . mt_rand();
sugar_mkdir("custom/modules/{$module_name}/views", null, true);
sugar_touch("custom/modules/{$module_name}/views/view.detail.php");
sugar_touch("custom/modules/{$module_name}/DetailView.php");
sugar_mkdir("modules/{$module_name}/views", null, true);
sugar_touch("modules/{$module_name}/views/view.detail.php");
sugar_touch("modules/{$module_name}/DetailView.php");
$controller = new SugarControllerMock();
$controller->setup($module_name);
$controller->do_action = 'DetailView';
$controller->view = 'list';
$controller->callLegacyCode();
$this->assertEquals('list', $controller->view);
rmdir_recursive("modules/{$module_name}");
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:17,代码来源:SugarControllerTest.php
示例9: copy_recursive_with_backup
function copy_recursive_with_backup($source, $dest, $backup_path, $uninstall = false)
{
if (is_file($source)) {
if ($uninstall) {
$GLOBALS['log']->debug("Restoring ... " . $source . " to " . $dest);
if (copy($source, $dest)) {
if (is_writable($dest)) {
sugar_touch($dest, filemtime($source));
}
return unlink($source);
} else {
$GLOBALS['log']->debug("Can't restore file: " . $source);
return true;
}
} else {
if (file_exists($dest)) {
$rest = clean_path($backup_path . "/{$dest}");
if (!is_dir(dirname($rest))) {
mkdir_recursive(dirname($rest), true);
}
$GLOBALS['log']->debug("Backup ... " . $dest . " to " . $rest);
if (copy($dest, $rest)) {
if (is_writable($rest)) {
sugar_touch($rest, filemtime($dest));
}
} else {
$GLOBALS['log']->debug("Can't backup file: " . $dest);
}
}
return copy($source, $dest);
}
} elseif (!is_dir($source)) {
if ($uninstall) {
if (is_file($dest)) {
return unlink($dest);
} else {
//don't do anything we already cleaned up the files using uninstall_new_files
return true;
}
} else {
return false;
}
}
if (!is_dir($dest) && !$uninstall) {
sugar_mkdir($dest);
}
$status = true;
$d = dir($source);
while ($f = $d->read()) {
if ($f == "." || $f == "..") {
continue;
}
$status &= $this->copy_recursive_with_backup("{$source}/{$f}", "{$dest}/{$f}", $backup_path, $uninstall);
}
$d->close();
return $status;
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:57,代码来源:ModuleInstaller.php
示例10: sugar_file_get_contents
/**
* sugar_file_get_contents
*
* @param $filename - String value of the file to create
* @param $use_include_path - boolean value indicating whether or not to search the the included_path
* @param $context
* @return string|boolean - Returns a file data on success, false otherwise
*/
function sugar_file_get_contents($filename, $use_include_path = false, $context = null)
{
//check to see if the file exists, if not then use touch to create it.
if (!file_exists($filename)) {
sugar_touch($filename);
}
if (!is_readable($filename)) {
$GLOBALS['log']->error("File {$filename} cannot be read");
return false;
}
if (empty($context)) {
return file_get_contents($filename, $use_include_path);
} else {
return file_get_contents($filename, $use_include_path, $context);
}
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:24,代码来源:sugar_file_utils.php
示例11: mkdir_recursive
if ($install_type == "patch" && is_file($dest_file)) {
if (!is_dir(dirname($rest_file))) {
mkdir_recursive(dirname($rest_file));
}
copy($dest_file, $rest_file);
sugar_touch($rest_file, filemtime($dest_file));
}
if (!copy($src_file, $dest_file)) {
die($mod_strings['ERR_UW_COPY_FAILED'] . $src_file . $mod_strings['LBL_TO'] . $dest_file);
}
$uh_status = "installed";
break;
case "Uninstall":
if ($install_type == "patch" && is_file($rest_file)) {
copy($rest_file, $dest_file);
sugar_touch($dest_file, filemtime($rest_file));
} elseif (file_exists($dest_file) && !unlink($dest_file)) {
die($mod_strings['ERR_UW_REMOVE_FAILED'] . $dest_file);
}
$uh_status = "uninstalled";
break;
default:
die("{$mod_strings['LBL_UW_OP_MODE']} '{$mode}' {$mod_strings['ERR_UW_NOT_RECOGNIZED']}.");
}
$files_to_handle[] = clean_path("{$zip_to_dir}/{$file_to_copy}");
}
}
switch ($install_type) {
case "langpack":
if (!isset($_REQUEST['new_lang_name']) || $_REQUEST['new_lang_name'] == "") {
die($mod_strings['ERR_UW_NO_LANG']);
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:UpgradeWizard_commit.php
示例12: testSugarTouchWithAccessTime
public function testSugarTouchWithAccessTime()
{
$time = filemtime($this->_filename);
$atime = gmmktime();
$this->assertTrue(sugar_touch($this->_filename, $time, $atime));
$this->assertEquals($time, filemtime($this->_filename));
$this->assertEquals($atime, fileatime($this->_filename));
}
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:8,代码来源:SugarFileUtilsTest.php
示例13: searchEngineDown
/**
* searchEngineDown
*
* This function creates a cache file to indicate search engine is down
*
*/
function searchEngineDown()
{
$cacheDir = create_cache_directory('fts/');
sugar_touch($cacheDir . '/fts_down');
}
开发者ID:vsanth,项目名称:dynamic-crm,代码行数:11,代码来源:utils.php
示例14: testGetTemplateDefaultCustom
public function testGetTemplateDefaultCustom()
{
create_custom_directory('themes/default/tpls/');
sugar_touch('custom/themes/default/tpls/SomeDefaultTemplate.tpl');
$this->assertEquals('custom/themes/default/tpls/SomeDefaultTemplate.tpl', $this->_themeObject->getTemplate('SomeDefaultTemplate.tpl'));
unlink('custom/themes/default/tpls/SomeDefaultTemplate.tpl');
}
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:7,代码来源:SugarThemeTest.php
示例15: fixRevenueLineItemModule
/**
* Enable and Show the RevenueLine Item Module
*
* - Add the file that shows the RLI Module
* - Adds the `studio.php` file
* - Puts RLI module from the menu bar
* - Adds the ACL Actions
*/
protected function fixRevenueLineItemModule()
{
// lets make sure the dir is there
SugarAutoLoader::ensureDir($this->rliModuleExtFolder . '/Vardefs');
$file_contents = <<<EOL
<?php
\$dictionary['RevenueLineItem']['importable'] = true;
\$dictionary['RevenueLineItem']['unified_search'] = true;
EOL;
sugar_file_put_contents($this->rliModuleExtFolder . '/Vardefs/' . $this->rliModuleExtVardefFile, $file_contents);
SugarAutoLoader::ensureDir($this->appExtFolder . '/Include');
// we need to run the code we are putting in the custom file
$GLOBALS['moduleList'][] = 'RevenueLineItems';
if (isset($GLOBALS['modInvisList']) && is_array($GLOBALS['modInvisList'])) {
foreach ($GLOBALS['modInvisList'] as $key => $mod) {
if ($mod === 'RevenueLineItems') {
unset($GLOBALS['modInvisList'][$key]);
}
}
}
$file_contents = <<<EOL
<?php
\$moduleList[] = 'RevenueLineItems';
if (isset(\$modInvisList) && is_array(\$modInvisList)) {
foreach (\$modInvisList as \$key => \$mod) {
if (\$mod === 'RevenueLineItems') {
unset(\$modInvisList[\$key]);
}
}
}
EOL;
sugar_file_put_contents($this->appExtFolder . '/Include/' . $this->rliModuleExtFile, $file_contents);
// enable the ACLs on RevenueLineItems
ACLAction::addActions('RevenueLineItems');
// show the rli module in WorkFlows
$affected_modules = $this->toggleRevenueLineItemsLinkInWorkFlows(true);
// show the rli module in the mega menu
$this->setRevenueLineItemModuleTab(true);
// handle the parent_type_field
$this->setRevenueLineItemInParentRelateDropDown(true);
// enable the item in the quick create
$this->toggleRevenueLineItemQuickCreate(true);
// place the studio file
sugar_touch($this->rliStudioFile);
$affected_modules[] = 'RevenueLineItems';
return $affected_modules;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:55,代码来源:OpportunityWithRevenueLineItem.php
示例16: testScanCopy
/**
* @dataProvider scanCopyProvider
* @param string $from
* @param string $to
* @param bool $ok is it supposed to be ok?
*/
public function testScanCopy($file, $from, $to, $ok)
{
$this->markTestIncomplete('This test requires files.md5.');
if (is_file('files.md5')) {
copy('files.md5', 'files.md5.copy');
}
copy(__DIR__ . "/../upgrade/files.md5", "files.md5");
// ensure target file exists
$from = sugar_cached("ModuleScannerTest/{$from}");
$file = sugar_cached("ModuleScannerTest/{$file}");
mkdir_recursive(dirname($file));
sugar_touch($file);
$ms = new ModuleScanner();
$ms->scanCopy($from, $to);
if ($ok) {
$this->assertEmpty($ms->getIssues(), "Issue found where it should not be");
} else {
$this->assertNotEmpty($ms->getIssues(), "Issue not detected");
}
// check with dir
$ms->scanCopy(dirname($from), $to);
if ($ok) {
$this->assertEmpty($ms->getIssues(), "Issue found where it should not be");
} else {
$this->assertNotEmpty($ms->getIssues(), "Issue not detected");
}
}
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:33,代码来源:ModuleScannerTest.php
示例17: sugar_file_put_contents
/**
* sugar_file_put_contents
* Call this function instead of file_put_contents to apply preconfigured permission
* settings when creating the the file. This method is basically
* a wrapper to the PHP file_put_contents function except that it supports setting
* the mode value by using the configuration file (if set). The mode is
* 0777 by default.
*
* @param $filename - String value of the file to create
* @param $data - The data to be written to the file
* @param $flags - int as specifed by file_put_contents parameters
* @param $context
* @return int - Returns the number of bytes written to the file, false otherwise.
*/
function sugar_file_put_contents($filename, $data, $flags = null, $context = null)
{
//check to see if the file exists, if not then use touch to create it.
if (!file_exists($filename)) {
sugar_touch($filename);
}
if (!is_writable($filename)) {
$GLOBALS['log']->error("File {$filename} cannot be written to");
return false;
}
if (empty($flags)) {
$return = file_put_contents($filename, $data);
} elseif (empty($context)) {
$return = file_put_contents($filename, $data, $flags);
} else {
$return = file_put_contents($filename, $data, $flags, $context);
}
// Add to the file loader cache if it isn't there
if ($return) {
if (!SugarAutoLoader::fileExists($filename)) {
SugarAutoLoader::addToMap($filename);
}
}
return $return;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:39,代码来源:sugar_file_utils.php
示例18: sugar_file_put_contents
/**
* sugar_file_put_contents
* Call this function instead of file_put_contents to apply preconfigured permission
* settings when creating the the file. This method is basically
* a wrapper to the PHP file_put_contents function except that it supports setting
* the mode value by using the configuration file (if set). The mode is
* 0777 by default.
*
* @param $filename - String value of the file to create
* @param $data - The data to be written to the file
* @param $flags - int as specifed by file_put_contents parameters
* @param $context
* @return int - Returns the number of bytes written to the file, false otherwise.
*/
function sugar_file_put_contents($filename, $data, $flags = null, $context = null)
{
//check to see if the file exists, if not then use touch to create it.
if (!file_exists($filename)) {
sugar_touch($filename);
}
if (empty($flags)) {
return file_put_contents($filename, $data);
} elseif (empty($context)) {
return file_put_contents($filename, $data, $flags);
} else {
return file_put_contents($filename, $data, $flags, $context);
}
}
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:28,代码来源:sugar_file_utils.php
示例19: createAnonymousRTLTheme
public static function createAnonymousRTLTheme()
{
$themename = 'TestTheme' . mt_rand();
sugar_mkdir("themes/{$themename}/images", null, true);
sugar_mkdir("themes/{$themename}/css", null, true);
sugar_mkdir("themes/{$themename}/js", null, true);
sugar_mkdir("themes/{$themename}/tpls", null, true);
sugar_file_put_contents("themes/{$themename}/css/style.css", "h2 { display: inline; }");
sugar_file_put_contents("themes/{$themename}/css/yui.css", ".yui { display: inline; }");
sugar_file_put_contents("themes/{$themename}/js/style.js", 'var dog = "cat";');
sugar_touch("themes/{$themename}/images/Accounts.gif");
sugar_touch("themes/{$themename}/images/fonts.big.icon.gif");
sugar_touch("themes/{$themename}/tpls/header.tpl");
$themedef = "<?php\n";
$themedef .= "\$themedef = array(\n";
$themedef .= "'name' => '{$themename}',";
$themedef .= "'dirName' => '{$themename}',";
$themedef .= "'description' => '{$themename}',";
$themedef .= "'directionality' => 'rtl',";
$themedef .= "'version' => array('regex_matches' => array('.*')),";
$themedef .= ");";
sugar_file_put_contents("themes/{$themename}/themedef.php", $themedef);
self::$_createdThemes[] = $themename;
SugarThemeRegistry::buildRegistry();
return $themename;
}
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:26,代码来源:SugarTestThemeUtilities.php
示例20: time
}
// try to use the content cached locally if it's the same as we have here.
if (defined('TEMPLATE_URL')) {
$last_modified_time = time();
} else {
$last_modified_time = filemtime($filename);
}
$etag = '"' . md5_file($filename) . '"';
header("Cache-Control: private");
header("Pragma: dummy=bogus");
header("Etag: {$etag}");
header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 2592000));
$ifmod = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $last_modified_time : null;
$iftag = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? $_SERVER['HTTP_IF_NONE_MATCH'] == $etag : null;
if (($ifmod || $iftag) && ($ifmod !== false && $iftag !== false)) {
header($_SERVER["SERVER_PROTOCOL"] . ' 304 Not Modified');
die;
}
header("Last-Modified: " . gmdate('D, d M Y H:i:s \\G\\M\\T', $last_modified_time));
// now send the content
if (substr($filename, -3) == 'gif') {
header("Content-Type: image/gif");
} elseif (substr($filename, -3) == 'png') {
header("Content-Type: image/png");
}
if (!defined('TEMPLATE_URL')) {
if (!file_exists($filename)) {
sugar_touch($filename);
}
}
readfile($filename);
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:31,代码来源:getImage.php
注:本文中的sugar_touch函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论