本文整理汇总了PHP中sugar_touch函数的典型用法代码示例。如果您正苦于以下问题:PHP sugar_touch函数的具体用法?PHP sugar_touch怎么用?PHP sugar_touch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sugar_touch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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');
}
示例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);
}
示例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}");
}
示例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;
}
示例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);
}
}
示例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']);
示例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));
}
示例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');
}
示例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');
}
示例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;
}